I am using durable function to setup a process where I am calling 6 functions at once and post it's success I need to execute a proc. This is already setup using Logic Apps, but sometimes the functions takes more than 2 mins and thus it restarts so we are moving to durable functions. I have already gone through the Microsoft's Documentation on durable function for python, and it is working as expected on local.
Output post triggering
But when doing the same for my actual durable functions that I needed to create I am getting below errors:
It's not able to recognize the language
Even after I pass it, it's still not able to figure out the Azure Storage connection
PS: I have created a temp storage in azure and using the same in both.
EDIT[1]:
Function Activity
def main(url: str) -> str:
"""Trigger the function url"""
resp = requests.get(url)
if resp.status_code in (200, 201):
return True
return False
Function Orchestrator
def orchestrator_function(context: DurableOrchestrationContext):
FUNC_NAMES = os.environ['TBL_FUNCTIONS']
tasks = []
for name in FUNC_NAMES:
tasks.append(context.call_activity('CWFunctionActivity', os.environ[name]))
results = yield context.task_all(tasks)
if all(results):
result = yield context.call_activity('CWFunctionActivity', os.environ['FORECAST_DATASET_PROC'])
else:
result = "Check the function execution logs"
return result
Function HTTP Starter
async def main(req: HttpRequest, starter: str) -> HttpResponse:
client = DurableOrchestrationClient(starter)
instance_id = await client.start_new(req.route_params["functionName"], None, None)
logging.info(f"Started orchestration with ID = '{instance_id}'.")
return client.create_check_status_response(req, instance_id)
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "storage_connection_string",
"FUNCTIONS_WORKER_RUNTIME": "python",
"TBL_FUNCTIONS": "['item1', 'item2', 'item3']",
/*
"TBL_FUNCTIONS": [
"TBL_CHARGE_CODES",
"TBL_EXPENSES",
"TBL_MEMBERS",
"TBL_PROJECTS",
"TBL_PROJECT_TICKETS",
"TBL_TIME_ENTRIES"
],
*/
"TBL_CHARGE_CODES" : "corresponding_http_url",
"TBL_EXPENSES": "corresponding_http_url",
"TBL_MEMBERS" : "corresponding_http_url",
"TBL_PROJECTS": "corresponding_http_url",
"TBL_PROJECT_TICKETS": "corresponding_http_url",
"TBL_TIME_ENTRIES": "corresponding_http_url"
}
}
When I tried the same in my environment with your code, I got the same error.
This seems to be due to the configuration of environment variables in local.settings.json
.
Resolution:
I have modified the code in local.settings.json
as below and it worked.
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"TBL_FUNCTIONS:[0]:TBL_CHARGE_CODES" : "corresponding_http_url",
"TBL_FUNCTIONS:[0]:TBL_EXPENSES": "corresponding_http_url",
"TBL_FUNCTIONS:[0]:TBL_MEMBERS" : "corresponding_http_url",
"TBL_FUNCTIONS:[0]:TBL_PROJECTS": "corresponding_http_url",
"TBL_FUNCTIONS:[0]:TBL_PROJECT_TICKETS": "corresponding_http_url",
"TBL_FUNCTIONS:[0]:TBL_TIME_ENTRIES": "corresponding_http_url"
}
}
References:
How to set an array value in local.settings.json file in azure functions - Stack Overflow