Commit cd2a2a94 authored by Brian R. Toonen's avatar Brian R. Toonen

only add user and jobid to node state change accounting records when those fields are set

parent 5e02bd63
......@@ -1326,4 +1326,3 @@ class ClusterBaseSystem (Component):
stats['nodect'] = len(loc_list)
stats['nproc'] = stats['nodect']
return stats
......@@ -606,8 +606,12 @@ def node_up(node, reason, job_id=None, user=None, resource=RESOURCE_NAME):
A string accounting log message
'''
return entry("NU", node, {'reason': reason, 'job_id': job_id if job_id else '', 'user': user if user else '',
'resource': resource})
message = {'reason': reason, 'resource': resource}
if job_id is not None:
message['jobid'] = job_id
if user is not None:
message['user'] = user
return entry("NU", node, message)
def node_down(node, reason, job_id=None, user=None, resource=RESOURCE_NAME):
......@@ -625,8 +629,12 @@ def node_down(node, reason, job_id=None, user=None, resource=RESOURCE_NAME):
A string accounting log message
'''
return entry("ND", node, {'reason': reason, 'job_id': job_id if job_id else '', 'user': user if user else '',
'resource': resource})
message = {'reason': reason, 'resource': resource}
if job_id is not None:
message['jobid'] = job_id
if user is not None:
message['user'] = user
return entry("ND", node, message)
class DatetimeFileHandler (BaseRotatingHandler):
......@@ -752,5 +760,3 @@ def serialize_td (timedelta_):
+ (timedelta_.microseconds / 1000000))
except AttributeError, ex:
raise ValueError(ex)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment