Status reporting methods
The Python methods are synchronous: call them withoutawait, from a plain def function. The C# methods are synchronous too, even inside your async Task Run.
main.py
AutomateFunction.cs
What the runner does for you
- No status reported: when your function returns without one, the runner marks the run successful with a warning message.
- Unhandled error: when your function throws, the runner catches it, marks the run as an exception, and writes the error to the run log. You do not need a try/except around the whole function.
Status types and when to use them
A function that runs but finds problems in the model should mark the run as failed, not as an exception. Keep exception for errors in the function: a bug, a network failure, a model it cannot read.
Best practices
- Report the final status yourself. The runner’s fallback success message says the function forgot to.
- Write messages a reader can act on. “12 walls have no Mark” beats “Process failed”.
- Include counts. If the function checks a batch, say how many objects passed and failed.
- Attach results to objects. A status says whether the run passed; object results say where.