forked from apel/apel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
411 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ | |
@author Konrad Jopek, Will Rogers | ||
''' | ||
__version__ = (1, 4, 1) | ||
__version__ = (1, 5, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
''' | ||
Copyright 2014 The Science and Technology Facilities Council | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
@author: Pavel Demin | ||
''' | ||
|
||
|
||
import logging | ||
|
||
from apel.db.records.event import EventRecord | ||
from apel.parsers import Parser | ||
|
||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class HTCondorParser(Parser): | ||
''' | ||
First implementation of the APEL parser for HTCondor | ||
''' | ||
def __init__(self, site, machine_name, mpi): | ||
Parser.__init__(self, site, machine_name, mpi) | ||
log.info('Site: %s; batch system: %s' % (self.site_name, self.machine_name)) | ||
|
||
def parse(self, line): | ||
''' | ||
Parses single line from accounting log file. | ||
''' | ||
# condor_history -constraint "JobStartDate > 0" -format "%s|" GlobalJobId -format "%s|" Owner -format "%d|" RemoteWallClockTime -format "%d|" RemoteUserCpu -format "%d|" RemoteSysCpu -format "%d|" JobStartDate -format "%d|" EnteredCurrentStatus -format "%d|" ResidentSetSize_RAW -format "%d|" ImageSize_RAW -format "%d|" RequestCpus | ||
# arcce.rl.ac.uk#2376.0#71589|tatls011|287|107|11|1435671643|1435671930|26636|26832|1|1 | ||
|
||
values = line.strip().split('|') | ||
|
||
mapping = {'Site' : lambda x: self.site_name, | ||
'MachineName' : lambda x: self.machine_name, | ||
'Infrastructure' : lambda x: "APEL-CREAM-HTCONDOR", | ||
'JobName' : lambda x: x[0], | ||
'LocalUserID' : lambda x: x[1], | ||
'LocalUserGroup' : lambda x: "", | ||
'WallDuration' : lambda x: int(x[2]), | ||
'CpuDuration' : lambda x: int(x[3])+int(x[4]), | ||
'StartTime' : lambda x: x[5], | ||
'StopTime' : lambda x: x[6], | ||
'MemoryReal' : lambda x: int(x[7]), | ||
'MemoryVirtual' : lambda x: int(x[8]), | ||
'Processors' : lambda x: int(x[9]), | ||
'NodeCount' : lambda x: 0 | ||
} | ||
|
||
rc = {} | ||
|
||
for key in mapping: | ||
rc[key] = mapping[key](values) | ||
|
||
record = EventRecord() | ||
record.set_all(rc) | ||
return record |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MySQL-python | ||
python-ldap | ||
iso8601 | ||
dirq | ||
# Dependencies for testing | ||
unittest2 | ||
coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /bin/sh | ||
|
||
CONDOR_LOCATION=/usr | ||
OUTPUT_LOCATION=/var/log/accounting | ||
|
||
# Find all the history files modified in the last two months | ||
# (there can be more than one, if the CE submits to several schedds) | ||
HISTORY_FILES=$(find /var/lib/condor/spool/ -name history\* -mtime -62) | ||
|
||
# Create a temporary accounting file name | ||
NOW=$(date +"%Y%m%dT%H%M%S") | ||
OUTPUT_FILE=$OUTPUT_LOCATION/accounting.$NOW | ||
|
||
# Build the filter for the history command | ||
CONSTR="(JobStartDate>0)&&(CompletionDate>`date +%s -d "01 Jan 2014"`)" | ||
|
||
# Populate the temporary file | ||
for HF in $HISTORY_FILES | ||
do | ||
$CONDOR_LOCATION/bin/condor_history -file $HF -constraint $CONSTR \ | ||
-format "%s|" GlobalJobId \ | ||
-format "%s|" Owner \ | ||
-format "%d|" RemoteWallClockTime \ | ||
-format "%d|" RemoteUserCpu \ | ||
-format "%d|" RemoteSysCpu \ | ||
-format "%d|" JobStartDate \ | ||
-format "%d|" EnteredCurrentStatus \ | ||
-format "%d|" ResidentSetSize_RAW \ | ||
-format "%d|" ImageSize_RAW \ | ||
-format "%d|" RequestCpus \ | ||
-format "\n" EMPTY >> $OUTPUT_FILE | ||
done | ||
|
||
# Invoke the parser | ||
/usr/bin/apelparser --config /etc/apel/parser.cfg | ||
|
||
# Cleanup | ||
/bin/find $OUTPUT_LOCATION -name accounting.\* -mtime +30 -exec /bin/rm {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.