-
Notifications
You must be signed in to change notification settings - Fork 51
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
job-info: return job state as number encourages hardcoding values in shell scripts #2635
Comments
Seems like a good idea, instead of the user converting numeral to string. |
Another approach would be to add |
That's maybe a better idea, thanks! |
Granted If we really need a numeral someday, we could just add a new attribute in the |
I wasn't considering a requirement for a state number instead of string, but instead was considering the size of underlying json strings. Probably not an issue at this point since it would just add a few characters per job. |
It occurred to me this morning that switching to a state string may be a little more inconvenient in C/C++ code. E.g. @dongahn's MPIR PR we have: if (state > FLUX_JOB_RUN) We'd likely at least want to add |
OK, I'm thinking now it may be less bad to keep the numbers. It will be irritating to have to convert in order to use it it in masks and switch statements in C. if (state > FLUX_JOB_RUN) This is probably a bit unsafe though, in case we ever add a state and tack it on the end numerically to avoid breaking ABI (and it doesn't "come after" RUN). Would it be appropriate to formalize the numbers and maybe the single character abbreviations in RFC 21? |
Good point!
Good idea. I wonder if we'll also want to explicitly state that the order of the state numbers is meaningless, and provide some convenience functions to satisfy use cases like this. Actually maybe in the case pasted above (where I'll comment in #2654 to that effect. Note that I'm still open to switching job states away from state numbers. As long as we've got the use cases easily covered. (e.g. even a python script may want to test for a virtual state like "pending" . This could be done with state strings just as easily as state numbers, just a lot more string comparisons) |
Uh I guess that should have been |
This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 14 days. Thank you for your contributions. |
i'm wondering if this issue should be resurrected given discussion in #4273, #4313, and #4234
|
Problem:
job-info.list
returns job states as numerical values. This encourages people parsing the output in a bash script withjq
to hard code the enum values.It would be better IMHO to return the state names (strings) from RFC 21.
That might work out better in the python bindings too...
The text was updated successfully, but these errors were encountered: