Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-33414: Allow id to be used in file template #639

Merged
merged 3 commits into from Feb 1, 2022
Merged

Conversation

timj
Copy link
Member

@timj timj commented Jan 27, 2022

@gpdf / @TallJimbo this does the job -- I also restrict the id to having to be in the filename itself if it is specified anywhere.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@timj timj force-pushed the tickets/DM-33414 branch 4 times, most recently from 0f631e2 to be21926 Compare January 27, 2022 22:48
@codecov
Copy link

codecov bot commented Jan 27, 2022

Codecov Report

Merging #639 (0450d43) into main (f1b3f43) will increase coverage by 0.01%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #639      +/-   ##
==========================================
+ Coverage   84.13%   84.14%   +0.01%     
==========================================
  Files         237      237              
  Lines       30216    30223       +7     
  Branches     5022     5022              
==========================================
+ Hits        25423    25432       +9     
+ Misses       3648     3647       -1     
+ Partials     1145     1144       -1     
Impacted Files Coverage Δ
python/lsst/daf/butler/core/fileTemplates.py 76.22% <77.77%> (+0.81%) ⬆️
tests/test_templates.py 98.80% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1b3f43...0450d43. Read the comment docs.

if not usedRun and not usedId:
missing = ("run" if not usedRun else None, "id" if not usedId else None)
text = " or ".join(f"'{m}'" for m in missing if m is not None)
raise KeyError(f"Template does not include {text}.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a similar check for the dataset type name that could also be relaxed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like we require the dataset type to be in the template. "run" was the only thing we required from what I could see (and I was able to use a file template of just {id}.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that this line has no coverage implies that we catch the no-run logic higher up and none of this is needed any more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like we should just remove it, then, and update the docs to say it's expected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this block of code was an early attempt at template validation but at some point we moved the validation logic earlier and never noticed that this block was irrelevant. I'll remove it.

Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine - functionality is clearly what we want, but I'm a little worried that the template validation code is getting a little hard to follow now that we have so many rules (especially if we don't really understand why some of the new lines aren't in the coverage report).

If id is used it must at least be present in the file
name part of the template path.
During DM-17025 the code in the format() method to check
that run was present was made irrelevant because of an
earlier check that was added as part of generic
template validation.
@timj timj merged commit e8d8315 into main Feb 1, 2022
@timj timj deleted the tickets/DM-33414 branch February 1, 2022 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants