summaryrefslogtreecommitdiff
path: root/ick2/workapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'ick2/workapi.py')
-rw-r--r--ick2/workapi.py39
1 files changed, 12 insertions, 27 deletions
diff --git a/ick2/workapi.py b/ick2/workapi.py
index a2d76d9..c054f0a 100644
--- a/ick2/workapi.py
+++ b/ick2/workapi.py
@@ -134,21 +134,20 @@ class WorkAPI(ick2.APIbase):
if exit_code is not None:
if exit_code == 0:
- self._finish_action(graph, action_id, 'done')
- if self._build_finished(graph):
- self._finish_build(build, 0)
-
- worker.from_dict({
- 'worker': worker_id,
- 'doing': {},
- })
+ graph.set_action_status(action_id, 'done')
+ graph.unblock()
+ if not graph.has_more_to_do():
+ build_obj.set_status('done')
+ build['status'] = 0
elif exit_code is not None:
graph.set_action_status(action_id, 'failed')
- self._finish_build(build, exit_code)
- worker.from_dict({
- 'worker': worker_id,
- 'doing': {},
- })
+ build_obj.set_status('failed')
+ build['status'] = exit_code
+
+ worker.from_dict({
+ 'worker': worker_id,
+ 'doing': {},
+ })
def _check_work_update(self, doing, update): # pragma: no cover
must_match = ['worker', 'project', 'build_id']
@@ -167,20 +166,6 @@ class WorkAPI(ick2.APIbase):
text = update.get(stream, '')
log['log'] = log.get('log', '') + text
- def _finish_action(self, graph, action_id, status):
- graph.set_action_status(action_id, status)
- if status == 'done':
- graph.unblock()
-
- def _build_finished(self, graph):
- return (
- graph.find_actions('ready') == [] and
- graph.find_actions('blocked') == []
- )
-
- def _finish_build(self, build, exit_code):
- build['status'] = exit_code
-
def create(self, body, **kwargs): # pragma: no cover
pass