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.
This commit is contained in:
parent
ea7a08d05d
commit
8550c5607f
1 changed files with 2 additions and 2 deletions
|
@ -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, {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue