-
Notifications
You must be signed in to change notification settings - Fork 49
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
broker: parent-uri
attribute is set for instance with no parent
#5622
Comments
I think that is the expected behavior but maybe because I didn't think it through? I guess a test instance should always be the "top" flux even if it was started by Flux? What is the fallout from the current behavior? |
In this case flux did not start the test instance, it just happened to be started under an existing instance. It seems like an instance should only be considered the parent if it allocated resources to the child instance? The fallout is that existence of the |
I also admit I haven't thought this through either, though. It is simple enough to check for a |
There is also this, which works as expected.
Yeah seems like when flux is not run as a flux job, all three of these should be true
|
I just went through the code and currently all places where There is this comment in flux-core/src/modules/resource/inventory.c Lines 40 to 46 in b0c565f
which probably needs a very slight tweak. |
Does this seem right then? diff --git a/src/broker/broker.c b/src/broker/broker.c
index 7bdb38bdd..c040f1cf9 100644
--- a/src/broker/broker.c
+++ b/src/broker/broker.c
@@ -629,7 +629,14 @@ static void init_attrs (attr_t *attrs, pid_t pid, struct flux_msg_cred *cred)
{
const char *val;
- val = getenv ("FLUX_URI");
+ /* Set the parent-uri attribute IFF this instance was run as a job
+ * in the enclosing instance. "parent" in this context reflects
+ * a hierarchy of resource allocation.
+ */
+ if (getenv ("FLUX_JOB_ID"))
+ val = getenv ("FLUX_URI");
+ else
+ val = NULL;
if (attr_add (attrs, "parent-uri", val, ATTR_IMMUTABLE) < 0)
log_err_exit ("setattr parent-uri");
unsetenv ("FLUX_URI"); |
Problem: the parent-uri attribute is set whenever FLUX_URI is set in the broker environment, but this does not necessarily indicate that the instance has a "parent" in the resource hierarchy sense. Suppress setting parent-uri when the broker is not running as a Flux job, determined by checking for FLUX_JOB_ID. Fixes flux-framework#5622
That looks correct to me. |
Problem: the parent-uri attribute is set whenever FLUX_URI is set in the broker environment, but this does not necessarily indicate that the instance has a "parent" in the resource hierarchy sense. Suppress setting parent-uri when the broker is not running as a Flux job, determined by checking for FLUX_JOB_ID. Fixes flux-framework#5622
Problem: the parent-uri attribute is set whenever FLUX_URI is set in the broker environment, but this does not necessarily indicate that the instance has a "parent" in the resource hierarchy sense. Suppress setting parent-uri when the broker is not running as a Flux job, determined by checking for FLUX_JOB_ID. Fixes flux-framework#5622
Problem: the parent-uri attribute is set whenever FLUX_URI is set in the broker environment, but this does not necessarily indicate that the instance has a "parent" in the resource hierarchy sense. Suppress setting parent-uri when the broker is not running as a Flux job, determined by checking for FLUX_JOB_ID. Fixes flux-framework#5622
I'm not certain, but this seems wrong:
It appears that the broker sets
parent-uri
wheneverFLUX_URI
is set in the environment, even if the enclosing instance isn't technically the parent of the new instance.Is this expected behavior?
The text was updated successfully, but these errors were encountered: