Skip to content

Commit

Permalink
set the workunit status in app_runner
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Sep 18, 2024
1 parent a4c96be commit 4ce7ed6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bfabric/experimental/app_interface/app_runner/runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

import shlex
import subprocess
from pathlib import Path
Expand Down Expand Up @@ -58,6 +59,11 @@ def run_app(
ssh_user: str | None = None,
read_only: bool = False,
) -> None:
# TODO future: the workunit definition must be loaded from bfabric exactly once! this is quite inefficient right now
workunit_definition = WorkunitDefinition.from_ref(workunit_ref, client=client)
if not read_only:
client.save("workunit", {"id": workunit_definition.registration.workunit_id, "status": "processing"})

runner = Runner(spec=app_spec, client=client, ssh_user=ssh_user)
runner.run_dispatch(workunit_ref=workunit_ref, work_dir=work_dir)
chunks_file = ChunksFile.model_validate(yaml.safe_load((work_dir / "chunks.yml").read_text()))
Expand All @@ -67,3 +73,6 @@ def run_app(
runner.run_process(chunk_dir=chunk)
if not read_only:
runner.run_register_outputs(chunk_dir=chunk, workunit_ref=workunit_ref)

if not read_only:
client.save("workunit", {"id": workunit_definition.registration.workunit_id, "status": "available"})

0 comments on commit 4ce7ed6

Please sign in to comment.