diff --git a/igf_airflow/utils/dag50_olink_reveal_nextflow_utils.py b/igf_airflow/utils/dag50_olink_reveal_nextflow_utils.py index 9d9685e1..d1757f63 100644 --- a/igf_airflow/utils/dag50_olink_reveal_nextflow_utils.py +++ b/igf_airflow/utils/dag50_olink_reveal_nextflow_utils.py @@ -38,7 +38,7 @@ retry_delay=timedelta(minutes=5), retries=4, queue='hpc_4G', - multiple_outputs=False) + multiple_outputs=True) def prepare_olink_nextflow_script( design_dict: dict, work_dir: str, @@ -138,7 +138,7 @@ def prepare_olink_nextflow_script( WORKDIR=work_dir ) ) - return nf_script_file.as_posix() + return {"run_script": nf_script_file.as_posix()} except Exception as e: log.error(e) send_airflow_failed_logs_to_channels( @@ -153,13 +153,14 @@ def prepare_olink_nextflow_script( queue='hpc_8G4t72hr', pool='batch_job', retries=4) -def run_olink_nextflow_script(run_script: str): +def run_olink_nextflow_script(run_script: str) -> str: try: script_dir = os.path.dirname(run_script) bash_cmd = f"""set -eo pipefail; -cd {script_dir}; -chmod u+x {run_script}; -bash {run_script}""" +## Move to the script dir +cd {script_dir} ; +chmod u+x {run_script} ; +bash {run_script} ;""" return bash_cmd except Exception as e: log.error(e) diff --git a/test/igf_airflow/test_dag50_olink_reveal_nextflow_utils.py b/test/igf_airflow/test_dag50_olink_reveal_nextflow_utils.py index 113787fd..6146dfbd 100644 --- a/test/igf_airflow/test_dag50_olink_reveal_nextflow_utils.py +++ b/test/igf_airflow/test_dag50_olink_reveal_nextflow_utils.py @@ -54,10 +54,11 @@ def test_prepare_olink_nextflow_script(self, *args): with open(design_yaml_file, "w") as fp: fp.write(design_yaml) design_dict = {"analysis_design": design_yaml_file} - analysis_script = prepare_olink_nextflow_script.function( + analysis_script_conf = prepare_olink_nextflow_script.function( design_dict=design_dict, work_dir=self.temp_dir ) + analysis_script = analysis_script_conf["run_script"] assert os.path.exists(analysis_script) with open(analysis_script, "r") as fp: script_data = fp.read() ## small file @@ -84,7 +85,11 @@ def test_run_olink_nextflow_script(self): analysis_cmd = run_olink_nextflow_script.function( script_file ) - assert analysis_cmd == f"set -eo pipefail;\ncd {os.path.dirname(script_file)};\nchmod u+x {script_file};\nbash {script_file}" + assert analysis_cmd == f"""set -eo pipefail; +## Move to the script dir +cd {os.path.dirname(script_file)} ; +chmod u+x {script_file} ; +bash {script_file} ;""" if __name__=='__main__': unittest.main() \ No newline at end of file