diff --git a/pandajedi/jediorder/JobGenerator.py b/pandajedi/jediorder/JobGenerator.py index d858dee41..d1c045b2d 100644 --- a/pandajedi/jediorder/JobGenerator.py +++ b/pandajedi/jediorder/JobGenerator.py @@ -991,11 +991,11 @@ def doGenerate( simul: bool = False, taskParamMap: dict[str, Any] | None = None, splitter: JobSplitter | None = None, - ) -> tuple[Interaction.StatusCode, list[JobSpec], list[Any], list[Any], dict[int, Any], dict[int, Any]]: + ) -> tuple[Interaction.StatusCode, list[JobSpec], list[Any], list[Any], dict[int, Any], dict[int, JediDatasetSpec]]: # Return for failure. Every caller checks the status before it touches the rest, # and then only measures, iterates or indexes them, so empty stands in for None # and spares each of those uses a check it never made - failedRet: tuple[Interaction.StatusCode, list[JobSpec], list[Any], list[Any], dict[int, Any], dict[int, Any]] = ( + failedRet: tuple[Interaction.StatusCode, list[JobSpec], list[Any], list[Any], dict[int, Any], dict[int, JediDatasetSpec]] = ( Interaction.SC_FAILED, [], [], @@ -1025,7 +1025,7 @@ def doGenerate( useBoundary = taskSpec.useGroupWithBoundaryID() # loop over all sub chunks jobSpecList = [] - outDsMap: dict[int, Any] = {} + outDsMap: dict[int, JediDatasetSpec] = {} datasetToRegister = [] oldPandaIDs: list[Any] = [] siteDsMap: dict[str, Any] = {} @@ -1794,8 +1794,8 @@ def doGenerate( # get dataset if tmpFileSpec.datasetID not in outDsMap: ds_ok, tmpDataset = self.taskBufferIF.getDatasetWithID_JEDI(taskSpec.jediTaskID, tmpFileSpec.datasetID) # type: ignore[arg-type] # the id is a column, which is declared optional - # not found - if not ds_ok: + # failed, or not found: a missing row comes back as None with ds_ok set + if not ds_ok or tmpDataset is None: tmpLog.error(f"failed to get DS with datasetID={tmpFileSpec.datasetID}") return failedRet outDsMap[tmpFileSpec.datasetID] = tmpDataset # type: ignore[index] # the id is a column, which is declared optional @@ -1830,8 +1830,8 @@ def doGenerate( for tmpFileSpec in tmpFileSpecList: if tmpFileSpec.datasetID not in outDsMap: ds_ok, tmpDataset = self.taskBufferIF.getDatasetWithID_JEDI(taskSpec.jediTaskID, tmpFileSpec.datasetID) # type: ignore[arg-type] # the id is a column, which is declared optional - # not found - if not ds_ok: + # failed, or not found: a missing row comes back as None with ds_ok set + if not ds_ok or tmpDataset is None: tmpLog.error(f"failed to get DS with datasetID={tmpFileSpec.datasetID}") return failedRet outDsMap[tmpFileSpec.datasetID] = tmpDataset @@ -2254,11 +2254,11 @@ def doGeneratePrePro( # get dataset if tmpFileSpec.datasetID not in outDsMap: ds_ok, tmpDataset = self.taskBufferIF.getDatasetWithID_JEDI(taskSpec.jediTaskID, tmpFileSpec.datasetID) # type: ignore[arg-type] # the id is a column, which is declared optional - # not found - if not ds_ok: + # failed, or not found: a missing row comes back as None with ds_ok set + if not ds_ok or tmpDataset is None: tmpLog.error(f"doGeneratePrePro failed to get logDS with datasetID={tmpFileSpec.datasetID}") return failedRet - outDsMap[tmpFileSpec.datasetID] = tmpDataset # type: ignore[assignment] + outDsMap[tmpFileSpec.datasetID] = tmpDataset # convert to job's FileSpec tmpDatasetSpec = outDsMap[tmpFileSpec.datasetID] tmpOutFileSpec = tmpFileSpec.convertToJobFileSpec(tmpDatasetSpec, setType="log") @@ -2684,7 +2684,7 @@ def increaseEventServiceConsumers( nConsumers: int, nSitesPerJob: int, parallelOutMap: dict[int, Any], - outDsMap: dict[int, Any], + outDsMap: dict[int, JediDatasetSpec], oldPandaIDs: list[Any], taskSpec: JediTaskSpec, inputChunk: InputChunk, @@ -2819,7 +2819,7 @@ def clonePandaJob( # make jumbo jobs def makeJumboJobs( - self, pandaJobs: list[JobSpec], taskSpec: JediTaskSpec, inputChunk: InputChunk, simul: bool, outDsMap: dict[int, Any], tmpLog: MsgWrapper + self, pandaJobs: list[JobSpec], taskSpec: JediTaskSpec, inputChunk: InputChunk, simul: bool, outDsMap: dict[int, JediDatasetSpec], tmpLog: MsgWrapper ) -> list[JobSpec]: jumboJobs: list[Any] = [] # no original