Repository navigation
More annortations in JobGenerator - #883
Merged
Merged
Conversation
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].
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request refines type safety and error handling in the
JobGenerator.pymodule, primarily by updating type annotations for output dataset maps and strengthening checks when retrieving datasets. These changes improve code reliability and make the type expectations clearer throughout the job generation process.Type annotation improvements:
outDsMapfromdict[int, Any]todict[int, JediDatasetSpec]in method signatures and local variable declarations, ensuring that onlyJediDatasetSpecobjects are stored and passed around as output datasets. [1] [2] [3] [4]Error handling enhancements:
ds_ok) and whether the returned dataset (tmpDataset) isNone, preventing cases where a missing dataset could cause downstream errors. This pattern is now consistently applied in bothdoGenerate,doGeneratePrePro, and related methods. [1] [2] [3]