This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4278 from golemfactory/subtasks-restart-estimation
Implement subtasks restart cost estimation RPC
- Loading branch information
Showing
7 changed files
with
389 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
56 changes: 56 additions & 0 deletions
56
scripts/node_integration_tests/playbooks/golem/restart_failed_subtasks/playbook.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import time | ||
import typing | ||
|
||
from ...base import NodeTestPlaybook | ||
from ...test_config_base import NodeId | ||
|
||
|
||
class Playbook(NodeTestPlaybook): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.previous_task_id = None | ||
|
||
def step_restart_failed_subtasks(self): | ||
def on_success(result): | ||
print(f'Restarted failed subtasks.' | ||
f'task_id={self.previous_task_id}.') | ||
self.next() | ||
|
||
return self.call(NodeId.requestor, | ||
'comp.task.subtasks.restart', | ||
self.previous_task_id, | ||
[], | ||
on_success=on_success) | ||
|
||
def step_wait_task_timeout(self): | ||
def on_success(result): | ||
if result['status'] == 'Timeout': | ||
print("Task timed out as expected.") | ||
self.previous_task_id = self.task_id | ||
self.task_id = None | ||
self.next() | ||
elif result['status'] == 'Finished': | ||
print("Task finished unexpectedly, failing test :(") | ||
self.fail() | ||
else: | ||
print("Task status: {} ... ".format(result['status'])) | ||
time.sleep(10) | ||
|
||
return self.call(NodeId.requestor, 'comp.task', self.task_id, | ||
on_success=on_success) | ||
|
||
steps: typing.Tuple = NodeTestPlaybook.initial_steps + ( | ||
NodeTestPlaybook.step_create_task, | ||
NodeTestPlaybook.step_get_task_id, | ||
NodeTestPlaybook.step_get_task_status, | ||
step_wait_task_timeout, | ||
NodeTestPlaybook.step_stop_nodes, | ||
NodeTestPlaybook.step_restart_nodes, | ||
) + NodeTestPlaybook.initial_steps + ( | ||
NodeTestPlaybook.step_get_known_tasks, | ||
step_restart_failed_subtasks, | ||
NodeTestPlaybook.step_get_task_id, | ||
NodeTestPlaybook.step_get_task_status, | ||
NodeTestPlaybook.step_wait_task_finished, | ||
NodeTestPlaybook.step_verify_output, | ||
) |
25 changes: 25 additions & 0 deletions
25
scripts/node_integration_tests/playbooks/golem/restart_failed_subtasks/test_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from ...test_config_base import ( | ||
TestConfigBase, make_node_config_from_env, NodeId) | ||
|
||
|
||
class TestConfig(TestConfigBase): | ||
def __init__(self): | ||
super().__init__() | ||
provider_config = make_node_config_from_env(NodeId.provider.value, 0) | ||
provider_config.script = 'provider/cannot_compute' | ||
provider_config_2 = make_node_config_from_env(NodeId.provider.value, 0) | ||
|
||
requestor_config = make_node_config_from_env(NodeId.requestor.value, 1) | ||
requestor_config_2 = make_node_config_from_env( | ||
NodeId.requestor.value, 1) | ||
requestor_config_2.script = 'requestor/always_accept_provider' | ||
|
||
self.nodes[NodeId.requestor] = [ | ||
requestor_config, | ||
requestor_config_2, | ||
] | ||
|
||
self.nodes[NodeId.provider] = [ | ||
provider_config, | ||
provider_config_2 | ||
] |
1 change: 0 additions & 1 deletion
1
scripts/node_integration_tests/playbooks/golem/restart_frame/playbook.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from functools import partial | ||
import typing | ||
|
||
from ...base import NodeTestPlaybook | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.