asynq icon indicating copy to clipboard operation
asynq copied to clipboard

[FEATURE REQUEST] Report progress on tasks

Open scriptcoded opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. When executing long running tasks such as backups and downloads it can be hard to know if a task is just taking its time or if it's stuck.

Describe the solution you'd like The ability to report progress in a task handler. Either a simple number, like t.UpdateProgress(0.4) or if possible even a log like t.LogWriter().Write([]byte("Dumped 11/54 tables")).

Describe alternatives you've considered Maybe using the ResultWriter could be an alterantive, but if I've understood it correctly it's primarily used for reporting the final result of the task.

Additional context ~Add any other context or screenshots about the feature request here.~

scriptcoded avatar Jul 24 '23 09:07 scriptcoded

@scriptcoded I think this would be a nice enhancement. We probably need to make some change in the web UI as well.

hibiken avatar Jul 30 '23 04:07 hibiken

@hibiken Nice to hear. Having thought about it a little more I think that implementing the single number progress indicator is the more reasonable approach.

Firstly, it's an easy way to be able to read and make decisions about the value through code, unlike a log that would (most likely) require a lot more than a t.progress > 0.5 to parse.

Secondly, is it within the scope for asynq to handle logs and such? If there is a case that cannot be solved using just the progress value and dumping the logs in the result after the task is done, then maybe it's also worth the effort for the developer to implement separate log ingestion for that specific use case. Using such an architecture would also allow for much more functionality when it comes to actually searching those logs than asynq will probably ever be able to provide (while staying in scope).

What are your thoughts?

scriptcoded avatar Aug 01 '23 07:08 scriptcoded