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

Remove compatibility check based on app version #3841

Merged
merged 5 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions golem/task/taskkeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
from golem_messages.datastructures import p2p as dt_p2p
from golem_messages.datastructures import tasks as dt_tasks

import golem
from golem import constants as gconst
from golem import utils
from golem.core import common
from golem.core import golem_async
from golem.core.variables import NUM_OF_RES_TRANSFERS_NEEDED_FOR_VER
Expand Down Expand Up @@ -346,7 +343,6 @@ def check_support(self, header: dt_tasks.TaskHeader) -> SupportStatus:
supported = self.check_environment(header.environment)
supported = supported.join(self.check_mask(header))
supported = supported.join(self.check_price(header))
supported = supported.join(self.check_version(header))
if not supported.is_ok():
logger.info("Unsupported task %s, reason: %r",
header.task_id, supported.desc)
Expand Down Expand Up @@ -384,31 +380,6 @@ def check_price(self, header: dt_tasks.TaskHeader) -> SupportStatus:
return SupportStatus.err(
{UnsupportReason.MAX_PRICE: max_price})

@classmethod
def check_version(cls, header: dt_tasks.TaskHeader) -> SupportStatus:
"""Check if this node has a version that isn't less than minimum
version described in task header.
:return SupportStatus: err() if node's version is lower than minimum
version for this task, False otherwise.
"""
min_v = getattr(header, "min_version", None)

ok = False
try:
ok = utils.is_version_compatible(
theirs=min_v,
spec=gconst.GOLEM_SPEC,
)
except ValueError:
logger.error(
"Wrong app version - app version %r, required version %r",
golem.__version__,
min_v
)
if ok:
return SupportStatus.ok()
return SupportStatus.err({UnsupportReason.APP_VERSION: min_v})

def get_support_status(self, task_id) -> typing.Optional[SupportStatus]:
"""Return SupportStatus stating if and why the task is supported or not.
:param task_id: id of the task
Expand Down
21 changes: 0 additions & 21 deletions tests/golem/task/test_taskkeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ def test_is_supported(self):
self.assertFalse(supported)
self.assertIn(UnsupportReason.MAX_PRICE, supported.desc)

header.max_price = 10.0
supported = tk.check_support(header)
self.assertFalse(supported)
self.assertIn(UnsupportReason.APP_VERSION, supported.desc)

header.min_version = golem.__version__
self.assertTrue(tk.check_support(header))

header.max_price = 10.0
self.assertTrue(tk.check_support(header))

Expand All @@ -94,15 +86,6 @@ def test_is_supported(self):
tk.change_config(config_desc)
self.assertTrue(tk.check_support(header))

header.min_version = "120.0.0"
self.assertFalse(tk.check_support(header))

header.min_version = golem.__version__
self.assertTrue(tk.check_support(header))

header.min_version = "abc"
self.assertFalse(tk.check_support(header))

@mock.patch('golem.task.taskarchiver.TaskArchiver')
def test_change_config(self, tar):
tk = TaskHeaderKeeper(
Expand Down Expand Up @@ -387,10 +370,6 @@ def test_get_unsupport_reasons(self):
tk.add_task_header(thd)

reasons = tk.get_unsupport_reasons()
# 3 tasks with wrong version
self.assertIn({'avg': golem.__version__,
'reason': 'app_version',
'ntasks': 3}, reasons)
# 2 tasks with wrong price
self.assertIn({'avg': 7, 'reason': 'max_price', 'ntasks': 2}, reasons)
# 1 task with wrong environment
Expand Down