Skip to content
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

Add Node Name to the output of nomad job status (verbose only) and nomad alloc status #5224

Merged
merged 4 commits into from
Jan 23, 2019

Conversation

arshjohar
Copy link
Contributor

@arshjohar arshjohar commented Jan 22, 2019

Building on the work done by @jrasell in #4516 .

Closes #2359
Closes #1180
Closes #4516

The plan is to merge this into 0.9.1-dev, which I just checked out from the tip of master at this point in time. Changes to 0.9.1-dev will be merged into master, only after 0.9.0 is released.

Relevant snippets from the output:

➜  nomad git:(jrasell-gh_2359) nomad job status -verbose example
Allocations
ID                                    Eval ID                               Node ID                               Node Name                     Task Group  Version  Desired  Status   Created                    Modified
f1cd3043-eb56-d533-5d9b-7e93b66195b6  4f2feeb6-ba25-b451-11eb-168f0b49102a  fc3a8aa9-95b2-1c16-5ab0-f53be2d887fa  Arshneets-MBP.hitronhub.home  cache       0        run      running  2019-01-22T13:52:30-08:00  2019-01-22T13:52:31-08:00
➜  nomad git:(jrasell-gh_2359) nomad alloc status f1cd3043  
ID                  = f1cd3043
Eval ID             = 4f2feeb6
Name                = example.cache[0]
Node ID             = fc3a8aa9
Node Name           = Arshneets-MBP.hitronhub.home
Job ID              = example
Job Version         = 0
Client Status       = running
Client Description  = Tasks are running
Desired Status      = run
Desired Description = <none>
Created             = 2m11s ago
Modified            = 2m10s ago
Deployment ID       = 954801b1
Deployment Health   = unset

jrasell and others added 3 commits July 17, 2018 11:03
Currently when operators need to log onto a machine where an alloc
is running they will need to perform both an alloc/job status
call and then a call to discover the node name from the node list.

This updates both the job status and alloc status output to include
the node name within the information to make operator use easier.

Closes #2359
Cloess #1180
@hashicorp-cla
Copy link

hashicorp-cla commented Jan 22, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@endocrimes endocrimes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm after removing the duplicate assertion - nice work! I wouldn't block on switching to require, but it would be a nice improvement.

I think we do need you and @jrasell to sign the CLA before we can merge this though.

@@ -141,6 +143,16 @@ func TestAllocStatusCommand_Run(t *testing.T) {
t.Fatalf("expected to have 'Modified' but saw: %s", out)
}

if !strings.Contains(out, "Modified") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks for pointing it out.

t.Fatalf("expected to have 'Modified' but saw: %s", out)
}

nodeNameRegexpStr := fmt.Sprintf(`\nNode Name\s+= %s\n`, regexp.QuoteMeta(nodeName))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you migrate this test to using require, you can use require.Regexp(regexp.MustCompile(regexpStr), out), which provides a nicer error message here. (example in this test:

require.Contains(out, "Replacement Alloc ID")
require.Regexp(regexp.MustCompile(".*Reschedule Attempts\\s*=\\s*1/2"), out)
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@arshjohar arshjohar merged commit ffd82df into 0.9.1-dev Jan 23, 2019
@arshjohar arshjohar deleted the jrasell-gh_2359 branch January 23, 2019 18:29
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants