-
Notifications
You must be signed in to change notification settings - Fork 190
[v6r22] Pilot Submission statistics is counted by SiteDirector based on Accounting System #4205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
atsareg
merged 9 commits into
DIRACGrid:rel-v6r22
from
yujikato:rel-v6r22-PilotSubmissionAccounting
Aug 21, 2019
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1855efa
Pilot Submission statistics is counted by SiteDirector based on Accou…
yujikato 227ca21
Fixed to import BelleDIRAC code and the way to take agentName
yujikato f0a58f1
Modified RCSID
yujikato 8d28db4
Modified RCSID, added docstrings
yujikato e5b8737
Modified docstring, use gDataStoreClient.delayedCommit method instead…
yujikato 7704120
fixed format
yujikato ea26b8f
Fixed attribute error in pytest with missing _AgentModule__moduleProp…
yujikato 7ee9381
Add flag to disable pilot submission report
yujikato b048780
Added pilot submission counting flag in the ConfigTemplate.cfg. Fixed…
yujikato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,32 @@ | ||
| ''' Accounting Type for Pilot Submission | ||
| ''' | ||
|
|
||
| from DIRAC.AccountingSystem.Client.Types.BaseAccountingType import BaseAccountingType | ||
|
|
||
| __RCSID__ = "$Id$" | ||
|
|
||
|
|
||
| class PilotSubmission(BaseAccountingType): | ||
| ''' Accounting Type class for Pilot Submission | ||
| ''' | ||
|
|
||
| def __init__(self): | ||
| BaseAccountingType.__init__(self) | ||
|
|
||
| self.definitionKeyFields = [('HostName', 'VARCHAR(100)'), | ||
| ('SiteDirector', 'VARCHAR(100)'), | ||
| ('Site', 'VARCHAR(100)'), | ||
| ('CE', 'VARCHAR(100)'), | ||
| ('Queue', 'VARCHAR(100)'), | ||
| ('Status', 'VARCHAR(100)')] | ||
| self.definitionAccountingFields = [('NumTotal', "INT UNSIGNED"), | ||
| ('NumSucceeded', 'INT UNSIGNED')] | ||
|
|
||
| self.bucketsLength = [(86400 * 2, 900), # <2d = 15m | ||
| (86400 * 10, 9000), # <10d = 2.5h | ||
| (86400 * 35, 18000), # <35d = 5h | ||
| (86400 * 30 * 6, 86400), # >5d <6m = 1d | ||
| (86400 * 600, 604800)] # >6m = 1w | ||
|
|
||
| self.dataTimespan = 86400 * 30 * 14 # Only keep the last 14 months of data | ||
| self.checkType() |
123 changes: 123 additions & 0 deletions
123
AccountingSystem/private/Plotters/PilotSubmissionPlotter.py
This file contains hidden or 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,123 @@ | ||
|
|
||
| from DIRAC import S_OK, S_ERROR | ||
| from DIRAC.AccountingSystem.private.Plotters.BaseReporter import BaseReporter | ||
| from DIRAC.AccountingSystem.Client.Types.PilotSubmission import PilotSubmission | ||
|
|
||
| __RCSID__ = "$Id$" | ||
|
|
||
|
|
||
| class PilotSubmissionPlotter(BaseReporter): | ||
| ''' | ||
| Plotter for the Pilot Submission Accounting | ||
| ''' | ||
|
|
||
| _typeName = "PilotSubmission" | ||
| _typeKeyFields = [dF[0] for dF in PilotSubmission().definitionKeyFields] | ||
|
|
||
| def _reportSubmission(self, reportRequest): | ||
|
fstagni marked this conversation as resolved.
|
||
| ''' | ||
| Get data for Submission plot | ||
|
|
||
| :param dict reportRequest: Condition to select data | ||
| ''' | ||
|
|
||
| selectFields = (self._getSelectStringForGrouping(reportRequest['groupingFields']) + ", %s, %s, SUM(%s)", | ||
| reportRequest['groupingFields'][1] + ['startTime', 'bucketLength', 'NumTotal']) | ||
| retVal = self._getTimedData(reportRequest['startTime'], | ||
| reportRequest['endTime'], | ||
| selectFields, | ||
| reportRequest['condDict'], | ||
| reportRequest['groupingFields'], | ||
| {}) | ||
| if not retVal['OK']: | ||
| return retVal | ||
| dataDict, granularity = retVal['Value'] | ||
| self.stripDataField(dataDict, 0) | ||
| dataDict, _ = self._divideByFactor(dataDict, granularity) | ||
| dataDict = self._fillWithZero(granularity, reportRequest['startTime'], reportRequest['endTime'], dataDict) | ||
| baseDataDict, graphDataDict, _, unit = self._findSuitableRateUnit(dataDict, | ||
| self._getAccumulationMaxValue(dataDict), | ||
| "jobs") | ||
| return S_OK({'data': baseDataDict, 'graphDataDict': graphDataDict, | ||
| 'granularity': granularity, 'unit': unit}) | ||
|
|
||
| def _plotSubmission(self, reportRequest, plotInfo, filename): | ||
|
fstagni marked this conversation as resolved.
|
||
| ''' | ||
| Make 1 dimensional pilotSubmission plot | ||
|
|
||
| :param dict reportRequest: Condition to select data | ||
| :param dict plotInfo: Data for plot | ||
| :param str filename: File name | ||
| ''' | ||
|
|
||
| metadata = {'title': 'Number of Submission by %s' % reportRequest['grouping'], | ||
| 'starttime': reportRequest['startTime'], | ||
| 'endtime': reportRequest['endTime'], | ||
| 'span': plotInfo['granularity'], | ||
| 'ylabel': plotInfo['unit']} | ||
| return self._generateTimedStackedBarPlot(filename, plotInfo['graphDataDict'], metadata) | ||
|
|
||
| _reportSubmissionEfficiencyName = "Submission efficiency" | ||
|
|
||
| def _reportSubmissionEfficiency(self, reportRequest): | ||
| ''' | ||
| Get data for Submission Efficiency plot | ||
|
|
||
| :param dict reportRequest: Condition to select data | ||
| ''' | ||
|
|
||
| selectFields = (self._getSelectStringForGrouping(reportRequest['groupingFields']) + ", %s, %s, SUM(%s), SUM(%s)", | ||
|
fstagni marked this conversation as resolved.
|
||
| reportRequest['groupingFields'][1] + ['startTime', 'bucketLength', | ||
| 'NumTotal', 'NumSucceeded']) | ||
|
|
||
| retVal = self._getTimedData(reportRequest['startTime'], | ||
| reportRequest['endTime'], | ||
| selectFields, | ||
| reportRequest['condDict'], | ||
| reportRequest['groupingFields'], | ||
| {'checkNone': True, | ||
| 'convertToGranularity': 'sum', | ||
| 'calculateProportionalGauges': False, | ||
| 'consolidationFunction': self._efficiencyConsolidation}) | ||
| if not retVal['OK']: | ||
| return retVal | ||
| dataDict, granularity = retVal['Value'] | ||
| self.stripDataField(dataDict, 0) | ||
| if len(dataDict) > 1: | ||
| # Get the total for the plot | ||
| selectFields = ("'Total', %s, %s, SUM(%s),SUM(%s)", | ||
| ['startTime', 'bucketLength', | ||
| 'NumSucceeded', 'NumTotal']) | ||
|
|
||
| retVal = self._getTimedData(reportRequest['startTime'], | ||
| reportRequest['endTime'], | ||
| selectFields, | ||
| reportRequest['condDict'], | ||
| reportRequest['groupingFields'], | ||
| {'scheckNone': True, | ||
| 'convertToGranularity': 'sum', | ||
| 'calculateProportionalGauges': False, | ||
| 'consolidationFunction': self._efficiencyConsolidation}) | ||
| if not retVal['OK']: | ||
| return retVal | ||
| totalDict = retVal['Value'][0] | ||
| self.stripDataField(totalDict, 0) | ||
| for key in totalDict: | ||
| dataDict[key] = totalDict[key] | ||
| return S_OK({'data': dataDict, 'granularity': granularity}) | ||
|
|
||
| def _plotSubmissionEfficiency(self, reportRequest, plotInfo, filename): | ||
|
fstagni marked this conversation as resolved.
|
||
| ''' | ||
| Make 2 dimensional pilotSubmission efficiency plot | ||
|
|
||
| :param dict reportRequest: Condition to select data | ||
| :param dict plotInfo: Data for plot. | ||
| :param str filename: File name | ||
| ''' | ||
|
|
||
| metadata = {'title': 'Pilot Submission efficiency by %s' % reportRequest['grouping'], | ||
| 'starttime': reportRequest['startTime'], | ||
| 'endtime': reportRequest['endTime'], | ||
| 'span': plotInfo['granularity']} | ||
|
|
||
| return self._generateQualityPlot(filename, plotInfo['data'], metadata) | ||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.