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
0ba7451c
Commit
0ba7451c
authored
1 year ago
by
Michael Reuscher
Browse files
Options
Downloads
Patches
Plain Diff
new way to pull data from hosts
parent
5a252097
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/main.py
+14
-7
14 additions, 7 deletions
simrunner/main.py
with
14 additions
and
7 deletions
simrunner/main.py
+
14
−
7
View file @
0ba7451c
...
...
@@ -15,7 +15,7 @@ stop_requested = False
# Function to print terminal output and handle errors
def
terminal_output
(
output
,
errors
,
return_code
):
def
terminal_output
(
output
,
errors
,
return_code
,
msg
):
if
return_code
>
0
:
logger
.
error
(
f
'
return code:
{
return_code
}
'
)
if
errors
:
...
...
@@ -23,20 +23,25 @@ def terminal_output(output, errors, return_code):
if
output
:
logger
.
info
(
output
)
else
:
logger
.
info
(
output
)
if
output
:
logger
.
info
(
output
)
logger
.
info
(
msg
)
# Function to pull data from remote machines to the local machine
def
pull_data
(
source_path
,
desti_path
):
desti
=
os
.
path
.
join
(
desti_path
,
'
output
'
)
os
.
makedirs
(
desti
,
mode
=
0o777
,
exist_ok
=
True
)
if
args
.
hosts
:
for
host
in
args
.
hosts
:
ssh_target
=
f
'
{
args
.
user
}
@
{
host
}
'
scp_cmd
=
f
'
scp -r
{
ssh_target
}
:
{
source_path
}
{
desti
_path
}
'
scp_cmd
=
f
'
scp -r
{
ssh_target
}
:
{
source_path
}
/*
{
host
}
*
{
desti
}
'
subprocess
.
run
(
scp_cmd
,
shell
=
True
,
check
=
True
)
def
rm_data
(
t_data_path
):
if
args
.
hosts
:
logger
.
info
(
'
remove test_data folder
'
)
host
=
args
.
hosts
[
0
]
ssh_target
=
f
'
{
args
.
user
}
@
{
host
}
'
rm_cmd
=
f
'
ssh
{
ssh_target
}
rm -r
{
t_data_path
}
'
...
...
@@ -53,8 +58,9 @@ def handle_sigint(signum, frame):
re
=
subprocess
.
run
(
kill_cmd
,
shell
=
True
)
ou
=
re
.
stdout
er
=
re
.
stderr
logger
.
info
(
f
'
{
ou
}
{
er
}
'
)
logger
.
info
(
f
'
{
kill_target
}
killed
'
)
rc
=
re
.
returncode
terminal_msg
=
f
'
{
kill_target
}
killed
'
terminal_output
(
ou
,
er
,
rc
,
terminal_msg
)
# Function to run the detector simulation with the given event arguments
...
...
@@ -83,14 +89,15 @@ def run_sim(e_dict, d_path, sim_path, main_path):
for
folder_name
,
host
,
future
in
futures
:
output
,
errors
,
result
=
future
.
result
()
terminal_output
(
output
,
errors
,
result
)
terminal_msg
=
f
'
{
folder_name
}
_
{
host
if
host
else
""
}
done!
'
if
not
stop_requested
:
terminal_output
(
output
,
errors
,
result
,
terminal_msg
)
if
output
:
if
host
:
stat_file_name
=
f
'
statistics_
{
folder_name
}
_
{
host
}
'
else
:
stat_file_name
=
f
'
statistics_
{
folder_name
}
_lokal
'
op
.
write_statistics
(
main_path
,
stat_file_name
,
output
)
logger
.
info
(
f
'
{
folder_name
}
_
{
host
if
host
else
""
}
done!
'
)
# --- MAIN ---
...
...
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