12
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
See the License for the specific language governing permissions and
14
14
limitations under the License.
15
-
15
+
16
16
A parser for HTCondorCE record file.
17
- I've used a regular expression here. Maybe import csv would be better?
18
17
19
- @author: Konrad Jopek
18
+ @author: Jordi Casals modified Blahd from Konrad Jopek
20
19
'''
21
20
22
21
from apel .db .records .htcondorce import HTCondorCERecord
@@ -33,10 +32,15 @@ class HTCondorCEParser(Parser):
33
32
def parse (self , line ):
34
33
'''
35
34
Parses single line from accounting log file.
36
-
35
+
37
36
Example line of accounting log file:
38
- "timestamp=2017-02-01 00:03:49; clusterid=381620; CE_JobId=396933.0; owner=lhpilot007; VO=lhcb; userDN=/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=romanov/CN=427293/CN=Vladimir Romanovskiy; userFQAN=/lhcb/Role=pilot/Capability=NULL; [email protected] ; request_cpus=1; cputime=3466.000000; syscputime=259.000000; jobduration=4821.575215; walltime+suspensiontime=4823.000000; suspensiontime=0.000000; cputmult=1.1864; pmem=1684532; vmem=944; disk=38543; ExitCode=0; ExitSignal=undefined; LastStatus=4; JobStatus=3; startdate=1485899007; enddate=1485903829"
39
-
37
+ "timestamp=2017-02-01 00:03:49; clusterid=381620; CE_JobId=396933.0; owner=lhpilot007; VO=lhcb;
38
+ userDN=/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=romanov/CN=427293/CN=Vladimir Romanovskiy;
39
+ userFQAN=/lhcb/Role=pilot/Capability=NULL; [email protected] ; request_cpus=1;
40
+ cputime=3466.000000; syscputime=259.000000; jobduration=4821.575215; walltime+suspensiontime=4823.000000;
41
+ suspensiontime=0.000000; cputmult=1.1864; pmem=1684532; vmem=944; disk=38543; ExitCode=0;
42
+ ExitSignal=undefined; LastStatus=4; JobStatus=3; startdate=1485899007; enddate=1485903829"
43
+
40
44
Line was split, if you want to rejoin use ' ' as a joiner.
41
45
'''
42
46
data = {}
@@ -48,15 +52,14 @@ def parse(self, line):
48
52
for item in line .split ("; " ) :
49
53
key , value = item .split ('=' , 1 )
50
54
data [key ] = value
51
-
55
+
52
56
mapping = {
53
57
'TimeStamp' : lambda x : 'T' .join (x ['timestamp' ].split ()) + 'Z' ,
54
58
'GlobalUserName' : lambda x : x ['userDN' ],
55
59
'FQAN' : lambda x : x ['userFQAN' ],
56
60
'VO' : lambda x : x ['VO' ],
57
61
'VOGroup' : lambda x : x ['userFQAN' ].split ("/" )[1 ],
58
62
'VORole' : lambda x : x ['userFQAN' ].split ("/" )[2 ],
59
- # 'CE' : lambda x: self.machine_name,
60
63
'CE' : lambda x : self .machine_name + ":" + "9619" + "/" + self .machine_name + "-" + "condor" ,
61
64
'GlobalJobId' : lambda x : x ['CE_JobId' ] + "_" + self .machine_name ,
62
65
'LrmsId' : lambda x : x ['clusterid' ] + "_" + self .machine_name ,
@@ -77,5 +80,4 @@ def parse(self, line):
77
80
78
81
record = HTCondorCERecord ()
79
82
record .set_all (rc )
80
- return record
81
-
83
+ return record
0 commit comments