Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ErssIndividual
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alvruiz
ErssIndividual
Commits
0a17ebb4
Commit
0a17ebb4
authored
May 22, 2021
by
alvruiz
Browse files
Options
Downloads
Patches
Plain Diff
Update individual.py
parents
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
individual.py
+132
-0
132 additions, 0 deletions
individual.py
with
132 additions
and
0 deletions
individual.py
0 → 100644
+
132
−
0
View file @
0a17ebb4
import
os
import
argparse
NIVELES_CARGA_PRIND
=
[
150
]
PERIODOS_SUBIDA_PRIND
=
10
DURACION_PRIND
=
420
TIEMPO_PENSAR
=
30000
NIVELES_PENSAR
=
[
30000
]
#Función que elimina las líneas correspondientes a medidas fuera el periodo estacionario
def
eliminarLineas
(
rutaEntrada
,
rutaSalida
,
numHilos
):
ficheroEntrada
=
open
(
rutaEntrada
,
"
r
"
)
directorio
=
rutaSalida
[
0
:
rutaSalida
.
rfind
(
"
/
"
)]
if
not
os
.
path
.
exists
(
directorio
):
os
.
makedirs
(
directorio
)
ficheroSalida
=
open
(
rutaSalida
,
"
w
"
)
#Copiar cabecera
linea
=
ficheroEntrada
.
readline
()
ficheroSalida
.
write
(
linea
)
while
True
:
linea
=
ficheroEntrada
.
readline
()
if
not
linea
:
break
columnas
=
linea
.
split
(
"
,
"
)
#El número total de hilos ocupa la posición 13 en el fichero jtl
hilosLinea
=
int
(
columnas
[
12
])
if
hilosLinea
<
numHilos
:
continue
elif
hilosLinea
==
numHilos
:
ficheroSalida
.
write
(
linea
)
else
:
break
def
eliminarFilas
(
rutaEntrada
,
rutaSalida
,
numHilos
):
ficheroEntrada
=
open
(
rutaEntrada
,
"
r
"
)
directorio
=
rutaSalida
[
0
:
rutaSalida
.
rfind
(
"
/
"
)]
if
not
os
.
path
.
exists
(
directorio
):
os
.
makedirs
(
directorio
)
ficheroSalida
=
open
(
rutaSalida
,
"
w
"
)
linea
=
ficheroEntrada
.
readline
()
while
True
:
linea
=
ficheroEntrada
.
readline
()
if
not
linea
:
break
columnas
=
linea
.
split
(
"
,
"
)
#El número total de hilos ocupa la posición 13 en el fichero jtl
#El número total de hilos ocupa la posición 13 en el fichero jtl
hilosLinea
=
int
(
columnas
[
12
])
if
hilosLinea
<
numHilos
:
continue
elif
hilosLinea
==
numHilos
:
linea2
=
columnas
[
0
]
+
"
,
"
+
columnas
[
1
]
+
"
,
"
+
columnas
[
2
]
+
"
,
"
+
columnas
[
3
]
+
"
,
"
+
columnas
[
4
]
+
"
,
"
+
columnas
[
5
]
+
"
,
"
+
columnas
[
6
]
+
"
,
"
+
columnas
[
7
]
+
"
,
"
+
columnas
[
9
]
+
"
,
"
+
columnas
[
10
]
+
"
\n
"
ficheroSalida
.
write
(
linea2
)
else
:
break
def
ejecutarJMeter
(
ficheroJMeter
,
nombreFichero
,
nombreLog
,
hilos
,
tiempoSubida
,
duracion
,
rutaAgregate
):
os
.
system
(
"
jmeter -n -t
"
+
ficheroJMeter
+
"
-l
"
+
nombreFichero
+
"
.jtl -j
"
+
nombreLog
+
"
.log -DHILOS=
"
+
str
(
hilos
)
+
"
-DSUBIDA=
"
+
str
(
tiempoSubida
)
+
"
-DDURACION=
"
+
str
(
duracion
)
+
"
-DRUTAPERFMON=
"
+
nombreFichero
+
"
perf.csv
"
+
"
-DRUTAPERFMON2=
"
+
rutaAgregate
)
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"
Script para trabajo individual
"
)
parser
.
add_argument
(
"
-p
"
,
help
=
"
Práctica(s) a ejecutar
"
,
type
=
int
,
nargs
=
"
+
"
,
metavar
=
"
P
"
)
parser
.
add_argument
(
"
-n
"
,
help
=
"
Nivel(es) de carga a ejecutar (en caso de que haya más de uno)
"
,
type
=
int
,
nargs
=
"
+
"
,
metavar
=
"
N
"
)
parser
.
add_argument
(
'
-r
'
,
help
=
"
Solo recortar fichero
"
,
action
=
'
store_true
'
)
argumentos
=
parser
.
parse_args
()
#Practica
if
not
argumentos
.
p
or
1
in
argumentos
.
p
:
for
j
in
NIVELES_PENSAR
:
for
i
in
NIVELES_CARGA_PRIND
:
if
not
argumentos
.
n
or
i
in
argumentos
.
n
:
hilos
=
i
pensar
=
j
nombreFichero
=
"
Resultados/Originales/indiv
"
+
str
(
i
)
+
str
(
j
)
nombreFicheroEditado
=
"
Resultados/Corregidos/indiv
"
+
str
(
hilos
)
+
str
(
j
)
+
"
.jtl
"
nombreFicheroEditado2
=
"
Resultados/Corregidos/indivCov
"
+
str
(
hilos
)
+
str
(
j
)
+
"
.csv
"
nombreFicheroEditado3
=
"
Resultados/Corregidos/indivCov2
"
+
str
(
hilos
)
+
str
(
j
)
+
"
.csv
"
nombreLog
=
"
Logs/Practica3/indiv
"
+
str
(
i
)
rutaAgregate
=
"
Resultados/Originales/Agregate/agreg
"
+
str
(
i
)
+
"
.csv
"
rutaAgregateEditado
=
"
Resultados/Corregidos/Agregate/agreg
"
+
str
(
i
)
+
"
.csv
"
tiempoSubida
=
PERIODOS_SUBIDA_PRIND
duracion
=
tiempoSubida
+
DURACION_PRIND
if
not
argumentos
.
r
:
print
(
"
===================================================================================
"
)
print
(
"
Ejecutando práctica individual tiempo de pensar
"
+
str
(
hilos
)
+
str
(
j
)
+
"
milisegundos...
"
)
print
(
"
===================================================================================
\n\n
"
)
ejecutarJMeter
(
"
individual.jmx
"
,
nombreFichero
,
nombreLog
,
hilos
,
tiempoSubida
,
duracion
,
rutaAgregate
)
print
(
"
\n\n
===================================================================================
"
)
print
(
"
Terminada ejecución práctica individual tiempo de pensar
"
+
str
(
hilos
)
+
str
(
j
)
+
"
milisegundos
"
)
print
(
"
===================================================================================
\n
"
)
print
(
"
===================================================================================
"
)
print
(
"
Eliminando periodo de subida del resultado...
"
)
print
(
"
===================================================================================
\n
"
)
eliminarLineas
(
nombreFichero
+
"
.jtl
"
,
nombreFicheroEditado
,
hilos
)
eliminarFilas
(
nombreFichero
+
"
.jtl
"
,
nombreFicheroEditado2
,
hilos
)
print
(
"
===================================================================================
"
)
print
(
"
Eliminado periodo de subida del resultado...
"
)
print
(
"
===================================================================================
\n
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment