Skip to content

Commit

Permalink
fix: more accurate deployment status
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnacioHeredia committed Nov 20, 2024
1 parent f2938c4 commit 5626029
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ai4papi/nomad/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ def get_deployment(
info['datacenter'] = Nomad.node.get_node(a['NodeID'])['Datacenter']

# Replace Nomad status with a more user-friendly status
if a['ClientStatus'] == 'pending':
info['status'] = 'starting'
elif a['ClientStatus'] == 'unknown':
info['status'] = 'down'
else:
# This status can be for example: "complete", "failed"
info['status'] = a['ClientStatus']
# Final list includes: starting, down, running, complete, failed, ...
status = a['TaskStates']['main']['State'] # more relevant than a['ClientStatus']
status_map = { # nomad: papi
'pending': 'starting',
'unknown': 'down',
}
info['status'] = status_map.get(status, status) # if not mapped, then return original status

# Add error messages if needed
if info['status'] == 'failed':
Expand Down

0 comments on commit 5626029

Please sign in to comment.