Skip to content

Commit 2c0bc63

Browse files
committed
Update slurm_job_batch_script()
1 parent 3db8af9 commit 2c0bc63

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pyslurm/pyslurm.pyx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,8 +2511,17 @@ cdef class job:
25112511
apiError = slurm.slurm_get_errno()
25122512
raise ValueError(slurm.stringOrNone(slurm.slurm_strerror(apiError), ''), apiError)
25132513

2514-
def slurm_job_batch_script(uint32_t jobid):
2515-
return slurm.slurm_job_batch_script(slurm.stdout, jobid)
2514+
def slurm_job_batch_script(self, jobid):
2515+
"""
2516+
Retrieve the batch script for a given jobid.
2517+
"""
2518+
if isinstance(jobid, int) or isinstance(jobid, long):
2519+
jobid = str(jobid).encode("UTF-8")
2520+
else:
2521+
jobid = jobid.encode("UTF-8")
2522+
2523+
jobid_xlate = slurm.slurm_xlate_job_id(jobid)
2524+
return slurm.slurm_job_batch_script(slurm.stdout, jobid_xlate)
25162525

25172526
cdef int fill_job_desc_from_opts(self, dict job_opts, slurm.job_desc_msg_t *desc):
25182527
"""

0 commit comments

Comments
 (0)