Skip to content

Commit

Permalink
Update imports and auto register tasks in worker.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AndPuQing committed Jan 28, 2024
1 parent 949b98e commit 26b46be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/app/app/source/ICLR.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.source import NIPS
from app.source.NIPS import NIPS


class ICLR(NIPS):
Expand Down
2 changes: 1 addition & 1 deletion backend/app/app/source/ICML.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.source import NIPS
from app.source.NIPS import NIPS


class ICML(NIPS):
Expand Down
3 changes: 1 addition & 2 deletions backend/app/app/source/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from app.source.Arxiv import Arxiv
from app.source.base import PaperRequestsTask
from app.source.ICLR import ICLR
from app.source.ICML import ICML
from app.source.NIPS import NIPS

__all__ = ["PaperRequestsTask", "NIPS", "ICLR", "ICML", "Arxiv"]
__all__ = ["NIPS", "ICLR", "ICML", "Arxiv"]
9 changes: 6 additions & 3 deletions backend/app/app/worker.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import inspect
from typing import Union

from celery import Task
from sqlmodel import Session

from app import source
from app.core.celery_app import celery_app
from app.source import NIPS, Arxiv

celery_app.register_task(NIPS())
celery_app.register_task(Arxiv())
members = inspect.getmembers(source, inspect.isclass)
for name, _class in members:
# auto register task
celery_app.register_task(_class)


def batch(iterable: Union[set[str], list[str]], n: int = 1):
Expand Down

0 comments on commit 26b46be

Please sign in to comment.