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

Add pydantic support #136

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Add pydantic support #136

wants to merge 28 commits into from

Conversation

nuwang
Copy link
Member

@nuwang nuwang commented Aug 19, 2024

Add a well-defined schema for the TPV config with stronger typing support.

@nuwang nuwang changed the title [WIP] Add pydantic support Add pydantic support Aug 25, 2024
@nuwang nuwang force-pushed the add_pydantic_support branch 2 times, most recently from 39acaf8 to dc648e3 Compare August 27, 2024 14:33
@nuwang nuwang requested a review from cat-bro September 5, 2024 06:07
Copy link
Collaborator

@cat-bro cat-bro left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

github-actions bot commented Sep 13, 2024

Pull Request Test Coverage Report for Build 10849026140

Details

  • 404 of 409 (98.78%) changed or added relevant lines in 6 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-1.0%) to 94.657%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tpv/core/loader.py 40 41 97.56%
tpv/core/entities.py 322 324 99.38%
tpv/core/evaluator.py 21 23 91.3%
Files with Coverage Reduction New Missed Lines %
tpv/core/entities.py 3 94.59%
Totals Coverage Status
Change from base Build 10706773089: -1.0%
Covered Lines: 986
Relevant Lines: 1011

💛 - Coveralls

@nuwang
Copy link
Member Author

nuwang commented Sep 13, 2024

I've made a major version bump because there's a breaking change in Tag handling. Specifically, the Tag constructor no longer accepts a name argument (it was always "scheduling" in the past), and the TagSetManager class has been simplified to become the SchedulingTag class.

Therefore, this code will no longer work: https://github.com/usegalaxy-eu/infrastructure-playbook/blob/46931230ccaa357a5420b1d4698df94221dfa168/files/galaxy/tpv/tool_defaults.yml#L39

Instead, it would need to be:

if pulsar_tag != "None":
    entity.tpv_tags = entity.tpv_tags.combine(
        SchedulingTags(require=[pulsar_tag])
    )

To catch these breaking changes, we should also improve the linter to support type checking, so we should probably withhold merging this till that's done.

@@ -63,8 +63,7 @@ users:
rule_helper = RuleHelper(app)
# Find all destinations that support highmem
destinations = [d.dest_name for d in mapper.destinations.values()
if any(d.tpv_dest_tags.filter(tag_value='highmem',
tag_type=[TagType.REQUIRE, TagType.PREFER, TagType.ACCEPT]))]
if 'highmem' in (d.tpv_dest_tags.require + d.tpv_dest_tags.prefer + d.tpv_dest_tags.accept)]
Copy link
Member Author

@nuwang nuwang Sep 5, 2024

Choose a reason for hiding this comment

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

Just flagging these for release notes. This is a simplification we can use over the existing code, but the existing filter method will also still work.

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.

2 participants