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

Commit

Permalink
received options are in dict not in class
Browse files Browse the repository at this point in the history
  • Loading branch information
badb committed Feb 24, 2019
1 parent 64d4d2a commit 0f1de69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion golem/task/taskkeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ def receive_subtask(self, task_to_compute: message.tasks.TaskToCompute):

self.subtask_to_task[subtask_id] = task_id
if task_to_compute.resources_options:
task_to_compute.resources_options.set(size=task_to_compute.size)
task_to_compute.resources_options['options']['size'] = \
task_to_compute.size
self.resources_options[subtask_id] = task_to_compute.resources_options
self.dump()
return True
Expand Down
14 changes: 8 additions & 6 deletions tests/golem/task/test_taskkeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
from golem.environments.environment import Environment, UnsupportReason,\
SupportStatus
from golem.environments.environmentsmanager import EnvironmentsManager
from golem.network.hyperdrive.client import HyperdriveClient, \
HyperdriveClientOptions
from golem.network.hyperdrive.client import HyperdriveClient
from golem.task import taskkeeper
from golem.task.taskkeeper import TaskHeaderKeeper, CompTaskKeeper, logger
from golem.testutils import PEP8MixIn
Expand Down Expand Up @@ -483,9 +482,11 @@ def _dump_some_tasks(self, tasks_dir):
size=1024
)
ttc.compute_task_def = ctd
ttc.resources_options = HyperdriveClientOptions(
HyperdriveClient.CLIENT_ID,
HyperdriveClient.VERSION)
ttc.resources_options = {
'client_id': HyperdriveClient.CLIENT_ID,
'version': HyperdriveClient.VERSION,
'options': {}
}
self.assertTrue(ctk.receive_subtask(ttc))
test_subtasks_ids.append(ctd['subtask_id'])
del ctk
Expand Down Expand Up @@ -688,4 +689,5 @@ def test_resources_options(self):
assert ctk.get_resources_options("unknown") is None
subtask_id = random.choice(list(ctk.subtask_to_task.keys()))
res = ctk.get_resources_options(subtask_id)
assert isinstance(res, HyperdriveClientOptions)
assert isinstance(res, dict)
assert res['client_id'] == HyperdriveClient.CLIENT_ID

0 comments on commit 0f1de69

Please sign in to comment.