Skip to content

Commit

Permalink
allocation: send signal
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Jun 6, 2021
1 parent 8c41f30 commit b634970
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nomad/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,25 @@ def restart_allocation(self, id):
"""
return self.request(id, "restart", method="post").json()

def signal_allocation(self, id, signal, task=None):
""" Sends a signal to an allocation or task.
https://www.nomadproject.io/api-docs/allocations#signal-allocation
arguments:
- id
- signal (str)
optional_arguments:
- task: (str) Optional, if omitted, the signal will be sent to all tasks in the allocation.
returns: dict
raises:
- nomad.api.exceptions.BaseNomadException
- nomad.api.exceptions.URLNotFoundNomadException
"""
dispatch_json = {"Signal": signal, "Task": task}
return self.request(id, "signal", json=dispatch_json, method="post").json()


class gc_allocation(Requester):

Expand Down

0 comments on commit b634970

Please sign in to comment.