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
a584c0b6
Commit
a584c0b6
authored
1 year ago
by
Michael Reuscher
Browse files
Options
Downloads
Patches
Plain Diff
Save new SSH stuff 1.0 it works
parent
e29fad6a
Branches
Branches containing commit
Tags
Tags containing commit
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
+14
-8
14 additions, 8 deletions
simrunner/simrunner.py
with
14 additions
and
8 deletions
simrunner/simrunner.py
+
14
−
8
View file @
a584c0b6
...
...
@@ -6,21 +6,21 @@ import getpass
def
parse_arguments
():
main_
folder
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
main_
directory
=
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
=
'
+
'
,
action
=
'
append
'
,
type
=
str
,
parser
.
add_argument
(
'
-H
'
,
'
--hosts
'
,
nargs
=
'
+
'
,
type
=
str
,
help
=
'
Host addresses of remote machines default: lokal
'
)
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
'
)
parser
.
add_argument
(
'
-d
'
,
'
--data
'
,
type
=
str
,
default
=
main_
folder
,
parser
.
add_argument
(
'
-d
'
,
'
--data
'
,
type
=
str
,
default
=
main_
directory
,
help
=
'
Folder to store the date for visualizer default: ./
'
)
parser
.
add_argument
(
'
-p
'
,
'
--protokoll
'
,
type
=
str
,
default
=
main_
folder
,
parser
.
add_argument
(
'
-p
'
,
'
--protokoll
'
,
type
=
str
,
default
=
main_
directory
,
help
=
'
Folder to store the test data from detector sim default: ./
'
)
return
parser
.
parse_args
()
...
...
@@ -89,7 +89,7 @@ def run_sim(e_list, d_path, sim_path, st_path):
relativ_path_stat
=
os
.
path
.
join
(
st_path
,
stat_file_name
+
"
.dat
"
)
if
not
args
.
hosts
:
make_folders_lokal
(
test_data_path
,
output_path
)
event
[
-
1
]
=
output_path
event
[
-
1
]
=
output_path
arguments
=
event
output
,
errors
,
return_code
=
start_process
(
sim_path
,
arguments
,
test_data_path
,
output_path
)
print
(
output
)
...
...
@@ -104,15 +104,18 @@ def run_sim(e_list, d_path, sim_path, st_path):
def
start_process
(
program_path
,
arguments
,
test_path
,
output_path
):
if
args
.
hosts
:
# Remote execution on multiple machines with specified user
output
=
""
errors
=
""
result
=
""
for
host
in
args
.
hosts
:
print
(
host
)
# Todooo
ssh_target
=
f
'
{
args
.
user
}
@
{
host
}
'
make_folders_remote
(
test_path
,
output_path
,
ssh_target
,
host
)
remote_output
=
make_folders_remote
(
test_path
,
output_path
,
ssh_target
,
host
)
arguments
[
-
1
]
=
remote_output
command
=
[
"
ssh
"
,
ssh_target
,
program_path
]
+
arguments
result
=
subprocess
.
run
(
command
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
errors
=
result
.
stderr
return
output
,
errors
,
result
.
returncode
return
output
,
errors
,
result
.
returncode
else
:
command
=
[
program_path
]
+
arguments
result
=
subprocess
.
run
(
command
,
capture_output
=
True
,
text
=
True
)
...
...
@@ -132,6 +135,7 @@ def make_folders_remote(test_path, output_path, ssh_target, host):
output_command
=
f
'
ssh
{
ssh_target
}
"
mkdir -p
{
host_output
}
"'
subprocess
.
run
(
test_command
,
shell
=
True
,
check
=
True
)
subprocess
.
run
(
output_command
,
shell
=
True
,
check
=
True
)
return
host_output
def
pull_data
(
remote_path
,
lokal_path
):
...
...
@@ -160,4 +164,6 @@ event_list = create_event_list()
# Run detectorSimulation
run_sim
(
event_list
,
data_path
,
simulation_path
,
stat_path
)
# Pull data for visualizer
pull_data
(
data_path
,
main_folder
)
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