Skip to content

[Bug]: python - cannot run async function in sync handler #3667

@dberardo-com

Description

@dberardo-com

Nuclio Version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Nuclio.

Issue Description

i am trying to run:

loop = asyncio.get_event_loop()
return loop.run_until_complete(do_polling())

or

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
result = loop.run_until_complete(do_polling())
loop.close()
return result

inside a sync handler

and i get errors such as "RuntimeWarning: coroutine 'snmp_definition..do_polling' was never awaited"

this was reported here: #3310 (comment)

Expected Behavior

asyncio stuff should work as in regular sync python code

Deployment Method

Kubernetes

Nuclio Version

1.13.4

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions