Skip to content

Commit

Permalink
enable: delete hpc workflow jobs when downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
MehmedGIT committed Jan 20, 2025
1 parent 0467d4b commit 52aa423
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/broker/operandi_broker/job_worker_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def __download_results_from_hpc(self, job_dir: str, workspace_dir: str) -> None:
ocrd_workspace_dir=Path(workspace_dir), workflow_job_dir=Path(job_dir))
self.log.info(f"Transferred slurm workspace from hpc path")
# Delete the result dir from the HPC home folder
# self.hpc_executor.execute_blocking(f"bash -lc 'rm -rf {hpc_slurm_workspace_path}/{workflow_job_id}'")
job_id = Path(job_dir).name
self.hpc_executor.remove_workflow_job_dir(workflow_job_id=job_id)
self.log.info(f"Removed slurm workspace from HPC for job: {job_id}")

def __extract_updated_file_groups(self, db_workspace: DBWorkspace) -> List[str]:
try:
Expand Down
9 changes: 9 additions & 0 deletions src/utils/operandi_utils/hpc/nhr_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ def execute_blocking(self, command, timeout=None, environment=None):
return_code = stdout.channel.recv_exit_status()
return output, err, return_code

def remove_workflow_job_dir(self, workflow_job_id: str):
hpc_slurm_job_dir = f"{self.slurm_workspaces_dir}/{workflow_job_id}"
command = f"bash -lc 'rm -rf {hpc_slurm_job_dir}'"
self.logger.info(f"About to execute a force command: {command}")
output, err, return_code = self.execute_blocking(command)
self.logger.info(f"Command output: {output}")
self.logger.info(f"Command err: {err}")
self.logger.info(f"Command return code: {return_code}")

def trigger_slurm_job(
self, workflow_job_id: str, nextflow_script_path: Path, input_file_grp: str,
workspace_id: str, mets_basename: str, nf_process_forks: int, ws_pages_amount: int, use_mets_server: bool,
Expand Down

0 comments on commit 52aa423

Please sign in to comment.