From 034c9d7d4a673b2325e85075b9350fb783e407ba Mon Sep 17 00:00:00 2001 From: Thang Nguyen <46436648+thangckt@users.noreply.github.com> Date: Wed, 27 Mar 2024 02:17:14 +0900 Subject: [PATCH 1/2] Update pbs.py --- dpdispatcher/machines/pbs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dpdispatcher/machines/pbs.py b/dpdispatcher/machines/pbs.py index 7e49b709..ec464f65 100644 --- a/dpdispatcher/machines/pbs.py +++ b/dpdispatcher/machines/pbs.py @@ -4,6 +4,7 @@ from dpdispatcher.machine import Machine from dpdispatcher.utils.job_status import JobStatus from dpdispatcher.utils.utils import customized_script_header_template +from pathlib import Path pbs_script_header_template = """ #!/bin/bash -l @@ -219,9 +220,8 @@ def gen_script_header(self, job): if (resources["strategy"].get("customized_script_header_template_file") is not None): - sge_script_header = customized_script_header_template( - resources["strategy"]["customized_script_header_template_file"], - resources,) + filename = self.context.remote_root / Path(resources["strategy"]["customized_script_header_template_file"]) + sge_script_header = customized_script_header_template(str(filename.as_posix()), resources) else: sge_script_header = sge_script_header_template.format( **sge_script_header_dict) @@ -230,9 +230,11 @@ def gen_script_header(self, job): def do_submit(self, job): script_file_name = job.script_file_name script_str = self.gen_script(job) - script_str = script_str.replace(f"source $REMOTE_ROOT/{job.script_file_name}.run", f"source $REMOTE_ROOT/{job.script_file_name}") job_id_name = job.job_hash + "_job_id" self.context.write_file(fname=script_file_name, write_str=script_str) + script_run_str = self.gen_script_command(job) + script_run_file_name = f"{job.script_file_name}.run" + self.context.write_file(fname=script_run_file_name, write_str=script_run_str) script_file_dir = self.context.remote_root stdin, stdout, stderr = self.context.block_checkcall( "cd {} && {} {}".format(script_file_dir, "qsub", script_file_name) From 3f07742f58c974c43f9069d4606e59e1830e9bb2 Mon Sep 17 00:00:00 2001 From: Thang Nguyen <46436648+thangckt@users.noreply.github.com> Date: Wed, 27 Mar 2024 02:25:05 +0900 Subject: [PATCH 2/2] Update pbs.py --- dpdispatcher/machines/pbs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dpdispatcher/machines/pbs.py b/dpdispatcher/machines/pbs.py index ec464f65..2a78c74e 100644 --- a/dpdispatcher/machines/pbs.py +++ b/dpdispatcher/machines/pbs.py @@ -4,7 +4,6 @@ from dpdispatcher.machine import Machine from dpdispatcher.utils.job_status import JobStatus from dpdispatcher.utils.utils import customized_script_header_template -from pathlib import Path pbs_script_header_template = """ #!/bin/bash -l @@ -220,8 +219,8 @@ def gen_script_header(self, job): if (resources["strategy"].get("customized_script_header_template_file") is not None): - filename = self.context.remote_root / Path(resources["strategy"]["customized_script_header_template_file"]) - sge_script_header = customized_script_header_template(str(filename.as_posix()), resources) + filename = resources["strategy"]["customized_script_header_template_file"] + sge_script_header = customized_script_header_template(filename, resources) else: sge_script_header = sge_script_header_template.format( **sge_script_header_dict)