I’m trying to develop a function for my first automation. Running it on the cloud works perfect but I want to start testing it on my local environment as it’s more practical.
Correct me if I’m wrong but reading the documentation I saw two ways of testing a python function:
The first one is sing the docker image and running:
docker run speckle_automate_python_example \ python -u main.py run function_inputs.json
The documentation seems outdated on this command but I managed to use it
When running this command I get the following error: gql.transport.exceptions.TransportQueryError: {'message': "Invalid status change. Attempting to move from 'succeeded' to 'running'.", 'locations': [{'line': 2, 'column': 3}], 'path': ['automateFunctionRunStatusReport'], 'extensions': {'code': 'FUNCTION_RUN_REPORT_STATUSES_ERROR', 'statusCode': 400}}
The second way is actually executing the test, for this case I execute poetry run pytest and the execution of the test gets blocked forever, there’s no message or nothing. For this I also tried to create a C# function and the same happened.
Had two issues, the first is that I missed filling the stream:write scope on the token and after that I found that the automation was not configured as a test automation. Created a test automation and ran it but it took more than 25 minutes to execute. Is that timing correct?
The execution was basically the bare template, I’m sharing the actual code executed:
def automate_function_without_inputs(automate_context: AutomationContext) -> None:
"""A function example without inputs.
If your function does not need any input variables,
besides what the automation context provides,
the inputs argument can be omitted.
"""
version_root_object = automate_context.receive_version()
print("Report file: ", version_root_object)
automate_context.mark_run_success("No forbidden types found.")
Maybe the issue is with the print? Also even though the execution was successful I don’t see any logs.