update celery schedule and readme
This commit is contained in:
@@ -37,7 +37,10 @@ def start_sync_vehicle(
|
||||
persistence: PersistenceService = Depends(get_persistence),
|
||||
):
|
||||
"""Запустить задачу скрапинга одного автомобиля через Celery."""
|
||||
result = sync_vehicle_task.delay(body.vehicle_url, lane=body.lane)
|
||||
result = sync_vehicle_task.apply_async(
|
||||
kwargs={"vehicle_url": body.vehicle_url, "lane": body.lane},
|
||||
queue="scraping",
|
||||
)
|
||||
|
||||
# Регистрируем задачу в БД.
|
||||
persistence.create_scrape_task(
|
||||
@@ -59,12 +62,15 @@ def start_sync_listing(
|
||||
persistence: PersistenceService = Depends(get_persistence),
|
||||
):
|
||||
"""Запустить задачу полного цикла листинга через Celery."""
|
||||
result = sync_listing_task.delay(
|
||||
make=body.make,
|
||||
model=body.model,
|
||||
lane=body.lane,
|
||||
limit=body.limit,
|
||||
only_new=body.only_new,
|
||||
result = sync_listing_task.apply_async(
|
||||
kwargs={
|
||||
"make": body.make,
|
||||
"model": body.model,
|
||||
"lane": body.lane,
|
||||
"limit": body.limit,
|
||||
"only_new": body.only_new,
|
||||
},
|
||||
queue="scraping",
|
||||
)
|
||||
|
||||
persistence.create_scrape_task(
|
||||
|
||||
@@ -91,6 +91,7 @@ class CeleryConfig:
|
||||
task_time_limit: int = int(os.getenv("CELERY_TASK_TIME_LIMIT", "900"))
|
||||
worker_concurrency: int = int(os.getenv("CELERY_WORKER_CONCURRENCY", "1"))
|
||||
beat_sync_interval_minutes: int = int(os.getenv("CELERY_BEAT_SYNC_INTERVAL_MINUTES", "60"))
|
||||
beat_sync_limit: int = int(os.getenv("CELERY_BEAT_SYNC_LIMIT", "26"))
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
|
||||
@@ -45,6 +45,7 @@ celery_app.conf.update(
|
||||
"task": "iaai_scraper.worker.tasks.sync_listing_task",
|
||||
"schedule": settings.celery.beat_sync_interval_minutes * 60.0,
|
||||
"args": (),
|
||||
"kwargs": {"limit": settings.celery.beat_sync_limit},
|
||||
"options": {"queue": "scraping"},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user