Skip to content

Commit 3fe88f8

Browse files
committed
Merge pull request #589 from helgi/fix_run
fix(scheduler): deis run could never reach the failed state
2 parents 6dada11 + 0a6996a commit 3fe88f8

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

rootfs/scheduler/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,16 @@ def run(self, namespace, name, image, entrypoint, command, **kwargs):
542542
self._delete_pod(namespace, name)
543543
return 0, log
544544

545-
if pod['status']['phase'] == 'Running':
545+
elif pod['status']['phase'] == 'Running':
546546
if iteration > 28:
547547
duration += 1
548+
549+
elif pod['status']['phase'] == 'Failed':
550+
pod_state = pod['status']['containerStatuses'][0]['state']
551+
err_code = pod_state['terminated']['exitCode']
552+
self._delete_pod(namespace, name)
553+
return err_code, data
554+
548555
except KubeException:
549556
break
550557

@@ -555,12 +562,6 @@ def run(self, namespace, name, image, entrypoint, command, **kwargs):
555562
error(response, 'Pod start took more than 30 seconds', namespace)
556563
return 0, data
557564

558-
if pod['status']['phase'] == 'Failed':
559-
pod_state = pod['status']['containerStatuses'][0]['state']
560-
err_code = pod_state['terminated']['exitCode']
561-
self._delete_pod(namespace, name)
562-
return err_code, data
563-
564565
return 0, data
565566

566567
def _set_environment(self, data, **kwargs):

0 commit comments

Comments
 (0)