Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DIRAC/TransformationSystem/DB/TransformationDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def addTransformation(self, transName, description, longDescription, authorDN, a
InheritedFrom,Body,MaxNumberOfTasks,EventsPerTask)\
VALUES ('%s','%s','%s',\
UTC_TIMESTAMP(),UTC_TIMESTAMP(),'%s','%s','%s','%s','%s',\
'%s','New','%s',%d,\
'%s','New','%s',%f,\
%d,%s,%d,%d);" % \
(transName, description, longDescription,
authorDN, authorGroup, transType, plugin, agentType,
Expand Down
8 changes: 4 additions & 4 deletions src/DIRAC/TransformationSystem/DB/TransformationDB.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ CREATE TABLE Transformations(
FileMask VARCHAR(255),
TransformationGroup varchar(255) NOT NULL default 'General',
TransformationFamily varchar(64) default '0',
GroupSize INT NOT NULL DEFAULT 1,
GroupSize FLOAT NOT NULL DEFAULT 1,
InheritedFrom INTEGER DEFAULT 0,
Body LONGBLOB,
MaxNumberOfTasks INT NOT NULL DEFAULT 0,
EventsPerTask INT NOT NULL DEFAULT 0,
MaxNumberOfTasks INTEGER NOT NULL DEFAULT 0,
EventsPerTask INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY(TransformationID),
INDEX(TransformationName),
INDEX(TransformationFamily)
Expand Down Expand Up @@ -109,7 +109,7 @@ CREATE TABLE TransformationFiles(
TransformationID INTEGER NOT NULL,
FileID INTEGER NOT NULL,
Status VARCHAR(32) DEFAULT 'Unused',
ErrorCount INT(4) NOT NULL DEFAULT 0,
ErrorCount INTEGER(4) NOT NULL DEFAULT 0,
TaskID INTEGER,
TargetSE VARCHAR(255) DEFAULT 'Unknown',
UsedSE VARCHAR(255) DEFAULT 'Unknown',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,32 +65,50 @@ def export_getCounters(cls, table, attrList, condDict, older=None, newer=None, t
# These are the methods to manipulate the transformations table
#

types_addTransformation = [six.string_types, six.string_types,
six.string_types, six.string_types,
six.string_types, six.string_types,
six.string_types]

def export_addTransformation(self,
transName, description, longDescription,
transType, plugin, agentType, fileMask,
transformationGroup='General',
groupSize=1,
inheritedFrom=0,
body='',
maxTasks=0,
eventsPerTask=0,
addFiles=True,
inputMetaQuery=None,
outputMetaQuery=None):
types_addTransformation = [
six.string_types,
six.string_types,
six.string_types,
six.string_types,
six.string_types,
six.string_types,
six.string_types,
]

def export_addTransformation(
self,
transName,
description,
longDescription,
transType,
plugin,
agentType,
fileMask,
transformationGroup='General',
groupSize=1,
inheritedFrom=0,
body='',
maxTasks=0,
eventsPerTask=0,
addFiles=True,
inputMetaQuery=None,
outputMetaQuery=None
):
# authorDN = self._clientTransport.peerCredentials['DN']
# authorGroup = self._clientTransport.peerCredentials['group']
credDict = self.getRemoteCredentials()
authorDN = credDict.get('DN', credDict.get('CN'))
authorGroup = credDict.get('group')
res = self.transformationDB.addTransformation(
transName, description, longDescription,
authorDN, authorGroup, transType, plugin,
agentType, fileMask,
transName,
description,
longDescription,
authorDN,
authorGroup,
transType,
plugin,
agentType,
fileMask,
transformationGroup=transformationGroup,
groupSize=groupSize,
inheritedFrom=inheritedFrom,
Expand All @@ -99,7 +117,8 @@ def export_addTransformation(self,
eventsPerTask=eventsPerTask,
addFiles=addFiles,
inputMetaQuery=inputMetaQuery,
outputMetaQuery=outputMetaQuery)
outputMetaQuery=outputMetaQuery,
)
if res['OK']:
self.log.info("Added transformation", res['Value'])
return res
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ def tearDown(self):
class TransformationClientChain(TestClientTransformationTestCase):

def test_addAndRemove(self):
# add (won't use this one)
res = self.transClient.addTransformation(
'transName_M',
'description_M',
'longDescription_M',
'Merge',
'Standard',
'Manual',
'',
groupSize=0.5,
)
self.assertTrue(res['OK'])
transID = res['Value']

# add
res = self.transClient.addTransformation('transName', 'description', 'longDescription', 'MCSimulation', 'Standard',
'Manual', '')
Expand Down