-
Notifications
You must be signed in to change notification settings - Fork 50
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
idea: add FLUX
environment variable that holds "closest enclosing jobid"
#6474
Comments
a random idea I thought of. if we want to avoid spreading too many environment variables, could we support a new command like hypothetically |
Would |
I think if |
An environment variable or flux attribute (each of which works consistently across cases) would be great. Another thing we would like to have is storing the equivalent, but for the very top level instance id. E.g.,: FLUX_TOP_LEVEL_ID=xxx I am adding a command I think whatever you decide to come up with will be hugely helpful, so thank you in advance! |
Yeah, this is what I was thinking. Just wrap the logic into it. |
This idea was brought up by @trws on slack and in a project meeting.
Flux currently doesn't have a consistent way to determine the "nearest" enclosing jobid. The cases are somewhat delineated in #3817, though the information there may be outdated (i.e. there does now exist a flux_job_timeleft(3) function). While it makes sense that
FLUX_JOB_ID
is set in the environment of tasks launched byflux run
andflux submit
but not in the environment of the initial program influx alloc
andflux batch
, this will likely continue to cause confusion and annoyance for users.One idea put forward by @trws is to add another
FLUX_
jobid variable that is always set by the job shell which is not cleared. (Please correct me if I'm mistaken). This variable would leak through to initial programs, which would then be able to use this variable to determine the jobid of their parent instance (if there was a jobid associated) - equivalent to, but more straightforward than usingflux getattr jobid
. It would also be available influx run
andflux submit
where it would be the same asFLUX_JOB_ID
. Comparing the two variables would allow users to easily determine if they are in an initial program environment or within a job. Lack of this new environment variable would indicate that there is no enclosing job, i.e. the current process is not within an instance, or the enclosing instance is not itself a job.Edit: if we enable this feature, that may allow us to close #3817.
The text was updated successfully, but these errors were encountered: