Loading bar or simple message while script is running

Hi guys,

I’m running custom Python script from deadline. This script is collecting some data from ShotGrid, then depends on user selection and some conditions is creating jobs on Deadline.
Right now everything works fine, just whole Deadline Monitor freeze for a while till script is running and user has no information if the script is running or is already done… . So i would like to show maybe loading bar, or at least simple window with message like “Hey, I’m your script and I’m still running.”

I have tried the window with message using Deadline scripting dialog but this window is waiting to user action - the script is waiting for this window to be close, then will continue. So i played with PyQt5, this was better but showed me just white, empty window.
Last thing i tried was tkinter - this works very well in my IDE but on Deadline it throw error like “Tkinter was probaly installed incorrectly.” - same error on multiple machines and Deadline re-installation doesn’t help, i found some solution on stackoverflow but i thing it’s unnecessarily complicated, since it must be done on all machines.

Does anyone have similar issue ? I’m running out of ideas …

@marek.bires I do not know how to make UIs with Python yet :slight_smile: so I cannot offer help there.

During that freeze, do monitor logs say something?

What if you log messages in the same script and those will be written on either Console or the application which runs the script?

@zainali - Thanks for reply. I think that freeze is normal when any script is running. This script specifically is waiting for respond from Shotgrid - first freeze, then generating Deadline jobs - second freeze. I wanna solve it with running that script in separate thread but I’m still working on this :slight_smile:

Bigger issue is to let user know what is going on :smiley: imagine that it will generate like 40 jobs - it will take a while …

Hey Marek!

I tihnk you’re hitting problems with CPython’s threading limitations. My best idea is to shell out to DeadlineCommand to run these scripts if you can.

deadlinecommand ExecuteScript /path/to/something.py

This will prevent the Monitor locking. Most of the API will available in that mode but you’ll have to get creative on sending data to the script. Arguments should work but I haven’t done it. Likely you’ll have to clean them up because there are more args that Python would normally expect (“ExecuteScript”).

We do this with the Pipeline Integrations. You can find some examples in the submitters, just look for calls out to things in the Repo’s “[repo]/Submission/Integration” folder.

2 Likes

Hey @eamsler,

What is the difference when running script with deadlinecommand ExecuteScript and placing it in [repo]/custom/scripts/Submission and running from Deadline ‘Submit’ menu? Right now it has the same behavior for me, but i will need to play with it a bit more.

I also found this post about Progress bar as GUI element for Python, do you ahve guys any update about it ?

https://forums.thinkboxsoftware.com/t/python-ui-element-progress-bar/2279?u=marek.bires

Running it in DeadlineCommand opens it in a new CPython interpreter so it will skip any thread deadlocks caused by the global interpreter lock.

And that other thread, I don’t expect that’s going to be prioritized. The good news is that our API is a thin wrapper around PyQt these days so you can make use of any controls in there.

1 Like