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

Cron job errors out when running SNODASDaily_Automated.py script #38

Open
Nightsphere opened this issue Nov 10, 2021 · 6 comments
Open
Assignees
Labels
bug critical Priority: highest priority S Size: day or less

Comments

@Nightsphere
Copy link
Collaborator

The automated script runs correctly when manually run on command line, but when the cron job runs the same script,
what I believe to be a X Windows error displays:

image

@Nightsphere Nightsphere added bug critical Priority: highest priority S Size: day or less labels Nov 10, 2021
@Nightsphere Nightsphere self-assigned this Nov 10, 2021
@smalers
Copy link
Contributor

smalers commented Nov 10, 2021

@smalers
Copy link
Contributor

smalers commented Nov 10, 2021

Also, I ran into the same thing with GeoProcessor and the run script sets DISPLAY. I don't remember if I tried to run headless but the point is that if a self-contained run script is used, it can make sure that necessary setup is done in various environments.

@Nightsphere
Copy link
Collaborator Author

The DISPLAY env variable cannot be seen by cron when run from a user account instead of root. It needs to be set before the cron script is called:

* * * * * export DISPLAY=<full-display-name> && /path/to/script.bash

Closing the issue.

@smalers
Copy link
Contributor

smalers commented Nov 11, 2021

This is helpful for understanding places where DISPLAY might be getting set by the system:

https://stackoverflow.com/questions/52041092/setting-environment-variable-for-a-compute-engine-vm

@smalers
Copy link
Contributor

smalers commented Nov 12, 2021

It looks like it did not run again today. I still would like to understand why DISPLAY is so finicky. Here are some other ideas:

If it is necessary to do this, then I recommend updating the application to accept a command line parameter such as --noui (no UI) or similar. This can be used when running in headless mode. I searched GeoProcessor for something like this but don't see anything. I remember looking into it but perhaps there has not been a need to run the GeoProcessor headless.

@Nightsphere
Copy link
Collaborator Author

The issue was finally resolved. QT was trying to run GUI based code in a headless server. The original error up above gave possible plugins to use instead. One of these options is offscreen, which renders to an offscreen buffer. This is the fix that we've been looking for. When cron runs the SNODASDaily_Automated._forCRON.sh script, it sets the QT_QPA_PLATFORM environment variable before it runs the SNODASDaily_Automated.py python module.

The DISPLAY environment variable might not even need to be set, but I will update this issue once more after tests have been run, and will close the issue if correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug critical Priority: highest priority S Size: day or less
Projects
None yet
Development

No branches or pull requests

2 participants