From 8550c5607fcf9a2ac096d8baca18411b6f8941fe Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 12 Nov 2019 16:06:23 +0100 Subject: [PATCH] Register lister tasks even if they do not derive from SWHTask. This happens if swh.scheduler.celery_backend.config isn't imported before the CLI runs. --- swh/lister/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swh/lister/cli.py b/swh/lister/cli.py index 83c5c88..9894256 100644 --- a/swh/lister/cli.py +++ b/swh/lister/cli.py @@ -8,12 +8,12 @@ import logging from copy import deepcopy from importlib import import_module +import celery.app.task import click from sqlalchemy import create_engine from swh.core.cli import CONTEXT_SETTINGS from swh.scheduler import get_scheduler -from swh.scheduler.task import SWHTask from swh.lister import get_lister, SUPPORTED_LISTERS, LISTERS from swh.lister.core.models import initialize @@ -124,7 +124,7 @@ def register_task_types(ctx, listers): mod = import_module(task_module) for task_name in (x for x in dir(mod) if not x.startswith('_')): taskobj = getattr(mod, task_name) - if isinstance(taskobj, SWHTask): + if isinstance(taskobj, celery.app.task.Task): task_type = task_name.replace('_', '-') task_cfg = registry_entry.get('task_types', {}).get( task_type, {})