Code Monkey home page Code Monkey logo

Comments (7)

czue avatar czue commented on July 22, 2024

Interesting use case! I haven't had to solve this on any of my own projects, but I certainly can see the value of it. Off the top of my head it's unclear to me whether something like that would belong in this lib or as a standalone thing, though happy to review any suggestions you have. (also keen to hear if any other maintainers have thoughts).

How would you be identifying/looking up the jobs? With the User who created them? I could definitely imagine a small model that just associated User objects with the task_id and maybe some extra metadata that you could then use to show a list of jobs.

from celery-progress.

eeintech avatar eeintech commented on July 22, 2024

How would you be identifying/looking up the jobs? With the User who created them? I could definitely imagine a small model that just associated User objects with the task_id and maybe some extra metadata that you could then use to show a list of jobs.

If you are using Django, someone has created an extension to link Celery tasks to Model instances and monitor their status:
https://github.com/mback2k/django-celery-model

Using it with a User based model sounds like a great idea.

from celery-progress.

OmarWKH avatar OmarWKH commented on July 22, 2024

I also considered giving the task a deterministic custom id that you can re-generate when needed. But I think keeping track of ids is a better solution.

from celery-progress.

jjrugui avatar jjrugui commented on July 22, 2024

@czue that is exactly the initial idea I had. A simple model that just links task_id with User and potentially status so it can also be used to track history of tasks for each user. This would also allow to query an endpoint to retrieve unfinished non-failed tasks.

Also agree that I don't know if it belongs here or somewhere else, I love the simplicity of this project but I also feel that such simple model would not add complexity to it and could be elegant :)

I'll probably take a look at how to deal with it during the weekend. In the meantime I'll also hear comments from other maintainers

from celery-progress.

jjrugui avatar jjrugui commented on July 22, 2024

@eeintech I'll take a look at the project you mentioned later tonight to see if it fits what I'm after. Yes, I'm using celery-progress with Django.

from celery-progress.

jjrugui avatar jjrugui commented on July 22, 2024

@czue sorry for late reply, it's been a couple busy weeks.

My plan was to create a simple table and create a new recorder that is capable of writing to a simple table. This couple links I'm providing here are temporary commits (had to move computers and needed the code) so it's far from clean or done but you get the idea :)

Backend adds a new recorder class inheriting from ProgressRecorder. Same way, a simple table adds a relation between the user and the task id and potentially more info to differentiate between tasks in the project. Finally, I'm guessing a small view function that returns tasks for a given user (I have some placeholder code but haven't used it).

I need to fix it a bit since it's more kind of a concept at this point but let me know if you think something like this could be interesting!

from celery-progress.

OmarWKH avatar OmarWKH commented on July 22, 2024

Note that the task is not owned by the user in all projects. It could be owned by a different model.

I think persistent job tracking should be done by another library or implemented by each project that needs it.

from celery-progress.

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.