How i can stop nomad job with name "%NAME%-%ENVIRONMENT%-%VERSION%"?

41 views
Skip to first unread message

yuriy...@gmail.com

unread,
Feb 20, 2017, 10:40:17 AM2/20/17
to Nomad
How i can stop nomad job with name "%NAME%-%ENVIRONMENT%-%VERSION%"

Unfortunatelly command  'nomad stop %NAME%-%ENVIRONMENT%-%VERSION%'
doen't work in this case

Please help me

So, I've done the following:

1) I've created job.hcl
------------------
job "zabbix-ui-dev" {
  # Service type jobs optimize for long-lived services. This is
  # the default but we can change to batch for short-lived tasks.
  type = "service"
....
------------------

2) nomad validate job.hcl
Job validation successful

3) run this job in nomad.
# nomad run job.hcl
==> Monitoring evaluation "1d80ee97"
    
Evaluation triggered by job "%NAME%-%ENVIRONMENT%-%VERSION%"
    
Allocation "bd4c7b1f" created: node "1449a01e", group "zabbix-ui-dev-group"
    
Evaluation status changed: "pending" -> "complete"
==> 
Evaluation "1d80ee97" finished with status "complete"


4) get nomad status
# nomad status
ID                                           Type     Priority  Status
%NAME%-%ENVIRONMENT%-%VERSION%               service  50        running

5)  Try to stop this nomad job

---------------------------------------------------

[root@ip-192-168-15-111 ec2-user]# nomad stop %NAME%-%ENVIRONMENT%-%VERSION%
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x53add5]

goroutine 1 [running]:
panic(0xfbb780, 0xc4200100d0)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/hashicorp/nomad/api.(*Client).newRequest(0xc42018b480, 0x1127b6c, 0x3, 0xc420113a70, 0x26, 0x449fe7)
        /home/schmichael/go/src/github.com/hashicorp/nomad/api/api.go:387 +0x1e5
github.com/hashicorp/nomad/api.(*Client).query(0xc42018b480, 0xc420113a70, 0x26, 0x1013b60, 0xc42010e240, 0x0, 0x0, 0x0, 0x0)
        /home/schmichael/go/src/github.com/hashicorp/nomad/api/api.go:480 +0x7f
github.com/hashicorp/nomad/api.(*Jobs).Info(0xc420227b58, 0xc42012f940, 0x1e, 0x0, 0x1, 0x4, 0xc42012f820, 0x0)
        /home/schmichael/go/src/github.com/hashicorp/nomad/api/jobs.go:84 +0xd7
        /home/schmichael/go/src/github.com/hashicorp/nomad/command/stop.go:105 +0x7c6
main.RunCustom(0xc42000c130, 0x2, 0x2, 0xc420202540, 0x0)
        /home/schmichael/go/src/github.com/hashicorp/nomad/main.go:55 +0x7a1
main.Run(0xc42000c130, 0x2, 0x2, 0xc420000340)
        /home/schmichael/go/src/github.com/hashicorp/nomad/main.go:20 +0x56
main.main()
        /home/schmichael/go/src/github.com/hashicorp/nomad/main.go:16 +0x66


---------------------------------------------------

Also I've tried these command and get the same result:

#nomad stop "%NAME%-%ENVIRONMENT%-%VERSION%"
#nomad stop '%NAME%-%ENVIRONMENT%-%VERSION%'

Lowe Schmidt

unread,
Feb 20, 2017, 11:54:42 AM2/20/17
to yuriy...@gmail.com, Nomad
Have you tried quoting the jobname ?

something like nomad stop "%NAME%-%ENVIRONMENT%-%VERSION%" ?

--
Lowe Schmidt | +46 723 867 157

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/6d8205d8-d700-44e2-b4ea-b75c28477168%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

msch...@hashicorp.com

unread,
Feb 20, 2017, 3:04:20 PM2/20/17
to Nomad
Sorry you hit a panic! I've submitted a PR to at least return a sensible error instead: https://github.com/hashicorp/nomad/pull/2336

From the %XXX% style I assume you're on Windows. Can you try escaping the %s like:

