Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 20, 2024
1 parent 5034aef commit 4e82246
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
8 changes: 2 additions & 6 deletions dpdispatcher/machines/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def do_submit(self, 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)
cmd = f"cd {shlex.quote(self.context.remote_root)} && {{ nohup bash {script_file_name} 1>>{output_name} 2>>{output_name} & }} && echo $!"
ret, stdin, stdout, stderr = self.context.block_call(
cmd
)
ret, stdin, stdout, stderr = self.context.block_call(cmd)
if ret != 0:
err_str = stderr.read().decode("utf-8")
raise RuntimeError(
Expand Down Expand Up @@ -78,9 +76,7 @@ def check_status(self, job):
r"""command -v ps >/dev/null 2>&1 || { echo >&2 "I require ps but it's not installed. Aborting."; exit 1; };"""
f"if ps -p {job_id} > /dev/null && ! (ps -o command -p {job_id} | grep defunct >/dev/null) ; then echo 1; fi"
)
ret, stdin, stdout, stderr = self.context.block_call(
cmd
)
ret, stdin, stdout, stderr = self.context.block_call(cmd)
if ret != 0:
err_str = stderr.read().decode("utf-8")
raise RuntimeError(
Expand Down
14 changes: 5 additions & 9 deletions dpdispatcher/machines/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ def do_submit(self, job):
self.context.write_file(fname=script_run_file_name, write_str=script_run_str)
# self.context.write_file(fname=os.path.join(self.context.submission.work_base, script_file_name), write_str=script_str)
command = "cd {} && {} {}".format(
shlex.quote(self.context.remote_root),
"sbatch",
shlex.quote(script_file_name),
)
ret, stdin, stdout, stderr = self.context.block_call(
command
shlex.quote(self.context.remote_root),
"sbatch",
shlex.quote(script_file_name),
)
ret, stdin, stdout, stderr = self.context.block_call(command)
if ret != 0:
err_str = stderr.read().decode("utf-8")
if (
Expand Down Expand Up @@ -321,9 +319,7 @@ def check_status(self, job):
if job_id == "":
return JobStatus.unsubmitted
command = 'squeue -h -o "%.18i %.2t" -j ' + job_id
ret, stdin, stdout, stderr = self.context.block_call(

)
ret, stdin, stdout, stderr = self.context.block_call()
if ret != 0:
err_str = stderr.read().decode("utf-8")
if "Invalid job id specified" in err_str:
Expand Down

0 comments on commit 4e82246

Please sign in to comment.