Skip to content

Conversation

knopki
Copy link
Member

@knopki knopki commented Apr 4, 2025

This fixes the asyncio error: RuntimeError: asyncio.run() cannot be called from a running event loop
This situation occurs when someone does something stupid. For example, runs synchronous code in asynchronous code, which runs asynchronous code from yascheduler through synchronous code.
For example, when a WSGI netius server runs a synchronous flask app that tries to add a task to the yascheduler via a synchronous wrapper.
The point of the fix is to make a neater wrapper that runs asynchronous code in a thread pool. Also, asynchronous methods are made available for use. These are used in cli utils.

Other changes to fix CI:

  • apply formatting changes (black and isort)
  • fix some pylint errors
  • bump minimal python version
  • bump GH actions versions

knopki added 4 commits April 4, 2025 20:10
Add async support and to_sync decorator

The commit adds async support to client methods and introduces a to_sync decorator to allow running async code synchronously. Main methods now have both sync and async versions.
@knopki knopki force-pushed the fix-nested-async-loop branch from 84b427a to 3427039 Compare April 4, 2025 17:47
knopki added 3 commits April 4, 2025 20:52
Updates GitHub Actions checkout (v3->v4) and setup-python (v4->v5).
Upgrades Python from 3.8/3.11 to 3.9/3.13 across all workflows.
@knopki knopki force-pushed the fix-nested-async-loop branch from 3427039 to e0e4a2e Compare April 4, 2025 17:52
@blokhin
Copy link
Member

blokhin commented Apr 4, 2025

Those are quite sensitive changes!

@blokhin blokhin merged commit 540d038 into tilde-lab:master Apr 4, 2025
4 of 5 checks passed
@knopki knopki deleted the fix-nested-async-loop branch April 5, 2025 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants