Need help setting progress reports with the shell plugin #758
-
Hi, first of all, this project is absolutely amazing and i'm really mad i just found out about it by accident this week.. I'm trying to setup progress reports with python but it just won't read and update the values in the UI, tried both the json and the shorthand.. Here's a simple test script
ran it from the shell plugin:
Logs doesn't show until the end of the execution, neither the progress is reported.. i've enabled the "interpret json in output" in the task settings, the task runs fine. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi there! Thank you for using Cronicle! Okay, so you have two problems here: First, Python buffers all output by default (it only actually sends STDOUT in batches at intervals), which we absolutely do NOT want in this case. We want it to output EVERY line as you print it. So you need to disable output auto-buffering. There are several methods to do this. The easiest way is to just add the python -u your_script.py The second problem is, if you want to send progress updates from the Shell Plugin, you need to format the output exactly right. Specifically, you need a percent symbol ( I am no Python expert by any means, but it looks like your progress numbers will be between 0 and 1, so you need to multiply that final number by 100, and then you need to append a
...and so on. Alternatively, if you check the "Interpret JSON in Output" checkbox in your event using the Shell Plugin, you can output NDJSON to report progress updates that way. See docs here for details. I am not sure how to do this in Python, sorry. Good luck! |
Beta Was this translation helpful? Give feedback.
Hi there! Thank you for using Cronicle!
Okay, so you have two problems here:
First, Python buffers all output by default (it only actually sends STDOUT in batches at intervals), which we absolutely do NOT want in this case. We want it to output EVERY line as you print it. So you need to disable output auto-buffering. There are several methods to do this. The easiest way is to just add the
-u
flag to Python when you run your script:The second problem is, if you want to send progress updates from the Shell Plugin, you need to format the output exactly right. Specifically, you need a percent symbol (
%
) after the number, and you need to format your number as a percen…