Skip to content

Commit 0a6996a

Browse files
committed
fix(scheduler): deis run could never reach the failed state
The way I reproduced it was running a command that does not exist on the pod but instead of getting a failure it would try for 30 seconds and then fail with a "timeout" message
1 parent 4cf1761 commit 0a6996a

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
@@ -539,9 +539,16 @@ def run(self, namespace, name, image, entrypoint, command, **kwargs):
539539
self._delete_pod(namespace, name)
540540
return 0, log
541541

542-
if pod['status']['phase'] == 'Running':
542+
elif pod['status']['phase'] == 'Running':
543543
if iteration > 28:
544544
duration += 1
545+
546+
elif pod['status']['phase'] == 'Failed':
547+
pod_state = pod['status']['containerStatuses'][0]['state']
548+
err_code = pod_state['terminated']['exitCode']
549+
self._delete_pod(namespace, name)
550+
return err_code, data
551+
545552
except KubeException:
546553
break
547554

@@ -552,12 +559,6 @@ def run(self, namespace, name, image, entrypoint, command, **kwargs):
552559
error(response, 'Pod start took more than 30 seconds', namespace)
553560
return 0, data
554561

555-
if pod['status']['phase'] == 'Failed':
556-
pod_state = pod['status']['containerStatuses'][0]['state']
557-
err_code = pod_state['terminated']['exitCode']
558-
self._delete_pod(namespace, name)
559-
return err_code, data
560-
561562
return 0, data
562563

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

0 commit comments

Comments
 (0)