self = <swh.scheduler.tests.test_scheduler.TestScheduler object at 0x7f1e12665da0>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f1e12665a20>
def test_grab_ready_priority_tasks(self, swh_scheduler):
"""check the grab and peek priority tasks endpoint behave as expected"""
self._create_task_types(swh_scheduler)
t = utcnow()
task_type = TEMPLATES["git"]["type"]
num_tasks = 100
# Create tasks with and without priorities
tasks0 = tasks_with_priority_from_template(
TEMPLATES["git"], t, num_tasks, "high",
)
tasks1 = tasks_with_priority_from_template(
TEMPLATES["hg"], t, num_tasks, "low",
)
tasks2 = tasks_with_priority_from_template(
TEMPLATES["hg"], t, num_tasks, "normal",
)
tasks = tasks0 + tasks1 + tasks2
random.shuffle(tasks)
swh_scheduler.create_tasks(tasks)
ready_tasks = swh_scheduler.peek_ready_priority_tasks(task_type, num_tasks=50)
grabbed_tasks = swh_scheduler.grab_ready_priority_tasks(task_type, num_tasks=50)
for peeked, grabbed in zip(ready_tasks, grabbed_tasks):
assert peeked["status"] == "next_run_not_scheduled"
del peeked["status"]
assert grabbed["status"] == "next_run_scheduled"
del grabbed["status"]
> assert peeked == grabbed
E AssertionError: assert RealDictRow([...ty', 'high')]) == RealDictRow([...ty', 'high')])
E Omitting 5 identical items, use -vv to show
E Differing items:
E {'next_run': datetime.datetime(2021, 5, 6, 13, 52, 22, 671341, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None))} != {'next_run': datetime.datetime(2021, 5, 6, 13, 52, 22, 671387, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None))}
E {'id': 285} != {'id': 5}
E {'arguments': {'args': ['argument-099'], 'kwargs': {'kwarg099': 'bogus-kwarg'}}} != {'arguments': {'args': ['argument-053'], 'kwargs': {'kwarg053': 'bogus-kwarg'}}}
E Full diff:
E - RealDictRow([('id', 5),...
E
E ...Full output truncated (23 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_scheduler.py:277: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 6 2021, 3:52 PM