-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use central job enqueue logic for jobs spawned by rules #962
Conversation
Codecov Report
@@ Coverage Diff @@
## master #962 +/- ##
========================================
- Coverage 90% 90% -0.01%
========================================
Files 49 49
Lines 6646 6664 +18
========================================
+ Hits 5982 5998 +16
- Misses 664 666 +2 |
As-is this change means when job is spawned from gear rule, gears should expect config.json files that contain meta on the inputs, but not contain config. There are at least 2 gears that don't operate well in this situation (scitran-apps/dcm2niix and flywheel-apps/mriqc) and guessing several more due to the pattern being used which assumes config is included in config.json whenever that file exists. This situation would no longer be expected once gear rules pass along config defaults from the gear manifest. #961 I double checked the gear spec and defaults for config options are not required. @kofalt can you confirm I'm reading the schema correct? I initially thought it to be good to update those and other gears to support this PR as-is, as those changes would align with the gear spec, and increase their robustness. After recognizing the pattern for how config.json is used, I no longer think merging this before #961 would be prudent. |
For posterity, here's the project rules I used to make the sequential pipeline of classifier => dcm2niix => (qa-report-fmri and mriqc)
|
No, all default config values are required. It (has generally been) expected that the submitter to jobs-add fill in any default values, for example. |
@@ -335,7 +335,7 @@ def get_config(self, _id): | |||
# Detect if config is old- or new-style. | |||
# TODO: remove this logic with a DB upgrade, ref database.py's reserved upgrade section. | |||
|
|||
if c.get('config') is not None and c.get('inputs') is not None: | |||
if 'config' in c and c.get('inputs') is not None: |
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.
Can you explain the rationale behind this change? This would fail if c['config']
is None.
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.
It was failing when the config key existed but was not set. AKA, it was the "new" style, but there was no config for the job. There were inputs and destination.
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.
Out-of-band: Given that this is a database anti-upgrade hackaround, let's just run with this for now 👍
api/jobs/rules.py
Outdated
pj['job'].insert() | ||
spawned_jobs.append(pj['rule']['alg']) | ||
job_map = pj['job'].map() | ||
Queue.enqueue_job(job_map, None) # passing no origin results in system origin |
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.
Given this usage, what would your opinion be of making origin
a named parameter, and always naming it when calling?
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.
It is more important we set and origin when we can, this is the only situation I am aware of that does not set an origin. I worry if the origin is optional, it will not be set when it should.
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.
Out of band: the None
here is really the problem, this will be replaced with a system default origin to make the call clearer.
api/jobs/rules.py
Outdated
|
||
for pj in potential_jobs: | ||
job_map = pj['job'].map() | ||
Queue.enqueue_job(job_map, None) # passing no origin results in system origin | ||
Queue.enqueue_job(job_map, origin) # passing no origin results in system origin |
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.
Should remove that comment now
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.
Generally LGTMish
LGTM. Nice work! Confirmed following
|
Removed unneeded comment after change, will merge when CI is green. |
Resolves #923
Changes in this PR