Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DetectorWriteSim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EWMSCP
DetectorWriteSim
Commits
9d670728
Commit
9d670728
authored
1 year ago
by
Michael Reuscher
Browse files
Options
Downloads
Patches
Plain Diff
new simrunner fix
parent
d023d059
No related branches found
No related tags found
1 merge request
!4
Python driver and data analysis part
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
simrunner/simrunner.py
+11
-22
11 additions, 22 deletions
simrunner/simrunner.py
with
11 additions
and
22 deletions
simrunner/simrunner.py
+
11
−
22
View file @
9d670728
...
...
@@ -8,12 +8,13 @@ import getpass
def
parse_arguments
():
main_folder
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
default_sim_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
../build/src/detsim
"
)
current_user
=
getpass
.
getuser
()
parser
=
argparse
.
ArgumentParser
(
description
=
'
Run a subprocess locally or on remote machines.
'
)
parser
.
add_argument
(
'
-s
'
,
'
--sim
'
,
type
=
str
,
default
=
default_sim_path
,
help
=
'
Path to the detector simulation script default: ./
'
)
parser
.
add_argument
(
'
-H
'
,
'
--hosts
'
,
nargs
=
'
+
'
,
type
=
str
,
help
=
'
Host addresses of remote machines default: lokal
'
)
parser
.
add_argument
(
'
-u
'
,
'
--user
'
,
type
=
str
,
parser
.
add_argument
(
'
-u
'
,
'
--user
'
,
type
=
str
,
default
=
current_user
,
help
=
'
Username for SSH connection default: current user
'
)
parser
.
add_argument
(
'
-f
'
,
'
--function
'
,
choices
=
[
'
various
'
,
'
long
'
],
default
=
'
various
'
,
help
=
'
Choose function to execute default: various
'
)
...
...
@@ -102,27 +103,15 @@ def run_sim(e_list, d_path, sim_path, st_path):
def
start_process
(
program_path
,
arguments
):
if
args
.
hosts
:
if
args
.
user
:
# Remote execution on multiple machines with specified user
for
host
in
args
.
hosts
:
ssh_command
=
f
'
{
args
.
user
}
@
{
host
}
'
command
=
[
"
ssh
"
,
ssh_command
]
+
arguments
print
(
command
)
result
=
subprocess
.
run
(
command
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
errors
=
result
.
stderr
return
output
,
errors
,
result
.
returncode
else
:
# Remote execution on multiple machines with current user
current_user
=
getpass
.
getuser
()
for
host
in
args
.
hosts
:
ssh_command
=
f
'
{
current_user
}
@
{
host
}
'
command
=
[
"
ssh
"
,
ssh_command
]
+
arguments
print
(
command
)
result
=
subprocess
.
run
(
command
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
errors
=
result
.
stderr
return
output
,
errors
,
result
.
returncode
# Remote execution on multiple machines with specified user
for
host
in
args
.
hosts
:
ssh_command
=
f
'
{
args
.
user
}
@
{
host
}
'
command
=
[
"
ssh
"
,
ssh_command
,
program_path
]
+
arguments
print
(
command
)
result
=
subprocess
.
run
(
command
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
errors
=
result
.
stderr
return
output
,
errors
,
result
.
returncode
else
:
command
=
[
program_path
]
+
arguments
result
=
subprocess
.
run
(
command
,
capture_output
=
True
,
text
=
True
)
...
...
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