|
7 | 7 | from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
8 | 8 | from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getDNForUsername
|
9 | 9 | from DIRAC.Core.Security.ProxyInfo import getProxyInfo
|
10 |
| -from DIRAC.Core.Utilities.DErrno import ETSDATA, ETSUKN |
| 10 | +from DIRAC.Core.Utilities.DErrno import ETSUKN |
11 | 11 | from DIRAC.Core.Utilities.List import fromChar
|
12 | 12 | from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader
|
13 | 13 | from DIRAC.Interfaces.API.Job import Job
|
@@ -83,6 +83,8 @@ def __init__(
|
83 | 83 | self.outputDataModule_o = None
|
84 | 84 | self.objectLoader = ObjectLoader()
|
85 | 85 |
|
| 86 | + self.parametricSequencedKeys = ["JOB_ID", "PRODUCTION_ID", "InputData"] |
| 87 | + |
86 | 88 | def prepareTransformationTasks(self, transBody, taskDict, owner="", ownerGroup="", bulkSubmissionFlag=False):
|
87 | 89 | """Prepare tasks, given a taskDict, that is created (with some manipulation) by the DB
|
88 | 90 | jobClass is by default "DIRAC.Interfaces.API.Job.Job". An extension of it also works.
|
@@ -191,22 +193,7 @@ def _prepareTasksBulk(self, transBody, taskDict, owner, ownerGroup):
|
191 | 193 | method=method,
|
192 | 194 | )
|
193 | 195 |
|
194 |
| - # Handle Input Data |
195 |
| - inputData = paramsDict.get("InputData") |
196 |
| - if inputData: |
197 |
| - if isinstance(inputData, str): |
198 |
| - inputData = inputData.replace(" ", "").split(";") |
199 |
| - self._logVerbose(f"Setting input data to {inputData}", transID=transID, method=method) |
200 |
| - seqDict["InputData"] = inputData |
201 |
| - elif paramSeqDict.get("InputData") is not None: |
202 |
| - self._logError("Invalid mixture of jobs with and without input data") |
203 |
| - return S_ERROR(ETSDATA, "Invalid mixture of jobs with and without input data") |
204 |
| - |
205 |
| - for paramName, paramValue in paramsDict.items(): |
206 |
| - if paramName not in ("InputData", "Site", "TargetSE"): |
207 |
| - if paramValue: |
208 |
| - self._logVerbose(f"Setting {paramName} to {paramValue}", transID=transID, method=method) |
209 |
| - seqDict[paramName] = paramValue |
| 196 | + inputData = self._handleInputsBulk(seqDict, paramsDict, transID) |
210 | 197 |
|
211 | 198 | outputParameterList = []
|
212 | 199 | if self.outputDataModule:
|
@@ -235,7 +222,7 @@ def _prepareTasksBulk(self, transBody, taskDict, owner, ownerGroup):
|
235 | 222 | paramSeqDict.setdefault(pName, []).append(seq)
|
236 | 223 |
|
237 | 224 | for paramName, paramSeq in paramSeqDict.items():
|
238 |
| - if paramName in ["JOB_ID", "PRODUCTION_ID", "InputData"] + outputParameterList: |
| 225 | + if paramName in self.parametricSequencedKeys + outputParameterList: |
239 | 226 | res = oJob.setParameterSequence(paramName, paramSeq, addToWorkflow=paramName)
|
240 | 227 | else:
|
241 | 228 | res = oJob.setParameterSequence(paramName, paramSeq)
|
@@ -399,6 +386,28 @@ def _handleInputs(self, oJob, paramsDict):
|
399 | 386 | if not res["OK"]:
|
400 | 387 | self._logError(f"Could not set the inputs: {res['Message']}", transID=transID, method="_handleInputs")
|
401 | 388 |
|
| 389 | + def _handleInputsBulk(self, seqDict, paramsDict, transID): |
| 390 | + """set job inputs (+ metadata)""" |
| 391 | + method = "_handleInputsBulk" |
| 392 | + if seqDict: |
| 393 | + self._logVerbose(f"Setting job input data to {seqDict}", transID=transID, method=method) |
| 394 | + |
| 395 | + # Handle Input Data |
| 396 | + inputData = paramsDict.get("InputData") |
| 397 | + if inputData: |
| 398 | + if isinstance(inputData, str): |
| 399 | + inputData = inputData.replace(" ", "").split(";") |
| 400 | + self._logVerbose(f"Setting input data {inputData} to {seqDict}", transID=transID, method=method) |
| 401 | + seqDict["InputData"] = inputData |
| 402 | + |
| 403 | + for paramName, paramValue in paramsDict.items(): |
| 404 | + if paramName not in ("InputData", "Site", "TargetSE"): |
| 405 | + if paramValue: |
| 406 | + self._logVerbose(f"Setting {paramName} to {paramValue}", transID=transID, method=method) |
| 407 | + seqDict[paramName] = paramValue |
| 408 | + |
| 409 | + return inputData |
| 410 | + |
402 | 411 | def _handleRest(self, oJob, paramsDict):
|
403 | 412 | """add as JDL parameters all the other parameters that are not for inputs or destination"""
|
404 | 413 | transID = paramsDict["TransformationID"]
|
|
0 commit comments