Skip to content

Commit

Permalink
Create API endpoint to schedule the ping-farms task. Closes farmOS#45
Browse files Browse the repository at this point in the history
  • Loading branch information
paul121 committed Nov 25, 2019
1 parent 3fdc07a commit 976aad9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/app/app/api/api_v1/endpoints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
router = APIRouter()


@router.post("/test-celery/", response_model=Msg, status_code=201)
def test_celery(
msg: Msg, current_user: UserInDB = Depends(get_current_active_superuser)
@router.post("/ping-farms/", response_model=Msg, status_code=201)
def ping_farms(
current_user: UserInDB = Depends(get_current_active_superuser)
):
"""
Test Celery worker.
Ping all farms.
"""
celery_app.send_task("app.worker.test_celery", args=[msg.msg])
return {"msg": "Word received"}
celery_app.send_task("app.worker.ping_farms")
return {"msg": "Task created. Check farm last_updated values."}


@router.post("/test-email/", response_model=Msg, status_code=201)
Expand Down

0 comments on commit 976aad9

Please sign in to comment.