Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CircularGreenSimCity
CircularGreenSimCity
Commits
5621631f
Commit
5621631f
authored
Jan 27, 2025
by
Eric Duminil
Browse files
Make sure chdir is set back
parent
84ff6304
Changes
1
Hide whitespace changes
Inline
Side-by-side
python_scripts/run_simstadt_from_python/run_simstadt_workflow.py
View file @
5621631f
...
...
@@ -44,7 +44,7 @@ from pathlib import Path
import
logging
import
platform
import
subprocess
import
os
import
contextlib
import
sys
from
xml.etree
import
ElementTree
as
et
...
...
@@ -147,20 +147,20 @@ def simstadt_script():
def
run_simstadt
(
simstadt_path
:
Path
,
workflow_path
:
Path
,
name
:
str
):
os
.
chdir
(
simstadt_path
)
try
:
logging
.
info
(
"
\n
# Launching %s:"
,
name
)
result
=
subprocess
.
run
([
simstadt_script
(),
str
(
workflow_path
)],
text
=
True
,
capture_output
=
True
,
check
=
True
)
logging
.
debug
(
result
.
stderr
)
logging
.
info
(
" Workflow finished succesfuly!
\n
"
)
except
subprocess
.
CalledProcessError
:
# NOTE: Current SimStadt actually never raises an error.
logging
.
warning
(
" Workflow failed!
\n
"
)
logging
.
info
(
result
.
stderr
)
with
contextlib
.
chdir
(
simstadt_path
)
:
try
:
logging
.
info
(
"
\n
# Launching %s:"
,
name
)
result
=
subprocess
.
run
([
simstadt_script
(),
str
(
workflow_path
)],
text
=
True
,
capture_output
=
True
,
check
=
True
)
logging
.
debug
(
result
.
stderr
)
logging
.
info
(
" Workflow finished succesfuly!
\n
"
)
except
subprocess
.
CalledProcessError
:
# NOTE: Current SimStadt actually never raises an error.
logging
.
warning
(
" Workflow failed!
\n
"
)
logging
.
info
(
result
.
stderr
)
def
compare_written_files
(
repo_path
:
Path
,
before
,
after
)
->
list
[
Path
]:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment