X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c0f33379c7fd062fc097ecef92808334e821cb6b..87e1614724027f6a9da3f3dfaa163bd8bea4ce62:/services/nodemanager/arvnodeman/computenode/__init__.py diff --git a/services/nodemanager/arvnodeman/computenode/__init__.py b/services/nodemanager/arvnodeman/computenode/__init__.py index b47866d2d4..6e46bc0f4c 100644 --- a/services/nodemanager/arvnodeman/computenode/__init__.py +++ b/services/nodemanager/arvnodeman/computenode/__init__.py @@ -31,7 +31,17 @@ def timestamp_fresh(timestamp, fresh_time): return (time.time() - timestamp) < fresh_time def arvados_node_missing(arvados_node, fresh_time): - return not timestamp_fresh(arvados_timestamp(arvados_node["last_ping_at"]), fresh_time) + """Indicate if cloud node corresponding to the arvados + node is "missing". + + If True, this means the node has not pinged the API server within the timeout + period. If False, the ping is up to date. If the node has never pinged, + returns None. + """ + if arvados_node["last_ping_at"] is None: + return None + else: + return not timestamp_fresh(arvados_timestamp(arvados_node["last_ping_at"]), fresh_time) class ShutdownTimer(object): """Keep track of a cloud node's shutdown windows.