Giter Club home page Giter Club logo

Comments (4)

frol avatar frol commented on June 20, 2024

I design my services so every piece of data is owned by only one application. This means that either scheduled tasks own their own data in their own DB (well, the DB server can be shared, but services use separate databases), OR scheduled tasks make queries to the API server, OR introduce a separate "internal" API service, so the public API server and the scheduled tasks operate via this internal API service.

I have had the experience implementing API server and scheduled tasks in a single code base, and, mind you, you don't want to make that mistake; that goes cumbersome really quickly especially with Celery [I also strongly recommend avoid Celery; take a look at Dramatiq or Kuyruk].

I usually go with the second option (a single API server completely owns the data, and I make regular API calls from the scheduled tasks using an "internal" role for that).

P.S. I close this issue to mark it as answered, but feel free to leave your comments, and let us discuss the topic if necessary.

from flask-restplus-server-example.

0xecute avatar 0xecute commented on June 20, 2024

Thanks for the quick answer
I use Celery because I need to schedule tasks every 15 minutes, and to have a simple dashboard (flower does it perfectly) to know if a task has failed etc... I m not sure Kuyruk does this, it looks more like a distributed task manager. Right?

Having an "internal" API service may be an acceptable solution, I think I will go for it.

THank you

from flask-restplus-server-example.

frol avatar frol commented on June 20, 2024

it looks more like a distributed task manager. Right?

You are right. It is just like Celery in that respect. If you are just running some regular tasks, you may just as well run a thread inside your Flask application and do the job using something like https://github.com/dbader/schedule.

from flask-restplus-server-example.

0xecute avatar 0xecute commented on June 20, 2024

Thanks for the advice.
I don't think it is good to mix businesses. Schedule job has nothing to do on a web Rest API for me and should be done aside.
But as you said, I will call the "internal" api from celery. And thanks to flower I will have all my tasks status and logs accessible easily.

Thank you for the help.

from flask-restplus-server-example.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.