Closed juanfrilla closed 1 year ago
I was wondering the same thing. I have a python script in which I call sys.exit() in specific conditions which would be failures. But the Cronicle job thinks it is successful as it doesn't pick up the break/sys.exit as an error. @jhuckaby is there something we need to send to the shell script plugin to signify an error failure so it's picked up by the job?
If you are using a custom Plugin, then you have to tell Cronicle if the job succeeded or failed using JSON. Instructions here:
https://github.com/jhuckaby/Cronicle/blob/master/docs/Plugins.md#json-output
However, if you are using the built-in Shell Plugin, then the last command's exit code dictates the job success/fail status.
https://github.com/jhuckaby/Cronicle/blob/master/docs/Plugins.md#built-in-shell-plugin
If you are using a custom Plugin, then you have to tell Cronicle if the job succeeded or failed using JSON. Instructions here:
https://github.com/jhuckaby/Cronicle/blob/master/docs/Plugins.md#json-output
However, if you are using the built-in Shell Plugin, then the last command's exit code dictates the job success/fail status.
https://github.com/jhuckaby/Cronicle/blob/master/docs/Plugins.md#built-in-shell-plugin
Thanks @jhuckaby that really helps. I could find that documentation when searching. So as long as the script exits with a status of not "0" then it should be seen as a failure. So @juanfrilla when you exit just exit with sys.exit(1) or some custom message that doesn't translate to "0".
Thanks @jhuckaby , you answer was really useful for me. And thanks @mrkcmo, i'll try to do that.
Summary
I have some python web-scraping scripts scheduled and it only appear Error in the column of last Run if the job runs out of memory or takes longer than expected. But not if my python code breaks, if my python code breaks, the full error trace appear in the logs but it's not marked as error but it mark success.
Steps to reproduce the problem
Schedule a python script that breaks and it dont mark as Error but as Success
Your Setup
Operating system and version?
CentOS Linux 7 (Core)
Node.js version?
v16.18.1
Cronicle software version?
0.9.27
Are you using a multi-server setup, or just a single server?
Single server
Are you using the filesystem as back-end storage, or S3/Couchbase?
Can you reproduce the crash consistently?
Log Excerpts
Here my code breaks and in cronicle says that the job completed successfully: