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

feat: adds merge_job_parameter_definitions() #32

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Conversation

ddneilson
Copy link
Contributor

What was the problem/requirement? (What/Why)

When creating/running a Job, that Job is defined with a Job Template but can also include one or more externally-defined Environment Templates. The library does not currently support that.

What was the solution? (How)

This adds support for including these Environment Templates when creating a job via create_job(), checking job parameters via preprocess_job_parameters(), and adds a new function that can be used just for checking compatibility (merge_job_parameter_definitions()).

What is the impact of this change?

More complete featureset

How was this change tested?

I added unit test coverage for the new code paths. I also noticed that create_job() didn't actually have any dedicated testing so I added tests for it.

Was this change documented?

N/A

Is this a breaking change?

No; not intentionally.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ddneilson ddneilson requested a review from a team as a code owner January 12, 2024 20:17
@ddneilson ddneilson force-pushed the ddneilson/16563 branch 3 times, most recently from d82c8a6 to f5dc085 Compare January 15, 2024 21:58
AWS-Samuel
AWS-Samuel previously approved these changes Jan 16, 2024
Copy link

@AWS-Samuel AWS-Samuel left a comment

Choose a reason for hiding this comment

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

overall looks good, just two nits

src/openjd/model/_create_job.py Outdated Show resolved Hide resolved
src/openjd/model/_merge_job_parameter.py Outdated Show resolved Hide resolved
AWS-Samuel
AWS-Samuel previously approved these changes Jan 16, 2024
@@ -127,34 +125,49 @@ def preprocess_job_parameters(
"""
if job_template.version not in (SchemaVersion.v2023_09,):
raise NotImplementedError(f"Not implemented for schema version {job_template.version}")
if environment_templates and any(
env.version not in (SchemaVersion.v2023_09,) for env in environment_templates
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like SchemaVersion.v2023_09 is jobtemplate-2023-09. This should be comparing with SchemaVersion.ENVIRONMENT_v2023_09?

Copy link
Contributor Author

@ddneilson ddneilson Jan 17, 2024

Choose a reason for hiding this comment

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

Yeah, this is a bigger change. I need to split the current SchemaVersion -- it's trying to do too much. I need a TemplateVersion that'll be the 'jobtemplate-2023-09' type values and a PublicationVersion that'll be the "spec publication" (i.e. v2023-09). The .version field of the models will become PublicationVersion

It was already on the list; just not in this PR. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could actually change this to

Suggested change
env.version not in (SchemaVersion.v2023_09,) for env in environment_templates
env.specificationVersion not in (SchemaVersion.ENVIRONMENT_v2023_09,) for env in environment_templates

If that would be clearer. Otherwise, this'll change with a refactor that's coming up anyways.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, yeah. I think the change does make it more clear, the difference between "version" and "specificationVersion" is pretty subtle.

When creating/running a Job, that Job is defined with a Job Template but can
also include one or more externally-defined Environment Templates. This
adds support for including these Environment Templates when creating a
job via create_job(), checking job parameters via
preprocess_job_parameters(), and adds a new function that can be used
just for checking compatibility (merge_job_parameter_definitions()).

Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson merged commit ad944eb into mainline Jan 17, 2024
15 checks passed
@ddneilson ddneilson deleted the ddneilson/16563 branch January 17, 2024 21:30
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.

3 participants