Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge branch 'b0.22' into fix/macos-openssl-path
Browse files Browse the repository at this point in the history
  • Loading branch information
kmazurek authored Jan 29, 2020
2 parents 48658ca + 3dc2e01 commit a7c4057
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion golem/task/taskmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ def task_computation_cancelled(
ban_node = subtask_state.time_started + timeout < time.time()
return self.task_computation_failure(
subtask_id,
f'Task computation rejected: {err.value}',
f'Task computation rejected: {err.value if err else "unknown"}',
ban_node,
)

Expand Down
23 changes: 22 additions & 1 deletion tests/golem/task/test_taskmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,11 +747,32 @@ def test_task_computation_cancelled_offer_cancelled(self, *_):
)
task_mock.computation_failed.assert_not_called()
self.assertIs(
self.tm.tasks_states[task_mock.header.task_id]\
self.tm.tasks_states[task_mock.header.task_id]
.subtask_states[subtask_id].status,
SubtaskStatus.cancelled,
)

@patch('golem.task.taskmanager.TaskManager.dump_task')
@patch('golem.task.taskmanager.TaskManager.task_computation_failure')
def test_task_computation_cancelled_unknown_reason(self, failure_mock, *_):
reason = None
subtask_id = "aabbcc"
task_mock = self._get_task_mock()
self.tm.add_new_task(task_mock)
self.tm.start_task(task_mock.header.task_id)
task_mock.query_extra_data_return_value.ctd['subtask_id'] = subtask_id
self.tm.get_next_subtask("NODE", "xyz", 1000, 100, 'oh')
self.tm.task_computation_cancelled(
subtask_id,
reason,
timeout=1000,
)
failure_mock.assert_called_once_with(
subtask_id,
'Task computation rejected: unknown',
False,
)

@patch('golem.task.taskbase.Task.needs_computation', return_value=True)
def test_get_subtasks(self, *_):
assert self.tm.get_subtasks("Task 1") is None
Expand Down

0 comments on commit a7c4057

Please sign in to comment.