fix(sdk): Optimize wait_for_run_completion sdk function to skip an extra wait (#9407)
This commit is contained in:
parent
1996d7516d
commit
4d2a1cf173
|
@ -1370,8 +1370,8 @@ class Client:
|
||||||
if isinstance(timeout, datetime.timedelta):
|
if isinstance(timeout, datetime.timedelta):
|
||||||
timeout = timeout.total_seconds()
|
timeout = timeout.total_seconds()
|
||||||
is_valid_token = False
|
is_valid_token = False
|
||||||
while (state is None or state.lower()
|
finish_states = ['succeeded', 'failed', 'skipped', 'error']
|
||||||
not in ['succeeded', 'failed', 'skipped', 'error']):
|
while True:
|
||||||
try:
|
try:
|
||||||
get_run_response = self._run_api.get_run(run_id=run_id)
|
get_run_response = self._run_api.get_run(run_id=run_id)
|
||||||
is_valid_token = True
|
is_valid_token = True
|
||||||
|
@ -1390,8 +1390,9 @@ class Client:
|
||||||
logging.info('Waiting for the job to complete...')
|
logging.info('Waiting for the job to complete...')
|
||||||
if elapsed_time > timeout:
|
if elapsed_time > timeout:
|
||||||
raise TimeoutError('Run timeout')
|
raise TimeoutError('Run timeout')
|
||||||
|
if state is not None and state.lower() in finish_states:
|
||||||
|
return get_run_response
|
||||||
time.sleep(sleep_duration)
|
time.sleep(sleep_duration)
|
||||||
return get_run_response
|
|
||||||
|
|
||||||
def upload_pipeline(
|
def upload_pipeline(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in New Issue