diff --git a/debian/control b/debian/control index 6b27958..bc95993 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 9), python3-setuptools, python3-sqlalchemy (>= 1.0), python3-swh.core, - python3-swh.scheduler (>= 0.0.30~), + python3-swh.scheduler (>= 0.0.31~), python3-swh.storage, python3-swh.storage.schemata, python3-testing.postgresql, @@ -23,7 +23,7 @@ Homepage: https://forge.softwareheritage.org/source/swh-lister/ Package: python3-swh.lister Architecture: all -Depends: python3-swh.scheduler (>= 0.0.30~), +Depends: python3-swh.scheduler (>= 0.0.31~), ${misc:Depends}, ${python3:Depends} Breaks: python3-swh.lister.github diff --git a/requirements-swh.txt b/requirements-swh.txt index e4f6ba1..e1ba1af 100644 --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,3 +1,3 @@ swh.core swh.storage[schemata] >= 0.0.76 -swh.scheduler >= 0.0.30 +swh.scheduler >= 0.0.31 diff --git a/swh/lister/core/lister_base.py b/swh/lister/core/lister_base.py index 46ad64d..60074dd 100644 --- a/swh/lister/core/lister_base.py +++ b/swh/lister/core/lister_base.py @@ -14,7 +14,7 @@ from sqlalchemy import create_engine, func from sqlalchemy.orm import sessionmaker from swh.core import config -from swh.scheduler import get_scheduler +from swh.scheduler import get_scheduler, utils from swh.storage import get_storage from .abstractattribute import AbstractAttribute @@ -392,7 +392,7 @@ class SWHListerBase(abc.ABC, config.SWHConfig): 'url': origin_url, } - def task_dict(self, origin_type, origin_url): + def task_dict(self, origin_type, origin_url, **kwargs): """Return special dict format for the tasks list Args: @@ -401,16 +401,9 @@ class SWHListerBase(abc.ABC, config.SWHConfig): Returns: the same information in a different form """ - return { - 'type': 'origin-update-%s' % origin_type, - 'arguments': { - 'args': [ - origin_url, - ], - 'kwargs': {}, - }, - 'next_run': utcnow(), - } + _type = 'origin-update-%s' % origin_type + _policy = 'recurring' + return utils.create_task_dict(_type, _policy, origin_url) def string_pattern_check(self, a, b, c=None): """When comparing indexable types in is_within_bounds, complex strings @@ -473,7 +466,7 @@ class SWHListerBase(abc.ABC, config.SWHConfig): ) if not ir.task_id: ir.task_id = self.scheduler.create_tasks( - [self.task_dict(m['origin_type'], m['origin_url'])] + [self.task_dict(**m)] )[0]['id'] def ingest_data(self, identifier, checks=False):