Commit 9604d76d authored by Jonas Kaufmann's avatar Jonas Kaufmann
Browse files

symphony/runner/__main__.py: run isort and black formatters

parent 3423cf0f
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment