-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Cannot get job status for jobs that are the prefix of another job #10625
Comments
Ok. So I narrowed this down a bit and figured it out a bit more. If you set: NOMAD_NAMESPACE='*' Then, when you attempt to do a |
Hi @dansteen! It seems like there are two behaviors here, so I want to try to discuss them separately. Note that
So that Now onto the So I think what's not clear to me from what you're describing is what namespace the two jobs are in? Is the |
hi @tgross thanks for the response! We are actually testing out namespaces at the moment. So while there is a namespace named |
Thanks @dansteen, that's helpful. I was able to reproduce the behavior, but it turns out that having a namespace named the same as one of the jobs (or a prefix of it) was a red herring. The difference in behavior is only about the The cause is this line in At first I was looking at this and thinking I could argue we should use the exact if all the jobs that came back are in the same namespace. But when @notnoop implemented this, I think he was being careful to consider some nasty edge cases. Imagine the following scenario: you have a job To reproduce: set up a namespace and two jobs, with prefix-sharing names.
The
The
It's where we get into the specific
But with the wildcard set, we get the "Prefix matched multiple jobs" when the job is a prefix:
Arguably the "Prefix matched multiple jobs" should be the correct behavior here, and that it's wrong when the But as it turns out, that the namespace you've got overlaps the job ID turns out to be a red herring. If we delete the namespace, we see the exact same behavior:
|
hi @tgross thanks for the super detailed response! Some thoughts: I agree that the namespace being a prefix was a red herring. thanks for refining that down.
I'm not sure I'm following here. I would argue the exact opposite. "Prefix matched multiple jobs" should only show when the string does not also match a specific job. That's the way nomad has always done it, and that's the behavior that I would argue should happen here as well - as it's extremely confusing if commands change their semantics based on the content of ENV variables. Assuming two jobs
The first will display the job while the second will display the "Prefix matched multiple jobs". But the intent and semantics of what I have requested are exactly the same. I'm increasing my search area to multiple namespaces, but I still want that specific job if it exists or a list of prefixes if it does not. Going backwards a bit in your post:
Please please please don't fall into the trap of trying to protect me from myself. If I run a command it's better to assume that I meant what I typed then changing the expected output in an effort to prevent me from shooting myself in the foot. If you really feel that you must be protective, add in confirmation warnings (with a command line /endrant/ :-) Thanks! |
Right, sorry... what I was trying to say there that supposing we were writing the feature for the first time, I'd probably recommend we do what the
I totally respect that viewpoint! But if we were to take it to it's logical conclusion we wouldn't have prefix matching at all and just return an error if the job ID didn't match exactly. Prefix matching is already a "do what I mean" behavior 😀 Fix is in PR #10648 |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
client:
(but is also a problem going as far back as 0.12.7 in my testing just now - although it was not a problem previously (see below))
Server:
Operating system and Environment details
Client - Arch Linux
Server - Debian Linux (10.9)
Issue
Since we added in namespaces that match our job names, we can no longer use the CLI to get status info or inspect jobs for jobs who's names are the prefix of other jobs.
To clarify:
Given a job name:
rec-service-stag
and a job name:
rec-service-stag-test
since we have added a namespace called
rec-service-stag
, the output of:nomad job status rec-service-stag
is the list of jobs that match that prefix:
Rather than the information about the
rec-service-stag
job.The output of
nomad status rec-service-stag
(without the wordjob
in the command line) is information about the namespace rather then the job. If we remove the namespace, we get an error (rather than information about the job):Expected Result
We used to get the status of the job that was explicitly named instead of it treating it like a prefix.
Actual Result
It treats the name as a prefix and gives us a list of jobs
Thanks!
The text was updated successfully, but these errors were encountered: