Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
9604d76d
Commit
9604d76d
authored
Jan 16, 2025
by
Jonas Kaufmann
Browse files
symphony/runner/__main__.py: run isort and black formatters
parent
3423cf0f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
symphony/runner/simbricks/runner/__main__.py
symphony/runner/simbricks/runner/__main__.py
+25
-11
No files found.
symphony/runner/simbricks/runner/__main__.py
View file @
9604d76d
...
@@ -20,20 +20,21 @@
...
@@ -20,20 +20,21 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
sys
import
asyncio
import
asyncio
import
json
import
json
import
pathlib
import
logging
import
logging
from
simbricks.runtime
import
simulation_executor
import
pathlib
import
sys
from
simbricks
import
client
from
simbricks.orchestration.instantiation
import
base
as
inst_base
from
simbricks.orchestration.instantiation
import
base
as
inst_base
from
simbricks.orchestration.system
import
base
as
sys_base
from
simbricks.orchestration.simulation
import
base
as
sim_base
from
simbricks.orchestration.simulation
import
base
as
sim_base
from
simbricks.runtime
import
command_executor
from
simbricks.orchestration.system
import
base
as
sys_base
from
simbricks
import
client
from
simbricks.runtime
import
command_executor
,
simulation_executor
from
.settings
import
runner_settings
as
runset
from
simbricks.utils
import
artifatcs
as
art
from
simbricks.utils
import
artifatcs
as
art
from
.settings
import
runner_settings
as
runset
class
ConsoleLineListener
(
command_executor
.
OutputListener
):
class
ConsoleLineListener
(
command_executor
.
OutputListener
):
...
@@ -60,7 +61,12 @@ class ConsoleLineListener(command_executor.OutputListener):
...
@@ -60,7 +61,12 @@ class ConsoleLineListener(command_executor.OutputListener):
class
Run
:
class
Run
:
def
__init__
(
self
,
run_id
:
int
,
inst
:
inst_base
.
Instantiation
,
runner
:
simulation_executor
.
SimulationSimpleRunner
):
def
__init__
(
self
,
run_id
:
int
,
inst
:
inst_base
.
Instantiation
,
runner
:
simulation_executor
.
SimulationSimpleRunner
,
):
self
.
run_id
:
int
=
run_id
self
.
run_id
:
int
=
run_id
self
.
inst
:
inst_base
.
Instantiation
=
inst
self
.
inst
:
inst_base
.
Instantiation
=
inst
self
.
cancelled
:
bool
=
False
self
.
cancelled
:
bool
=
False
...
@@ -181,7 +187,11 @@ class Runner:
...
@@ -181,7 +187,11 @@ class Runner:
try
:
try
:
while
True
:
while
True
:
# fetch all events not handeled yet
# fetch all events not handeled yet
events
=
list
(
await
self
.
_rc
.
get_events
(
run_id
=
None
,
action
=
None
,
limit
=
None
,
event_status
=
"pending"
))
events
=
list
(
await
self
.
_rc
.
get_events
(
run_id
=
None
,
action
=
None
,
limit
=
None
,
event_status
=
"pending"
)
)
for
run_id
in
list
(
self
.
_run_map
.
keys
()):
for
run_id
in
list
(
self
.
_run_map
.
keys
()):
run
=
self
.
_run_map
[
run_id
]
run
=
self
.
_run_map
[
run_id
]
# check if run finished and cleanup map
# check if run finished and cleanup map
...
@@ -225,7 +235,9 @@ class Runner:
...
@@ -225,7 +235,9 @@ class Runner:
LOGGER
.
debug
(
f
"send heartbeat"
)
LOGGER
.
debug
(
f
"send heartbeat"
)
case
"start_run"
:
case
"start_run"
:
if
not
run_id
or
run_id
in
self
.
_run_map
:
if
not
run_id
or
run_id
in
self
.
_run_map
:
LOGGER
.
debug
(
f
"cannot start run, no run id or run with given id is being executed"
)
LOGGER
.
debug
(
f
"cannot start run, no run id or run with given id is being executed"
)
event_status
=
"cancelled"
event_status
=
"cancelled"
else
:
else
:
run
=
await
self
.
_prepare_run
(
run_id
=
run_id
)
run
=
await
self
.
_prepare_run
(
run_id
=
run_id
)
...
@@ -291,7 +303,9 @@ async def amain():
...
@@ -291,7 +303,9 @@ async def amain():
def
setup_logger
()
->
logging
.
Logger
:
def
setup_logger
()
->
logging
.
Logger
:
level
=
runset
().
log_level
level
=
runset
().
log_level
logging
.
basicConfig
(
level
=
level
,
format
=
"%(asctime)s - %(levelname)s - %(message)s"
,
datefmt
=
"%Y-%m-%d %H:%M:%S"
)
logging
.
basicConfig
(
level
=
level
,
format
=
"%(asctime)s - %(levelname)s - %(message)s"
,
datefmt
=
"%Y-%m-%d %H:%M:%S"
)
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
return
logger
return
logger
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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