-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjob_accounting_entry.py
54 lines (39 loc) · 1.32 KB
/
job_accounting_entry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import calendar
import time
class JobAccountingEntry:
@staticmethod
def dict_get_int(dictionary, field):
value = dictionary.get(field)
if value is not None and value != '':
return int(value)
else:
return None
@staticmethod
def dict_get_timestamp(dictionary, field):
value = dictionary.get(field)
if value is not None and value != '' and value != "Unknown" and value != "None":
return calendar.timegm(time.strptime(value,"%Y-%m-%dT%H:%M:%S"))
else:
return None
def parse_line_dict(self, line_dict):
pass
def __init__(self, job_sched_line_dict, dialect):
# Save the whole dictionary, just in case.
self.raw_fields = job_sched_line_dict
self.dialect = dialect
# Fields to be read from the entry
self.failed_code = None
self.submission_time = None
self.start_time = None
self.end_time = None
self.owner = None
self.job_name = None
self.account = None
self.project = None
self.node_list = None
self.cpus = None
self.wallclock = None
self.job_id = None
self.mem = None
# Extract the above fields from the line dictionary.
self.parse_line_dict(job_sched_line_dict)