-
Notifications
You must be signed in to change notification settings - Fork 1
/
slurm_job_accounting_entry.py
28 lines (22 loc) · 1.34 KB
/
slurm_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
import job_accounting_entry
class SlurmJobAccountingEntry(job_accounting_entry.JobAccountingEntry):
# The delimiter to use when exporting Slurm accounting data using 'sacct'
# (The default for sacct, '|', doesn't work, because field Constraints can contain a pipe.)
DELIMITER_PIPE = '|'
DELIMITER_BANG = '!' # Doesn't work either, occurred in job names?
DELIMITER_HASH = '#'
def parse_line_dict(self, slurm_line_dict):
# Fill in the object's fields from the data in the dict given.
self.failed_code = 0 # TODO: get proper value for this failed code
self.submission_time = self.dict_get_timestamp(slurm_line_dict, 'Submit')
self.start_time = self.dict_get_timestamp(slurm_line_dict, 'Start')
self.end_time = self.dict_get_timestamp(slurm_line_dict, 'End')
self.owner = slurm_line_dict['User']
self.job_name = slurm_line_dict['JobName']
self.account = slurm_line_dict['Account']
self.project = slurm_line_dict['WCKey'] # for future development
self.node_list = slurm_line_dict['NodeList']
self.cpus = self.dict_get_int(slurm_line_dict, 'NCPUS')
self.wallclock = self.dict_get_int(slurm_line_dict, 'ElapsedRaw')
self.job_id = self.dict_get_int(slurm_line_dict, 'JobIDRaw')
self.mem = self.dict_get_int(slurm_line_dict, 'MaxVMSize')