Skip to content

Commit f30875b

Browse files
committed
try , exceptions
1 parent 6fd4a7a commit f30875b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/cluster_tasks/controller_async.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,21 @@ async def main():
2929
) # Assuming you have async support in ProxmoxAPI
3030

3131
# Create an instance of the async NodeTasks class
32-
33-
# Run through scenarios
34-
async with ext_api as api:
35-
node_tasks = NodeTasksAsync(api=api) # Pass the api instance to NodeTasksAsync
36-
for k, v in scenarios_config.get("Scenarios").items():
37-
scenario_file = v.get("file")
38-
config = v.get("config")
39-
40-
# Create scenario instance using the factory
41-
scenario = ScenarioFactory.create_scenario(scenario_file, config, "async")
42-
43-
# Run the scenario asynchronously
44-
await scenario.run(node_tasks) # Assuming `run` is now an async method
32+
try:
33+
# Run through scenarios
34+
async with ext_api as api:
35+
node_tasks = NodeTasksAsync(api=api)
36+
for v in scenarios_config.get("Scenarios").values():
37+
scenario_file = v.get("file")
38+
config = v.get("config")
39+
# Create scenario instance using the factory
40+
scenario = ScenarioFactory.create_scenario(
41+
scenario_file, config, "async"
42+
)
43+
# Run the scenario asynchronously
44+
await scenario.run(node_tasks) # Assuming `run` is now an async method
45+
except Exception as e:
46+
logger.error(f"MAIN: {e}")
4547

4648

4749
if __name__ == "__main__":

0 commit comments

Comments
 (0)