API Designer and async function

Registered Posts: 1

Hello, i'm trying to run a background task when my endpoint is call.

Here is a simple example of what i am trying to do.

import asyncio

async def run_task_background(parameters):
job_uid = await run_task(parameters)
#add job_uid in a table def api_py_function(): asyncio.run(run_task_background(parameters))
return {"status": "Creating task"}

I tried a lot of different formulation but i always receive an error :

Failed to run function : <class 'TypeError'> : Object of type coroutine is not JSON serializable

Does somebody know what i am doing wrong ?

Thank you

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.