Skip to content

Commit

Permalink
introduce read-only parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Sep 5, 2024
1 parent 8b17ebd commit 3726e39
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 9 additions & 4 deletions src/depiction_targeted_preproc/pipeline/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def run_one_job(
workunit_id: int,
imzml_resource_id: int,
ssh_user: str | None,
read_only: bool,
) -> None:
sample_dir = work_dir / sample_name
prepare_params(client=client, sample_dir=sample_dir, workunit_id=workunit_id)
Expand All @@ -65,13 +66,15 @@ def run_one_job(
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, ssh_user=ssh_user)
if not read_only:
store_outputs(client=client, zip_file_path=zip_file_path, workunit_id=workunit_id, ssh_user=ssh_user)


@app.default()
def run_resource_flow(workunit_id: int, work_dir: Path, ssh_user: str | None = None) -> None:
def run_resource_flow(workunit_id: int, work_dir: Path, ssh_user: str | None = None, read_only: bool = False) -> None:
client = Bfabric.from_config()
set_workunit_processing(client=client, workunit_id=workunit_id)
if not read_only:
set_workunit_processing(client=client, workunit_id=workunit_id)
dataset_id, imzml_resource_id, sample_name = _get_resource_flow_ids(client=client, workunit_id=workunit_id)
run_one_job(
client=client,
Expand All @@ -81,8 +84,10 @@ def run_resource_flow(workunit_id: int, work_dir: Path, ssh_user: str | None = N
workunit_id=workunit_id,
imzml_resource_id=imzml_resource_id,
ssh_user=ssh_user,
read_only=read_only,
)
set_workunit_available(client=client, workunit_id=workunit_id)
if not read_only:
set_workunit_available(client=client, workunit_id=workunit_id)


def set_workunit_processing(client: Bfabric, workunit_id: int) -> None:
Expand Down
9 changes: 6 additions & 3 deletions src/depiction_targeted_preproc/pipeline/run_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@


@app.default()
def run_batch(workunit_id: int, work_dir: Path, ssh_user: str | None = None) -> None:
def run_batch(workunit_id: int, work_dir: Path, ssh_user: str | None = None, read_only: bool = False) -> None:
client = Bfabric.from_config()
set_workunit_processing(client=client, workunit_id=workunit_id)
if not read_only:
set_workunit_processing(client=client, workunit_id=workunit_id)

workunit = Workunit.find(id=workunit_id, client=client)
batch_dataset = BatchDataset(dataset_id=workunit.input_dataset.id, client=client)
Expand All @@ -28,9 +29,11 @@ def run_batch(workunit_id: int, work_dir: Path, ssh_user: str | None = None) ->
workunit_id=workunit_id,
imzml_resource_id=job.imzml.id,
ssh_user=ssh_user,
read_only=read_only,
)

set_workunit_available(client=client, workunit_id=workunit_id)
if not read_only:
set_workunit_available(client=client, workunit_id=workunit_id)


if __name__ == "__main__":
Expand Down

0 comments on commit 3726e39

Please sign in to comment.