change wait_for_job_end to use new get_phase
@@ -157,6 +157,8 @@ class Job(object):
if update:
phase_request = "async/"+str(self.get_jobid())+"/phase"
response = self.__connHandler.execute_get(phase_request)
+
+ self.__last_phase_response_status = response.status
if response.status != 200:
raise Exception(response.reason)
@@ -576,20 +578,16 @@ class Job(object):
verbose : bool, optional, default 'False'
flag to display information about the process
"""
- phaseRequest = "async/"+str(self.__jobid)+"/phase"
currentResponse = None
responseData = None
while True:
- response = self.__connHandler.execute_get(phaseRequest)
- currentResponse = response.status
- if response.status != 200:
- raise Exception(response.reason)
- break
- responseData = str(response.read().decode('utf-8'))
- data = responseData.lower().strip()
+ responseData = self.get_phase(update=True)
+ currentResponse = self.__last_phase_response_status
+
+ lphase = responseData.lower().strip()
if verbose:
- print("Job " + self.__jobid + " status: " + data)
- if "pending" != data and "queued" != data and "executing" != data:
+ print("Job " + self.__jobid + " status: " + lphase)
+ if "pending" != lphase and "queued" != lphase and "executing" != lphase:
break
# PENDING, QUEUED, EXECUTING, COMPLETED, ERROR, ABORTED, UNKNOWN,
# HELD, SUSPENDED, ARCHIVED:
