Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

How to push Celery tasks with Ruby

$
0
0

In our app we have a Rails app that makes an API call to a Flask API. The API then schedules a task, and we are using Redis as the queue.

@app.route("/api/article", methods=["POST"])def api_article():    app.logger.info("[route] /api/article")     .     .    res_id = celery.send_task("tasks.text_stats", args=[article], kwargs={}).id
@celery.task(name="tasks.text_stats")def text_stats(article):    logger.info("text_stats")

What I am thinking is if the Redis database is accessible to both Rails and Flask, we could just create the task directly in Redis, which would then be picked up by the Celery worker.

Questions:

  1. How to create a Celery job in Redis using Ruby?
  2. Are there any Ruby libraries which would support this?

Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>