@@ -188,9 +188,9 @@ def submit(self, cmd_string: str, tasks_per_node: int, job_name: str = "parsl.ku
188
188
volumes = self .persistent_volumes ,
189
189
service_account_name = self .service_account_name ,
190
190
annotations = self .annotations )
191
- self .resources [pod_name ] = {'status' : JobStatus (JobState .RUNNING )}
191
+ self .resources [job_id ] = {'status' : JobStatus (JobState .RUNNING ), 'pod_name' : pod_name }
192
192
193
- return pod_name
193
+ return job_id
194
194
195
195
def status (self , job_ids ):
196
196
""" Get the status of a list of jobs identified by the job identifiers
@@ -206,6 +206,9 @@ def status(self, job_ids):
206
206
self ._status ()
207
207
return [self .resources [jid ]['status' ] for jid in job_ids ]
208
208
209
+ def _get_pod_name (self , job_id : str ) -> str :
210
+ return self .resources [job_id ]['pod_name' ]
211
+
209
212
def cancel (self , job_ids ):
210
213
""" Cancels the jobs specified by a list of job ids
211
214
Args:
@@ -215,7 +218,8 @@ def cancel(self, job_ids):
215
218
"""
216
219
for job in job_ids :
217
220
logger .debug ("Terminating job/pod: {0}" .format (job ))
218
- self ._delete_pod (job )
221
+ pod_name = self ._get_pod_name (job )
222
+ self ._delete_pod (pod_name )
219
223
220
224
self .resources [job ]['status' ] = JobStatus (JobState .CANCELLED )
221
225
rets = [True for i in job_ids ]
@@ -236,7 +240,8 @@ def _status(self):
236
240
for jid in to_poll_job_ids :
237
241
phase = None
238
242
try :
239
- pod = self .kube_client .read_namespaced_pod (name = jid , namespace = self .namespace )
243
+ pod_name = self ._get_pod_name (jid )
244
+ pod = self .kube_client .read_namespaced_pod (name = pod_name , namespace = self .namespace )
240
245
except Exception :
241
246
logger .exception ("Failed to poll pod {} status, most likely because pod was terminated" .format (jid ))
242
247
if self .resources [jid ]['status' ] is JobStatus (JobState .RUNNING ):
0 commit comments