Repository navigation
The schema dumper records the SPINE commit, the writer format and warnings - #5
Merged
Merged
Conversation
…nings
dump_schema.py writes three new keys, which generate.py ignores (the
generated C++ does not change):
- spine_sha: the commit given with the new --spine-sha (40 hexadecimal
characters; null without it).
- writer_format: HDF5Writer's format_name, legacy_format_version,
current_format_version and supported_format_versions, read with getattr
so that a missing attribute is null, and default_format_version, the
default of the format_version parameter of HDF5Writer.__init__ (null when
the parameter does not exist). A change of the writer's default layout
shows here.
- warnings: {kind, name, detail} for what the dumper sees but does not map.
unmapped_attribute is a FieldMetadata attribute outside MAPPED_ATTRIBUTES
(at 1.4.0, only cat); unlisted_class is a class of spine.data with
attr_metadata in neither DEFAULT_CLASSES nor the new EXCLUDED_CLASSES
(RecoFragment, TruthFragment, Neutrino, ImageMeta2D, larcv's Particle,
ParticleLabel, and the bases DataBase and PosDataBase). An alias of a
listed class (Meta) is listed.
Any exception while importing or reading SPINE now prints one line on
stderr, "dump_schema: <exception class>: <message>", and exits 1; an
unknown --classes name is a LookupError.
schema/spine-1.4.0.json is re-dumped with --spine-sha 4726e068...: only the
three keys and three notes are new.
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.
Fifth step of following SPINE releases. A comparison of two SPINE tags needs more than the model:
dump_schema.pynow records all three. The step after this one adds the comparison itself.What changes
New keys in the schema JSON.
generate.pyignores them, so the generated C++ does not change.spine_sha: the commit given with the new--spine-sha, which must be 40 hexadecimal characters. It isnullwithout the option.writer_format:HDF5Writer'sformat_name,legacy_format_version,current_format_versionandsupported_format_versions, plusdefault_format_version, the default of theformat_versionparameter ofHDF5Writer.__init__.nullinstead of an error.warnings:{kind, name, detail}entries:unmapped_attribute: aFieldMetadataattribute outsideMAPPED_ATTRIBUTES(the flags, plusreturn_type,length,dtype,units,enum,reference,reference_spaceandskip). At 1.4.0 that is onlycat, the concatenation flag of the index fields.unlisted_class: a class ofspine.datawithattr_metadatathat is in neitherDEFAULT_CLASSESnor the newEXCLUDED_CLASSES.EXCLUDED_CLASSES.RecoFragment,TruthFragment,NeutrinoandImageMeta2D.Particle,ParticleLabel(the compact record of cluster labels), and the basesDataBaseandPosDataBase.spine.dataexports all of these withattr_metadataat 1.4.0.MetaisImageMeta3D) counts as listed.Errors. Any exception while importing or reading SPINE prints one line on stderr,
dump_schema: <exception class>: <message>, writes nothing, and exits 1. An unknown--classesname is now aLookupError. Exit codes:--strictand a type mismatchschema/spine-1.4.0.jsonis re-dumped with--spine-sha 4726e068f17e433e2fec068dc8ee498fa9a0658f. Only the three keys and three notes are new.Docs:
tools/gen/README.md: the top-level keys, the error line,--spine-shain the regeneration command, and the new keys in "What to check afterwards".tools/gen/EGM.md:Checked
The committed schema. Before the change, the dumper reproduces
schema/spine-1.4.0.jsonbyte for byte under LCG_110. After it, the dump differs only by the new keys and notes, andgenerate.py --checkandmake_member_list.py --checkpass.Other tags. These are dumps into a scratch folder; v1.4.87, v1.4.94 and v1.4.96 are local tags in a scratch SPINE clone:
cat); the SHA recordedspine.dataunlisted_classTestRecordformat_versionparameterdefault_format_versionnullFieldMetadata.pdgdump_schema: AttributeError: 'FieldMetadata' object has no attribute 'pdg'dump_schema: AttributeError: type object 'RecoParticle' has no attribute 'attr_metadata'--classes RecoParticle NoSuchClassdump_schema: LookupError: spine.data has no class NoSuchClass--spine-sha 4726e06Tests.
ctestunder LCG_110: 6 entries; 5 run and pass, andspine_reader_real_filesis skipped without files.Lint.
flake8 --max-line-length=100ondump_schema.pyreports only the two E203 warningsmainalready has.