Skip to content
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

Running long tasks on heroku as a detached dyno #36

Open
hammady opened this issue Dec 9, 2016 · 1 comment
Open

Running long tasks on heroku as a detached dyno #36

hammady opened this issue Dec 9, 2016 · 1 comment

Comments

@hammady
Copy link

hammady commented Dec 9, 2016

When running long tasks on heroku as detached one-off dyno as in:
heroku run:detached rake ns:task
The terminal is not connected to the task and all output is sent to heroku logs. This is useful if you are expecting a task to take hours or days and you can't sit and wait for it.
With progress_bar enabled tasks (like sunspot:reindex) monitoring the progress is impossible as the bar will only appear at the end (concatenated in the same line). I think this is because there is no new line character sent until at the very end.
Is there a way to allow this detached mode throw the current progress every minute or a configurable percentage?

@hammady
Copy link
Author

hammady commented Dec 17, 2016

This is a workaround I'm doing now:

    pbar.increment!
    puts "\n#{Rake.application.top_level_tasks.first}: <put some descriptive language like the current processed item id>\n"

It will put a new line, forcing the progress bar (if any) to get printed, then leaves room for the next progress bar (if any).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant