Skip to content

Commit

Permalink
Merge pull request #7407 from fstagni/90_JobDB_simplifications
Browse files Browse the repository at this point in the history
[9.0] JobDB simplifications
  • Loading branch information
chrisburr authored Jan 24, 2024
2 parents 3b4fde8 + 4f9ee7a commit e551d3d
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/DIRAC/Interfaces/API/Dirac.py
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,7 @@ def getJobAttributes(self, jobID, printOutput=False):
Example Usage:
>>> print(dirac.getJobAttributes(79241))
{'AccountedFlag': 'False','ApplicationNumStatus': '0',
{'AccountedFlag': 'False',
'ApplicationStatus': 'Job Finished Successfully',
'CPUTime': '0.0'}
Expand Down
19 changes: 2 additions & 17 deletions src/DIRAC/Interfaces/scripts/dirac_wms_job_attributes.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,30 @@
#!/usr/bin/env python
########################################################################
# File : dirac-wms-job-attributes
# Author : Stuart Paterson
########################################################################
"""
Retrieve attributes associated with the given DIRAC job
Example:
$ dirac-wms-job-attributes 1
{'AccountedFlag': 'False',
'ApplicationNumStatus': '0',
'ApplicationStatus': 'Unknown',
'CPUTime': '0.0',
'DeletedFlag': 'False',
'EndExecTime': '2011-02-14 11:28:01',
'FailedFlag': 'False',
'HeartBeatTime': '2011-02-14 11:28:01',
'ISandboxReadyFlag': 'False',
'JobGroup': 'NoGroup',
'JobID': '1',
'JobName': 'DIRAC_vhamar_602138',
'JobSplitType': 'Single',
'JobType': 'normal',
'KilledFlag': 'False',
'LastUpdateTime': '2011-02-14 11:28:11',
'MasterJobID': '0',
'MinorStatus': 'Execution Complete',
'OSandboxReadyFlag': 'False',
'Owner': 'vhamar',
'OwnerGroup': 'eela_user',
'VO': 'dteam',
'RescheduleCounter': '0',
'RescheduleTime': 'None',
'RetrievedFlag': 'False',
'RunNumber': '0',
'Site': 'EELA.UTFSM.cl',
'StartExecTime': '2011-02-14 11:27:48',
'Status': 'Done',
'SubmissionTime': '2011-02-14 10:12:40',
'SystemPriority': '0',
'UserPriority': '1',
'VerifiedFlag': 'True'}
'UserPriority': '1'}
"""
from DIRAC import exit as dExit
from DIRAC import gLogger
Expand Down
5 changes: 1 addition & 4 deletions src/DIRAC/WorkloadManagementSystem/Agent/OptimizerModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@ def sendAccountingRecord(self, job, msg, classAdJob):
userGroup = classAdJob.getAttributeString("OwnerGroup")
jobGroup = classAdJob.getAttributeString("JobGroup")
jobType = classAdJob.getAttributeString("JobType")
jobClass = "unknown"
if classAdJob.lookupAttribute("JobSplitType"):
jobClass = classAdJob.getAttributeString("JobSplitType")
inputData = []
processingType = "unknown"
if classAdJob.lookupAttribute("ProcessingType"):
Expand All @@ -297,7 +294,7 @@ def sendAccountingRecord(self, job, msg, classAdJob):
"UserGroup": userGroup,
"JobGroup": jobGroup,
"JobType": jobType,
"JobClass": jobClass,
"JobClass": "unknown",
"ProcessingType": processingType,
"FinalMajorStatus": self.failedStatus,
"FinalMinorStatus": msg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def _sendAccounting(self, jobID):
"UserGroup": jobDict["OwnerGroup"],
"JobGroup": jobDict["JobGroup"],
"JobType": jobDict["JobType"],
"JobClass": jobDict["JobSplitType"],
"JobClass": "unknown",
"ProcessingType": processingType,
"FinalMajorStatus": JobStatus.FAILED,
"FinalMinorStatus": JobMinorStatus.STALLED_PILOT_NOT_RUNNING,
Expand Down
4 changes: 1 addition & 3 deletions src/DIRAC/WorkloadManagementSystem/DB/JobDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,6 @@ def rescheduleJob(self, jobID):

jobAttrs["ApplicationStatus"] = "Unknown"

jobAttrs["ApplicationNumStatus"] = 0

jobAttrs["LastUpdateTime"] = str(datetime.datetime.utcnow())

jobAttrs["RescheduleTime"] = str(datetime.datetime.utcnow())
Expand Down Expand Up @@ -1830,7 +1828,7 @@ def setJobCommandStatus(self, jobID, command, status):
def getSummarySnapshot(self, requestedFields=False):
"""Get the summary snapshot for a given combination"""
if not requestedFields:
requestedFields = ["Status", "MinorStatus", "Site", "Owner", "OwnerGroup", "JobGroup", "JobSplitType"]
requestedFields = ["Status", "MinorStatus", "Site", "Owner", "OwnerGroup", "JobGroup"]
valueFields = ["COUNT(JobID)", "SUM(RescheduleCounter)"]
defString = ", ".join(requestedFields)
valueString = ", ".join(valueFields)
Expand Down
11 changes: 0 additions & 11 deletions src/DIRAC/WorkloadManagementSystem/DB/JobDB.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ CREATE TABLE `Jobs` (
`JobID` INT(11) UNSIGNED NOT NULL DEFAULT 0,
`JobType` VARCHAR(32) NOT NULL DEFAULT 'user',
`JobGroup` VARCHAR(32) NOT NULL DEFAULT '00000000',
`JobSplitType` ENUM('Single','Master','Subjob','DAGNode') NOT NULL DEFAULT 'Single',
`MasterJobID` INT(11) UNSIGNED NOT NULL DEFAULT 0,
`Site` VARCHAR(100) NOT NULL DEFAULT 'ANY',
`JobName` VARCHAR(128) NOT NULL DEFAULT 'Unknown',
`Owner` VARCHAR(64) NOT NULL DEFAULT 'Unknown',
Expand All @@ -52,23 +50,14 @@ CREATE TABLE `Jobs` (
`Status` VARCHAR(32) NOT NULL DEFAULT 'Received',
`MinorStatus` VARCHAR(128) NOT NULL DEFAULT 'Unknown',
`ApplicationStatus` VARCHAR(255) DEFAULT 'Unknown',
`ApplicationNumStatus` INT(11) NOT NULL DEFAULT 0,
`UserPriority` INT(11) NOT NULL DEFAULT 0,
`SystemPriority` INT(11) NOT NULL DEFAULT 0,
`RescheduleCounter` INT(11) NOT NULL DEFAULT 0,
`VerifiedFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`DeletedFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`KilledFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`FailedFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`ISandboxReadyFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`OSandboxReadyFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`RetrievedFlag` ENUM('True','False') NOT NULL DEFAULT 'False',
`AccountedFlag` ENUM('True','False','Failed') NOT NULL DEFAULT 'False',
PRIMARY KEY (`JobID`),
FOREIGN KEY (`JobID`) REFERENCES `JobJDLs`(`JobID`),
KEY `JobType` (`JobType`),
KEY `JobGroup` (`JobGroup`),
KEY `JobSplitType` (`JobSplitType`),
KEY `Site` (`Site`),
KEY `Owner` (`Owner`),
KEY `OwnerGroup` (`OwnerGroup`),
Expand Down
4 changes: 1 addition & 3 deletions src/DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def __init__(self, jobID=None, jobReport=None):
self.jobType = "unknown"
self.processingType = "unknown"
self.userGroup = "unknown"
self.jobClass = "unknown"
self.inputDataFiles = 0
self.outputDataFiles = 0
self.inputDataSize = 0
Expand Down Expand Up @@ -201,7 +200,6 @@ def initialize(self, arguments):
self.outputDataFiles = len(dataParam)
self.processingType = self.jobArgs.get("ProcessingType", self.processingType)
self.userGroup = self.jobArgs.get("OwnerGroup", self.userGroup)
self.jobClass = self.jobArgs.get("JobSplitType", self.jobClass)

if not self.cpuNormalizationFactor:
self.cpuNormalizationFactor = float(self.ceArgs.get("CPUNormalizationFactor", self.cpuNormalizationFactor))
Expand Down Expand Up @@ -1259,7 +1257,7 @@ def sendJobAccounting(self, status="", minorStatus=""):
"UserGroup": self.userGroup,
"JobGroup": self.jobGroup,
"JobType": self.jobType,
"JobClass": self.jobClass,
"JobClass": "unknown",
"ProcessingType": self.processingType,
"Site": self.siteName,
"FinalMajorStatus": self.wmsMajorStatus,
Expand Down

0 comments on commit e551d3d

Please sign in to comment.