-
Notifications
You must be signed in to change notification settings - Fork 0
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
Import job-runner's parsing #32
Conversation
f19047b
to
0ae56ad
Compare
pipeline/legacy.py
Outdated
permitted_privacy_levels = [ | ||
"highly_sensitive", | ||
"moderately_sensitive", | ||
"minimally_sensitive", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had no idea there even was a minimally sensitive level!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've read commit-by-commit and (I think) I understand what you're doing and why you're doing it. I don't have enough experience of job-runner to check that the refactoring hasn't missed something; but nevertheless, everything seems correct. More 👀 needed 🙂
7d36f70
to
35eb00d
Compare
This uses the pydantic models to load and validate a given project.yaml, but keeps all the job-runner functions using dicts. There is duplicate validation which will be removed in favour of pydantic model validation in a subsequent change.
We manually parse the run command to build up Command instances so we also have to handle basic validation like this.
load_pipeline is now a full replacement for it.
8b6e671
to
f6126f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think we're there! \o/ :superhero:
One question about a possible improvement.
Overall, I'm not convinced the benefits of static typing are worth the extra complexity, but if there was ever a project that this should apply, it's this one.
7392e4b
to
5c03b11
Compare
job-runner needs to mutate the arguments passed to extraction commands (eg cohortextractor and databuilder) based on pipeline config. However we don't think that should be exposed to other users of the library so now we have boundary where this library is concerned with parsing and validating the config.
We need various forms of the `run` key a config provides so instead of library consumers creating these themselves we now only store the raw version (renamed from run to raw to avoid run.run) and provide properties for the other forms.
Rather than pulling in is_extraction_command from job-runner this allows us a lookup table of validation functions which dispatch on the specific image and command.
5c03b11
to
40fee6e
Compare
This pulls in
project.py
(aslegacy.py
) from job-runner and refactors it into the pydantic models. All validation is currently handled with pydantic (although, as per #31 I don't think that's the ideal situation), with the generation of ActionSpecifications (and thus mutation of the run command for that) left to that method.I've hopefully made reviewable commits, so they're the possible to follow.
Ref opensafely-core/job-runner#366