@@ -83,13 +83,12 @@ def do_submit(self, job):
8383 script_run_file_name = f"{ job .script_file_name } .run"
8484 self .context .write_file (fname = script_run_file_name , write_str = script_run_str )
8585 # self.context.write_file(fname=os.path.join(self.context.submission.work_base, script_file_name), write_str=script_str)
86- ret , stdin , stdout , stderr = self .context .block_call (
87- "cd {} && {} {}" .format (
88- shlex .quote (self .context .remote_root ),
89- "sbatch" ,
90- shlex .quote (script_file_name ),
91- )
86+ command = "cd {} && {} {}" .format (
87+ shlex .quote (self .context .remote_root ),
88+ "sbatch" ,
89+ shlex .quote (script_file_name ),
9290 )
91+ ret , stdin , stdout , stderr = self .context .block_call (command )
9392 if ret != 0 :
9493 err_str = stderr .read ().decode ("utf-8" )
9594 if (
@@ -98,7 +97,7 @@ def do_submit(self, job):
9897 ):
9998 # server network error, retry 3 times
10099 raise RetrySignal (
101- "Get error code %d in submitting through ssh with job: %s . message: %s"
100+ "Get error code %d in submitting with job: %s . message: %s"
102101 % (ret , job .job_hash , err_str )
103102 )
104103 elif (
@@ -110,8 +109,8 @@ def do_submit(self, job):
110109 # job number exceeds, skip the submitting
111110 return ""
112111 raise RuntimeError (
113- "status command squeue fails to execute\n error message:%s\n return code %d\n "
114- % (err_str , ret )
112+ "command %s fails to execute\n error message:%s\n return code %d\n "
113+ % (command , err_str , ret )
115114 )
116115 subret = stdout .readlines ()
117116 # --parsable
@@ -129,9 +128,8 @@ def check_status(self, job):
129128 job_id = job .job_id
130129 if job_id == "" :
131130 return JobStatus .unsubmitted
132- ret , stdin , stdout , stderr = self .context .block_call (
133- 'squeue -o "%.18i %.2t" -j ' + job_id
134- )
131+ command = 'squeue -o "%.18i %.2t" -j ' + job_id
132+ ret , stdin , stdout , stderr = self .context .block_call (command )
135133 if ret != 0 :
136134 err_str = stderr .read ().decode ("utf-8" )
137135 if "Invalid job id specified" in err_str :
@@ -147,13 +145,13 @@ def check_status(self, job):
147145 ):
148146 # retry 3 times
149147 raise RetrySignal (
150- "Get error code %d in checking status through ssh with job: %s . message: %s"
148+ "Get error code %d in checking status with job: %s . message: %s"
151149 % (ret , job .job_hash , err_str )
152150 )
153151 raise RuntimeError (
154- "status command squeue fails to execute."
152+ "status command %s fails to execute."
155153 "job_id:%s \n error message:%s\n return code %d\n "
156- % (job_id , err_str , ret )
154+ % (command , job_id , err_str , ret )
157155 )
158156 status_line = stdout .read ().decode ("utf-8" ).split ("\n " )[- 2 ]
159157 status_word = status_line .split ()[- 1 ]
@@ -319,9 +317,8 @@ def check_status(self, job):
319317 job_id = job .job_id
320318 if job_id == "" :
321319 return JobStatus .unsubmitted
322- ret , stdin , stdout , stderr = self .context .block_call (
323- 'squeue -h -o "%.18i %.2t" -j ' + job_id
324- )
320+ command = 'squeue -h -o "%.18i %.2t" -j ' + job_id
321+ ret , stdin , stdout , stderr = self .context .block_call (command )
325322 if ret != 0 :
326323 err_str = stderr .read ().decode ("utf-8" )
327324 if "Invalid job id specified" in err_str :
@@ -336,13 +333,13 @@ def check_status(self, job):
336333 ):
337334 # retry 3 times
338335 raise RetrySignal (
339- "Get error code %d in checking status through ssh with job: %s . message: %s"
336+ "Get error code %d in checking status with job: %s . message: %s"
340337 % (ret , job .job_hash , err_str )
341338 )
342339 raise RuntimeError (
343- "status command squeue fails to execute."
340+ "status command %s fails to execute."
344341 "job_id:%s \n error message:%s\n return code %d\n "
345- % (job_id , err_str , ret )
342+ % (command , job_id , err_str , ret )
346343 )
347344 status_lines = stdout .read ().decode ("utf-8" ).split ("\n " )[:- 1 ]
348345 status = []
0 commit comments