From b63497032d874a5202e993637ab3b429d5917c7f Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sun, 6 Jun 2021 22:39:24 +0200 Subject: [PATCH] allocation: send signal --- nomad/api/client.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nomad/api/client.py b/nomad/api/client.py index 4178f57..ebee2fa 100644 --- a/nomad/api/client.py +++ b/nomad/api/client.py @@ -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):