Skip to content

Commit

Permalink
write the results
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Sep 4, 2024
1 parent 8d07747 commit e9ad0f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/depiction_targeted_preproc/pipeline/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def run(workunit_id: int, work_dir: Path, ssh_user: str | None = None) -> None:
ssh_user=ssh_user,
)
zip_file_path = run_workflow(sample_dir=sample_dir)
store_outputs(client=client, zip_file_path=zip_file_path, workunit_id=workunit_id)
store_outputs(client=client, zip_file_path=zip_file_path, workunit_id=workunit_id, ssh_user=ssh_user)


if __name__ == "__main__":
Expand Down
9 changes: 6 additions & 3 deletions src/depiction_targeted_preproc/pipeline/store_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import yaml
from bfabric import Bfabric
from bfabric.entities import Workunit
from bfabric.experimental.app_interface.output_registration import register_outputs


def _get_outputs_spec(zip_file_path: Path, workunit: Workunit) -> dict[str, list[dict[str, str | int | bool]]]:
Expand All @@ -21,13 +22,15 @@ def _get_outputs_spec(zip_file_path: Path, workunit: Workunit) -> dict[str, list
}


def write_outputs_spec(zip_file_path: Path, workunit: Workunit) -> None:
def write_outputs_spec(zip_file_path: Path, workunit: Workunit) -> Path:
output_spec = _get_outputs_spec(zip_file_path=zip_file_path, workunit=workunit)
outputs_yaml = zip_file_path.parent / f"{zip_file_path.stem}_outputs_spec.yml"
with outputs_yaml.open("w") as file:
yaml.safe_dump(output_spec, file)
return outputs_yaml


def store_outputs(client: Bfabric, zip_file_path: Path, workunit_id: int):
def store_outputs(client: Bfabric, zip_file_path: Path, workunit_id: int, ssh_user: str | None):
workunit = Workunit.find(id=workunit_id, client=client)
write_outputs_spec(zip_file_path=zip_file_path, workunit=workunit)
outputs_yaml = write_outputs_spec(zip_file_path=zip_file_path, workunit=workunit)
register_outputs(outputs_yaml=outputs_yaml, client=client, ssh_user=ssh_user)

0 comments on commit e9ad0f7

Please sign in to comment.