6

Is there a way to use Celery for:

  1. Queue a HTTP call to external URL with Form parameters (HTTP Post to URL)
  2. The external URL will respond HTTP response, 200, 404, 400 etc, if response is in form of error non-200-ish response it will retry for a certain number of retry and will retire as needed
  3. Add Task / Job / Work queue into Celery using REST API, passing the URL to call and Form parameters

3 Answers 3

4
  1. For that you need to create a task in your celery application that would perform that request for you and return the result.
  2. Handling the errors and retries can be done within the code of your task, or can alternatively be taken care by celery if you schedule the task with the right arguments: see the arguments of .apply_async()
  3. You can schedule new tasks via REST API if you run Celery Flower. It has a REST API (see documentation), in particular a POST endpoint to schedule a task.
Sign up to request clarification or add additional context in comments.

Comments

2

Yes, create an I/O class that handle your http requests and process.
Read about celery tasks and remember to set connect_timeout= 5.0, read_timeout = 30.0 timeouts to your I/O ops to not block your workers.

There is a precise example of using requests in the celery worker tasks.

Comments

2

you can use flower rest API to do the same, as flower is a monitoring tool for celery. But it comes with rest api to add task and all

https://flower.readthedocs.io/en/latest/index.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.