summaryrefslogtreecommitdiff
path: root/workers/workers.go
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2017-06-08 14:30:34 +0200
committerMaciej Wereski <m.wereski@partner.samsung.com>2017-09-20 11:43:41 +0200
commit46e1236e609298cc2cbd181c37cb7d2920664b00 (patch)
tree5f497cfa75b1638e7644c3a1c25e6a82f0e4536d /workers/workers.go
parent310e803740d2cadf35e42dfef2c4c8844a13c50d (diff)
downloadboruta-46e1236e609298cc2cbd181c37cb7d2920664b00.tar.gz
boruta-46e1236e609298cc2cbd181c37cb7d2920664b00.tar.bz2
boruta-46e1236e609298cc2cbd181c37cb7d2920664b00.zip
Implement state update after failure
When Worker detects malfunction of Dryad it informs Boruta server of failure and reason of it. Boruta will not dispatch any jobs to worker in the FAIL state. Only administrator is able to change the state. Change-Id: I7132193218974fa3b8eb7d97d07b98e4e45dced3 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49057 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
Diffstat (limited to 'workers/workers.go')
-rw-r--r--workers/workers.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/workers/workers.go b/workers/workers.go
index 25e405a..3c27582 100644
--- a/workers/workers.go
+++ b/workers/workers.go
@@ -62,8 +62,18 @@ func (wl *WorkerList) Register(caps Capabilities) error {
}
// SetFail is an implementation of SetFail from Superviser interface.
+//
+// TODO(amistewicz): WorkerList should process the reason and store it.
func (wl *WorkerList) SetFail(uuid WorkerUUID, reason string) error {
- return ErrNotImplemented
+ worker, ok := wl.workers[uuid]
+ if !ok {
+ return ErrWorkerNotFound
+ }
+ if worker.State == MAINTENANCE {
+ return ErrInMaintenance
+ }
+ worker.State = FAIL
+ return nil
}
// SetState is an implementation of SetState from Workers interface.