feat(replay): execute periodic diagnosis and hydraulic checks
This commit is contained in:
@@ -80,7 +80,11 @@ async def execute_child(input_path: str, output_path: str):
|
||||
row = json.loads(Path(input_path).read_text())
|
||||
try:
|
||||
async with execution_scope(row) as scope:
|
||||
result = await execute_calculation_job(scope, row)
|
||||
if row.get('tool') == 'scheduled_network_simulation':
|
||||
from app.services.periodic_tasks import execute_periodic_calculation
|
||||
result = await execute_periodic_calculation(scope, row)
|
||||
else:
|
||||
result = await execute_calculation_job(scope, row)
|
||||
payload = {'status': 'succeeded', 'result': result.model_dump(mode='json')}
|
||||
except Exception as exc:
|
||||
# Do not persist exception text: DSNs, SQL, credentials or model data can occur there.
|
||||
@@ -224,7 +228,14 @@ class CalculationWorker:
|
||||
terminal = {'status': 'failed', 'error': {'code': 'CLEANUP_FAILED'}}
|
||||
cleaned = True
|
||||
async with self.repository(row['project_id']) as repository:
|
||||
finished = await repository.finish(row, self.owner, **terminal)
|
||||
if row.get('tool') == 'scheduled_network_simulation':
|
||||
from app.services.periodic_tasks import persist_periodic_terminal
|
||||
async with repository.connection.transaction():
|
||||
finished = await repository.finish(row, self.owner, **terminal)
|
||||
if finished:
|
||||
await persist_periodic_terminal(repository.connection, row, terminal)
|
||||
else:
|
||||
finished = await repository.finish(row, self.owner, **terminal)
|
||||
if not finished:
|
||||
status = await repository.heartbeat(row, self.owner, self.settings.lease_seconds)
|
||||
if status == 'cancel_requested':
|
||||
|
||||
Reference in New Issue
Block a user