Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #130 from hjacobs/handle-empty-time-string
Browse files Browse the repository at this point in the history
#129 handle pods in strange error state
  • Loading branch information
hjacobs authored Feb 28, 2017
2 parents d4fdf1a + 5bdef77 commit 1181f36
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kube_ops_view/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ def query_kubernetes_cluster(cluster):
if obj['phase'] in ('Succeeded', 'Failed'):
last_termination_time = 0
for container in obj['containers']:
termination_time = container.get('state', {}).get('terminated', {}).get('finishedAt', '')
termination_time = parse_time(termination_time)
if termination_time > last_termination_time:
last_termination_time = termination_time
if last_termination_time < now - 3600:
termination_time = container.get('state', {}).get('terminated', {}).get('finishedAt')
if termination_time:
termination_time = parse_time(termination_time)
if termination_time > last_termination_time:
last_termination_time = termination_time
if last_termination_time and last_termination_time < now - 3600:
# the job/pod finished more than an hour ago
# => filter out
continue
Expand Down

0 comments on commit 1181f36

Please sign in to comment.