nomad stop %%NAME%%-%%ENVIRONMENT%%-%%VERSION%%

It might be easier to use your favorite HTTP tool and use the HTTP API directly:

DELETE /v1/job/<ID>

yuriy...@gmail.com

unread,
Feb 21, 2017, 5:51:30 AM2/21/17
to Nomad
Hi guys,

Thank you very much for the quick reply.

1) I've already tried quoting the jobname
 Unfortunately it didn't help.
------------------------------------------
# nomad stop "%NAME%-%ENVIRONMENT%-%VERSION%"

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x53add5]

goroutine 1 [running]:
panic(0xfbb780, 0xc4200100d0)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/hashicorp/nomad/api.(*Client).newRequest(0xc4201ee100, 0x1127b6c, 0x3, 0xc420118630, 0x26, 0x449fe7)
        /home/schmichael/go/src/github.com/hashicorp/nomad/api/api.go:387 +0x1e5
github.com/hashicorp/nomad/api.(*Client).query(0xc4201ee100, 0xc420118630, 0x26, 0x1013b60, 0xc420240000, 0x0, 0x0, 0x0, 0x0)
        /home/schmichael/go/src/github.com/hashicorp/nomad/api/api.go:480 +0x7f
github.com/hashicorp/nomad/api.(*Jobs).Info(0xc42020fb58, 0xc42011e260, 0x1e, 0x0, 0x1, 0x4, 0xc42011e140, 0x0)
        /home/schmichael/go/src/github.com/hashicorp/nomad/api/jobs.go:84 +0xd7
        /home/schmichael/go/src/github.com/hashicorp/nomad/command/stop.go:105 +0x7c6
main.RunCustom(0xc42000c130, 0x2, 0x2, 0xc42018d7a0, 0x0)
        /home/schmichael/go/src/github.com/hashicorp/nomad/main.go:55 +0x7a1
main.Run(0xc42000c130, 0x2, 0x2, 0xc420000340)
        /home/schmichael/go/src/github.com/hashicorp/nomad/main.go:20 +0x56
main.main()
        /home/schmichael/go/src/github.com/hashicorp/nomad/main.go:16 +0x66

# nomad stop '%NAME%-%ENVIRONMENT%-%VERSION%'

I get the same error.

------------------------------------------------------------------------------------

2) I use OS "Amazon Linux AMI 2016.09"

3) I've tried escaping the %s like:

nomad stop %%NAME%%-%%ENVIRONMENT%%-%%VERSION%%


It didn't help unfortunately.
-----------------------------------------------------------------------------------
# nomad stop %%NAME%%-%%ENVIRONMENT%%-%%VERSION%%
No job(s) with prefix or id "%%NAME%%-%%ENVIRONMENT%%-%%VERSION%%" found
-----------------------------------------------------------------------------------

4) we have already tried to use DELETE API - https://www.nomadproject.io/docs/http/job.html#delete

I used these commands and I didn't help:


# netstat -lntp | grep nomad
tcp        0      0 :::4646                     :::*                        LISTEN      2394/nomad


Could you please clarify what exactly the ID number I should use if I want to stop this job(So, i used all ID below)?

# nomad run zabbixui_template_job.hcl
==> Monitoring evaluation "1d80ee97"

Evaluation triggered by job "%NAME%-%ENVIRONMENT%-%VERSION%"

Allocation "bd4c7b1f" created: node "1449a01e", group "zabbix-ui-dev-group"

Evaluation status changed: "pending" -> "complete"
==> Evaluation "1d80ee97"
finished with status "complete"

{"EvalID":"8470f910-8ee7-8c3d-fe02-487d54aa138e","EvalCreateIndex":453126,"JobModifyIndex":453125,"Index":453126,"LastContact":0,"KnownLeader":false}
{"EvalID":"fde032df-7ad6-db04-7a46-7fb155d3213d","EvalCreateIndex":453129,"JobModifyIndex":453128,"Index":453129,"LastContact":0,"KnownLeader":false}

Thank you in advance.

понедельник, 20 февраля 2017 г., 23:04:20 UTC+3 пользователь msch...@hashicorp.com написал:
Reply all
Reply to author
Forward
0 new messages