From 6f3c32c08577d492fc7f42819c5399232b4c4c95 Mon Sep 17 00:00:00 2001 From: tmaeno Date: Mon, 23 Nov 2026 12:36:02 +0100 Subject: [PATCH 1/2] Report an output dataset that is not found in job generation doGenerate and doGeneratePrePro look up the dataset of each output file with getDatasetWithID_JEDI. The check after each lookup is commented "not found", but it only tested the success flag. getDatasetWithID_JEDI returns (True, None) when the row is missing, so the None went into the dataset map. Each of the three lookups now reports a missing dataset through the error path it already had for a failed read, with the same message. - For the output files of a job, and for the log file of a prepro job, the None was passed to convertToJobFileSpec right away. Its AttributeError ended in the generic except. The outcome is the same as before, with a message that names the dataset. - For the files of other sites' parallel jobs, the None was used only when a job was cloned for several sites. A missing row now fails job generation whether or not that happens. The datasets in question are the ones getOutputFiles_JEDI has just created the files in. doGeneratePrePro's store of the dataset no longer needs its type: ignore[assignment]. --- pandajedi/jediorder/JobGenerator.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pandajedi/jediorder/JobGenerator.py b/pandajedi/jediorder/JobGenerator.py index d858dee41..120e555d8 100644 --- a/pandajedi/jediorder/JobGenerator.py +++ b/pandajedi/jediorder/JobGenerator.py @@ -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") From 36b336180c68e787d5988925713d4aa4325bbfd0 Mon Sep 17 00:00:00 2001 From: tmaeno Date: Mon, 23 Nov 2026 12:36:40 +0100 Subject: [PATCH 2/2] Declare the dataset map of doGenerate as JediDatasetSpec doGenerate keeps the output datasets it looks up in outDsMap, keyed by datasetID, and returns it for cloning jobs. The map was declared dict[int, Any], so a dataset taken from it was untyped. That includes tmpDatasetSpec in the output loop, which shares its name with the input loops. mypy then checked nothing done with those datasets, and the code map could not tell where the calls on them go. It is now dict[int, JediDatasetSpec] where it is made, in doGenerate's return and failure value, and in increaseEventServiceConsumers and makeJumboJobs, which take it. clonePandaJob and doGeneratePrePro already used that type. The commit before this one keeps None out of the map. --- pandajedi/jediorder/JobGenerator.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandajedi/jediorder/JobGenerator.py b/pandajedi/jediorder/JobGenerator.py index 120e555d8..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] = {} @@ -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