Skip to content

Commit a7614dd

Browse files
jcasalsatpictofu-rocketry
authored andcommitted
fixing some errors from codacity checks for pull request
1 parent 8f86add commit a7614dd

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

apel/db/records/htcondorce.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,22 @@ class HTCondorCERecord(Record):
2020
"""
2121
Class to represent a record from BLAHP systems
2222
"""
23-
23+
2424
def __init__(self):
2525
'''
2626
Initializer for BlahdRecord
2727
'''
28-
28+
2929
Record.__init__(self)
30-
30+
3131
self._mandatory_fields = []
32-
32+
3333
self._db_fields = ["TimeStamp", "GlobalUserName", "FQAN",
3434
"VO", "VOGroup", "VORole", "CE", "GlobalJobId", "LrmsId",
3535
"Site", "ValidFrom", "ValidUntil", "Processed"]
36-
36+
3737
self._int_fields = ["Processed"]
38-
38+
3939
self._all_fields = self._db_fields
40-
41-
self._datetime_fields = ["TimeStamp", "ValidFrom", "ValidUntil"]
42-
40+
41+
self._datetime_fields = ["TimeStamp", "ValidFrom", "ValidUntil"]

apel/parsers/htcondor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def parse(self, line):
4747
'JobName' : lambda x: x['clusterid'] + "_" + self.machine_name,
4848
'LocalUserID' : lambda x: x['owner'],
4949
'LocalUserGroup': lambda x: x['VO'],
50-
'WallDuration' : lambda x: float(x['cputmult'])*(float(x['walltime+suspensiontime'])-float(x['suspensiontime'])),
50+
'WallDuration' : lambda x: float(x['cputmult'])*
51+
(float(x['walltime+suspensiontime'])-float(x['suspensiontime'])),
5152
'CpuDuration' : lambda x: float(x['cputmult'])*(float(x['cputime'])+float(x['syscputime'])),
5253
'StartTime' : lambda x: int(x['startdate']),
5354
'StopTime' : lambda x: int(x['enddate']),

apel/parsers/htcondorce.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15-
15+
1616
A parser for HTCondorCE record file.
17-
I've used a regular expression here. Maybe import csv would be better?
1817
19-
@author: Konrad Jopek
18+
@author: Jordi Casals modified Blahd from Konrad Jopek
2019
'''
2120

2221
from apel.db.records.htcondorce import HTCondorCERecord
@@ -33,10 +32,15 @@ class HTCondorCEParser(Parser):
3332
def parse(self, line):
3433
'''
3534
Parses single line from accounting log file.
36-
35+
3736
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+
4044
Line was split, if you want to rejoin use ' ' as a joiner.
4145
'''
4246
data = {}
@@ -48,15 +52,14 @@ def parse(self, line):
4852
for item in line.split("; ") :
4953
key, value = item.split('=', 1)
5054
data[key] = value
51-
55+
5256
mapping = {
5357
'TimeStamp' : lambda x: 'T'.join(x['timestamp'].split()) + 'Z',
5458
'GlobalUserName' : lambda x: x['userDN'],
5559
'FQAN' : lambda x: x['userFQAN'],
5660
'VO' : lambda x: x['VO'],
5761
'VOGroup' : lambda x: x['userFQAN'].split("/")[1],
5862
'VORole' : lambda x: x['userFQAN'].split("/")[2],
59-
# 'CE' : lambda x: self.machine_name,
6063
'CE' : lambda x: self.machine_name + ":" + "9619" + "/" + self.machine_name + "-" + "condor",
6164
'GlobalJobId' : lambda x: x['CE_JobId'] + "_" + self.machine_name,
6265
'LrmsId' : lambda x: x['clusterid'] + "_" + self.machine_name,
@@ -77,5 +80,4 @@ def parse(self, line):
7780

7881
record = HTCondorCERecord()
7982
record.set_all(rc)
80-
return record
81-
83+
return record

0 commit comments

Comments
 (0)