New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track status of a task #93

Closed
MaxRichter opened this Issue Jun 11, 2018 · 3 comments

Comments

3 participants
@MaxRichter

MaxRichter commented Jun 11, 2018

Hi,

first of all, great library, easy to understand and fast.

I came across the issue, that I was looking for a status of a task. So far I did not see this feature in the documentation, but you linked a database solution in your [https://github.com/Bogdanp/flask_dramatiq_example](flask example ).

Is it also possible to track the task status in the broker and/or backend?

Further, is it possible to distinguish between an existing task in the backend and non-existing one?
I would expect some error for a task that does not exist and a status for an existing task.

Best,
Max

@dmitry-vakhnenko

This comment has been minimized.

dmitry-vakhnenko commented Jun 15, 2018

Hello! I love this library too!

For tracking statuses (success/error) you can follow this instruction:

https://dramatiq.io/cookbook.html#error-reporting

More info about it you can find here:

https://dramatiq.io/reference.html#middleware

So, in basic cases maybe you need:

https://dramatiq.io/reference.html#results
or
https://dramatiq.io/cookbook.html#callbacks

Further, is it possible to distinguish between an existing task in the backend and non-existing one?

hm, middleware?

@MaxRichter

This comment has been minimized.

MaxRichter commented Jun 18, 2018

Hi @dmitry-vakhnenko,

thank you for the hints and tried some of them, especially the results but I am still not happy with my result.

Let me describe you how what I want to achieve:

  1. I sent a Message via an Actor with message = add.send(1, 2) - from there I get back an message_id from the broker
  2. I want to store this message_id e.g. in a MySQL database before it is accessible with message.get_result(backend=backend) --> Here I do not know if any of the Middleware functions are of any help for this use case
  3. If 1 and 2 are in place, I can distinguish between an existing message/task and a non-existing one, by querying the database.
  4. Further I can update the status of the message/task in the database over the time of the process.
@Bogdanp

This comment has been minimized.

Owner

Bogdanp commented Jun 19, 2018

@MaxRichter since this is essentially a question, would you mind moving the discussion over to the forum at https://discuss.dramatiq.io?

To answer your question, though, this is possible via middleware. You can check out the AdminMiddleware in django_dramatiq for an example.

@Bogdanp Bogdanp closed this Jun 19, 2018

@Bogdanp Bogdanp added the question label Jun 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment