Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Poulpe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
octobus
Poulpe
Commits
52997aff
Commit
52997aff
authored
3 years ago
by
Pierre-Yves David
Browse files
Options
Downloads
Patches
Plain Diff
support a cwd property
parent
4a192ae7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/run-util
+29
-12
29 additions, 12 deletions
bin/run-util
tests/test-simple-run.t
+3
-0
3 additions, 0 deletions
tests/test-simple-run.t
with
32 additions
and
12 deletions
bin/run-util
+
29
−
12
View file @
52997aff
...
...
@@ -18,6 +18,11 @@
def
__init__
(
self
,
benchmark_data
):
self
.
_benchmark_data
=
benchmark_data
self
.
base_command
=
benchmark_data
[
'
simple-command
'
][
'
command
'
]
def
get_var
(
key
):
key
=
f
'
simple-command.
{
key
}
'
return
poulpe
.
get_one_value
(
benchmark_data
,
key
)
self
.
base_command
=
get_var
(
'
command
'
)
self
.
command
=
None
...
...
@@ -22,3 +27,6 @@
self
.
command
=
None
self
.
cwd
=
get_var
(
'
cwd
'
)
def
apply_data_env
(
self
,
data_env_data
):
...
...
@@ -24,8 +32,8 @@
def
apply_data_env
(
self
,
data_env_data
):
variables_data
=
self
.
_benchmark_data
[
'
simple-command
'
]
[
'
variables
'
]
variables_data
=
self
.
_benchmark_data
[
'
simple-command
'
]
.
get
(
'
variables
'
)
def
get_var
(
key
):
full_key
=
f
'
bench-input-vars.
{
key
}
'
return
poulpe
.
get_one_value
(
data_env_data
,
full_key
)
variables
=
{}
...
...
@@ -26,15 +34,16 @@
def
get_var
(
key
):
full_key
=
f
'
bench-input-vars.
{
key
}
'
return
poulpe
.
get_one_value
(
data_env_data
,
full_key
)
variables
=
{}
for
name
,
value
in
variables_data
.
items
():
if
value
.
startswith
(
'
DATA-VARS:
'
):
key
=
value
.
split
(
'
:
'
,
1
)[
1
]
value
=
get_var
(
key
)
assert
value
is
not
None
variables
[
name
]
=
value
if
variables_data
is
not
None
:
for
name
,
value
in
variables_data
.
items
():
if
value
.
startswith
(
'
DATA-VARS:
'
):
key
=
value
.
split
(
'
:
'
,
1
)[
1
]
value
=
get_var
(
key
)
assert
value
is
not
None
variables
[
name
]
=
value
self
.
command
=
self
.
base_command
.
format
(
**
variables
)
...
...
@@ -38,6 +47,10 @@
self
.
command
=
self
.
base_command
.
format
(
**
variables
)
if
self
.
cwd
.
startswith
(
'
DATA-VARS:
'
):
key
=
self
.
cwd
.
split
(
'
:
'
,
1
)[
1
]
self
.
cwd
=
get_var
(
key
)
def
run_one
(
bin_env_path
,
data_env_path
,
benchmark
,
result
):
result_data
=
{}
...
...
@@ -62,7 +75,7 @@
cmd
=
SimpleCommand
(
benchmark_data
)
cmd
.
apply_data_env
(
data_env_data
)
r
=
_time_command
(
bin_env_path
,
data_env_path
,
cmd
.
command
)
r
=
_time_command
(
bin_env_path
,
data_env_path
,
cmd
)
# we should store more
result_data
[
'
result
'
]
=
{}
...
...
@@ -82,6 +95,5 @@
time_cmd
=
[
shell_path
,
"
hyperfine
"
,
cmd
,
"
--export-json
"
,
tmp_result
.
name
,
...
...
@@ -86,5 +98,6 @@
"
--export-json
"
,
tmp_result
.
name
,
"
--ignore-failure
"
,
"
--
"
,
cmd
.
command
,
]
...
...
@@ -89,4 +102,8 @@
]
cwd
=
data_env_path
if
cmd
.
cwd
is
not
None
:
cwd
=
os
.
path
.
join
(
cwd
,
cmd
.
cwd
)
subprocess
.
check_call
(
time_cmd
,
...
...
@@ -91,6 +108,6 @@
subprocess
.
check_call
(
time_cmd
,
cwd
=
data_env_path
,
cwd
=
cwd
,
stdout
=
subprocess
.
DEVNULL
,
stderr
=
subprocess
.
DEVNULL
,
)
...
...
This diff is collapsed.
Click to expand it.
tests/test-simple-run.t
+
3
−
0
View file @
52997aff
...
...
@@ -75,6 +75,7 @@
$
env
-
desc
set
black
-
tiny
-
bad
.
pbd
meta
.
method
simple
-
command
$
env
-
desc
set
black
-
tiny
-
bad
.
pbd
simple
-
command
.
command
"
black --check {file}
"
$
env
-
desc
set
black
-
tiny
-
bad
.
pbd
simple
-
command
.
variables
.
file
DATA
-
VARS:black
.
check
.
tiny
.
bad
$
env
-
desc
set
black
-
tiny
-
bad
.
pbd
simple
-
command
.
cwd
DATA
-
VARS:
.
$
env
-
desc
show
black
-
tiny
-
bad
.
pbd
meta:
...
...
@@ -83,6 +84,7 @@
name
=
black
.
check
.
tiny
simple
-
command:
command
=
black
--
check
{
file
}
cwd
=
DATA
-
VARS:
.
variables:
file
=
DATA
-
VARS:black
.
check
.
tiny
.
bad
...
...
@@ -119,6 +121,7 @@
name
=
black
.
check
.
tiny
simple
-
command:
command
=
black
--
check
{
file
}
cwd
=
DATA
-
VARS:
.
variables:
file
=
DATA
-
VARS:black
.
check
.
tiny
.
good
...
...
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
register
or
sign in
to comment