Skip to content

Commit

Permalink
Merge pull request #338 from specklesystems/gergo/automateExitCode
Browse files Browse the repository at this point in the history
fix(automate): make sure we exit with code 0 if execution completes
  • Loading branch information
gjedlicska authored Jun 3, 2024
2 parents 204aa74 + 239bc4b commit e6b822b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/speckle_automate/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Provides mechanisms to execute any function,
that conforms to the AutomateFunction "interface"
"""

import json
import sys
import traceback
Expand Down Expand Up @@ -65,7 +66,9 @@ def execute_automate_function(


@overload
def execute_automate_function(automate_function: AutomateFunctionWithoutInputs) -> None:
def execute_automate_function(
automate_function: AutomateFunctionWithoutInputs,
) -> None:
...


Expand Down Expand Up @@ -127,10 +130,9 @@ def execute_automate_function(
automate_function, # type: ignore
)

exit_code = (
0 if automation_context.run_status == AutomationStatus.SUCCEEDED else 1
)
exit(exit_code)
# if we've gotten this far, the execution should technically be completed as expected
# thus exiting with 0 is the schemantically correct thing to do
exit(0)

else:
raise NotImplementedError(f"Command: '{command}' is not supported.")
Expand Down

0 comments on commit e6b822b

Please sign in to comment.