Fix sidecar check for terminated containers
@@ -4,9 +4,10 @@ from polyaxon_schemas.pod import PodLifeCycle
def is_container_terminated(event, container_id):
- statuses_by_name = ocular.processor.get_container_statuses_by_name(
- event.status.to_dict().get('container_statuses', []))
+ container_statuses = event.status.to_dict().get('container_statuses') or []
+ statuses_by_name = ocular.processor.get_container_statuses_by_name(container_statuses)
statuses = ocular.processor.get_container_status(statuses_by_name, (container_id,))
+ statuses = statuses or {}
return statuses.get('state', {}).get('terminated')
