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):