feat(pipeline): check cluster time in yaml config #254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into a small issue with the cluster configuration that may go under the radar:
I tried to specify a job time of 12 hours in a configuration file in the following way (without quotation marks):
PyYAML accepts this without complaints, but parses the value as a sexagimal (base 60) number, giving the following line in the job script:
Slurm then interprets this bare number as minutes, so it results in a job with a time request of 43200 minutes = 720 hours = 30 days, i.e. 60 times more time than I was expecting. In this particular case Cedar did not accept the job, because the time requested is longer than the maximum allowed (28 days). However, if the raw value is 11:12:00 or less Cedar won't complain, and the erroneous time value will lead to jobs inadvertently requesting much more time than needed and maybe having difficulties getting scheduled.
The solution is to make sure such time values are enclosed in quotation marks.
My goal in this PR was to let the pipeline give an error (it could perhaps be a warning instead) when it encounters time values consisting of just digits and colons. Because the check has to be made on the raw configuration string
yaml_doc
(not on theyaml_params
dictionary that is already parsed by PyYAML) I used some ugly regex matching to do the check. Maybe there's a better way.Either way I do think it's would be good to add some sort of check for such time values. An alternative would be to try to simply educate everyone to put quotes around the time value. A quick check of the example configuration files in ch_pipeline shows there's one with this mistake:
https://github.com/chime-experiment/ch_pipeline/blob/master/examples/noise_calibration.yaml