Script Exit Codes
Script exit codes inform Orbital whether a Python script completed successfully.
Scripts return an exit code using the sys.exit() function. A zero (0) will be returned if the script completes successfully. A non-zero exit code will be returned if the script fails. For example:
fname = "some_file"
try:
f = open(fname, 'rb')
# use the file
sys.exit(0) # success
except OSError:
print("Could not open/read file:", fname)
sys.exit(1) # non-zero - error
If a script fails, it will be identified as returning an error in the results listing.
Special Orbital Exit Codes
Customers can use exit codes that range from zero (0) to 199. Exit codes 200 and greater are reserved for Orbital internal use only and should not be used in customer scripts.
| Code | Description |
|---|---|
| 0 | Script Successfully Executed |
| 1-199 | Available to Customer Scripts |
| 200 | Script Timed Out |
| 201 | Orbital Error |
| 202 | Python Execution Error |
| 203 | Script Exception Occurred |
| 204 | Script Failed to Run |
| 205 | Script Feature Not Enabled |
| 206 | Python Missing from Node |
| 207 | Node Feature Update In Progress or Operating System Mismatch |
|
208 |
Operating System Mismatch (the script was intended for a different operating system) |
|
209 |
Invalid Exit Code (the exit code was outside the range of 0 to 255 inclusively) |
Using stderr In Scripts
When the script returns non-fatal errors or warning conditions, you are encouraged to write them to stderr.
For example:
fname = "some_file"
try:
f = open(fname, 'rb')
# use the file
sys.exit(0) # success
except OSError:
print("warning - could not open/read file", file=sys.stderr)
# continue...
sys.exit(0) # still success