René's URL Explorer Experiment


Title: [Async stack 2/6] asyncio composition and durable timers by andystaples · Pull Request #358 · microsoft/durabletask-python · GitHub

Open Graph Title: [Async stack 2/6] asyncio composition and durable timers by andystaples · Pull Request #358 · microsoft/durabletask-python

X Title: [Async stack 2/6] asyncio composition and durable timers by andystaples · Pull Request #358 · microsoft/durabletask-python

Description: WarningDo not merge this PR, or any other PR in this stack, on its own. The stack was split out of the closed #293 to make review easier. Once every PR in the stack is approved, the whole stack will be squash-merged together. Stack layer 2/6, built on the coroutine dispatch layer (#357). Summary This layer adds general asyncio composition and durable timers to the replay-safe event loop that coroutine orchestrators run on. Task composition Adds _DurableAsyncTask. A task is retired once its result or exception has been observed, so replaying discarded gather batches and handled failures does not keep decoded payloads or tracebacks alive. Tasks hash by creation sequence. TaskGroup iterates a set of tasks to cancel them, so this keeps cancellation order independent of memory addresses; the reason is documented in code. Cancellation callbacks run in a deterministic order, keyed by when each task was created. Retired tasks never reuse that ordering. TaskGroup, gather, wait_for, and asyncio.timeout compose over durable work: Cancelling a local waiter does not cancel the underlying shared durable operation. The actions emitted when a TaskGroup is cancelled stay the same across replays. A waiter finalized after the dispatch has closed (for example, an asyncio.Task constructed directly rather than through asyncio.create_task) no longer raises during garbage collection. Directly constructed tasks are documented as unsupported. Durable timers call_later and call_at are backed by durable timers and return _DurableTimerHandle, which compares by identity. Deadlines are rounded up to the next microsecond, so a timer never fires before the loop's deadline. Timezone-aware orchestration clocks are normalized. Deadlines already in the past run immediately, and non-finite delays raise an error. Cancelling a handle cancels its durable timer. asyncio.sleep and timeouts use the existing chunking for long timers. Unsupported work Every asyncio loop API the durable loop does not implement (executors, cross-thread scheduling, sockets, pipes, subprocesses, readers/writers, signal handlers, TLS, sendfile, task factories, exception handlers, debug mode, async-generator shutdown, and loop lifecycle) fails through one table with an actionable error, instead of a bare NotImplementedError. get_exception_handler() returns None, because callback failures always fail the dispatch. A test enumerates asyncio.AbstractEventLoop so that any public loop API that is neither implemented nor in the table, including one added by a future Python version, fails the suite. asyncio.wait and asyncio.as_completed are not rejected at run time; the contract documents them as unsupported because their ordering is not replay-stable. Docs (docs/async-orchestrators.md) States that successive dispatches can run on different workers and that all workers processing an instance must use the pinned environment. Notes that delays below the resolution of loop.time() are effectively zero, and that tasks must be created with asyncio.create_task or a task group. Code docs Extends the list of private asyncio hooks in the asyncio_loop.py module docstring, and clarifies the Task.wait() docstring for asyncio.create_task and task groups. Scope Left for later layers Dispatch teardown, async-generator hooks, the cleanup quiescence limit, and the cleanup error policy belong to layer 3/6 (#360). This layer keeps the minimal close() from layer 1/6, extended only to release the new timer and cancellation state. Orchestrators still receive the eager OrchestrationContext. The cold AsyncOrchestrationContext arrives in layer 4/6 (#361), which updates these tests to use it. No changelog changes; release notes are added in layer 6/6 (#364). Tests Adds tests/durabletask/test_asyncio_orchestrators.py, covering: composition memory retirement shared-wait cancellation timers unsupported work, including every unimplemented AbstractEventLoop API fanout scaling

Open Graph Description: WarningDo not merge this PR, or any other PR in this stack, on its own. The stack was split out of the closed #293 to make review easier. Once every PR in the stack is approved, the whole stack wil...

X Description: WarningDo not merge this PR, or any other PR in this stack, on its own. The stack was split out of the closed #293 to make review easier. Once every PR in the stack is approved, the whole stack wil...

Opengraph URL: https://github.com/microsoft/durabletask-python/pull/358

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:d75fd640-2c73-424c-0001-2b821d58307f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id99E4:28801C:83B22:AE762:6AFE2D15
html-safe-nonce723c240201000162a6360673551ef485c5a8c48d13cf4d3435ea1101990e30da
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUU0OjI4ODAxQzo4M0IyMjpBRTc2Mjo2QUZFMkQxNSIsInZpc2l0b3JfaWQiOiI2MTA3MDEzMDcyMjY0NTA2NjQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaccd513ed89398ccbc9875ce2bfe36a7c1ffd059aa5f57f6f6e73bddfdf9b7d47d
hovercard-subject-tagpull_request:5265835794
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/durabletask-python/pull/358/files
twitter:imagehttps://avatars.githubusercontent.com/u/77818326?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/77818326?s=400&v=4
og:image:altWarningDo not merge this PR, or any other PR in this stack, on its own. The stack was split out of the closed #293 to make review easier. Once every PR in the stack is approved, the whole stack wil...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee973f9ec3625f3faad8cac5c2d11a214b7ffe45f3cc563b828459b290ecaeed3
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id627664515
octolytics-dimension-repository_nwomicrosoft/durabletask-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627664515
octolytics-dimension-repository_network_root_nwomicrosoft/durabletask-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1f92c367595b9190e0be293896078033886b1913
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/pull/358/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F358%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F358%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2Fdurabletask-python
Reloadhttps://github.com/microsoft/durabletask-python/pull/358/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/358/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/358/files
microsofthttps://github.com/microsoft
durabletask-pythonhttps://github.com/microsoft/durabletask-python
Codehttps://github.com/microsoft/durabletask-python
Issues15 (15)https://github.com/microsoft/durabletask-python/issues
Pull requests12 (12)https://github.com/microsoft/durabletask-python/pulls
Actionshttps://github.com/microsoft/durabletask-python/actions
Projectshttps://github.com/microsoft/durabletask-python/projects
Security and qualityhttps://github.com/microsoft/durabletask-python/security
Insightshttps://github.com/microsoft/durabletask-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
andystapleshttps://github.com/andystaples
andystaples-async-stack-1-coroutine-dispatchhttps://github.com/microsoft/durabletask-python/tree/andystaples-async-stack-1-coroutine-dispatch
andystaples-async-stack-2-asyncio-compositionhttps://github.com/microsoft/durabletask-python/tree/andystaples-async-stack-2-asyncio-composition
Conversation 12 https://github.com/microsoft/durabletask-python/pull/358
Commits 9 https://github.com/microsoft/durabletask-python/pull/358/commits
Checks 25 https://github.com/microsoft/durabletask-python/pull/358/checks
Files changed https://github.com/microsoft/durabletask-python/pull/358/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/358/files
[Async stack 2/6] asyncio composition and durable timers https://github.com/microsoft/durabletask-python/pull/358/files#top
Show all changes 9 commits https://github.com/microsoft/durabletask-python/pull/358/files
68285d4 Add asyncio composition and durable timers for coroutine orchestrators andystaples Nov 11, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/68285d47cab0cfe06d046325923423043d2d5703
638f8d9 Fix same-runtime task-group cancellation replay order andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/638f8d998b19205753a288de0735a327f02f547e
44eccfc Use exact microsecond ceiling for durable call_at deadlines andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/44eccfc79a33e91c5f44fb18d8b02ce5d17b4ba6
9f9587a Merge andystaples-async-stack-1-coroutine-dispatch into andystaples-a… andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/9f9587a3a53d6e3776ed0847204e43a94bcc67bd
ba1476e Merge andystaples-async-stack-1-coroutine-dispatch into andystaples-a… andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/ba1476ecb5979bd9de1a2ae2845370d4557761aa
acae0c8 Harden durable loop API coverage and task bookkeeping andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/acae0c87319bb40a3dcc9fd475268ba2f9eaa002
2dc157a Merge andystaples-async-stack-1-coroutine-dispatch into andystaples-a… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/2dc157a9933dd539065f7ac9f1800329646bee91
08f7865 Merge andystaples-async-stack-1-coroutine-dispatch into andystaples-a… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/08f7865c0c2d9fea76009dbe9c9aa370faad72e6
cd0afdb Cover every inherited asyncio loop API in the durable loop andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/358/commits/cd0afdb989dd81122b5dc62420feaa29672b081a
Clear filters https://github.com/microsoft/durabletask-python/pull/358/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/358/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/358/files
async-orchestrators.md https://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
asyncio_loop.py https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
task.py https://github.com/microsoft/durabletask-python/pull/358/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
test_asyncio_orchestrators.py https://github.com/microsoft/durabletask-python/pull/358/files#diff-3f4f24b2fcba2e5d488f7876e8ad325f8de6a46896d88007d62be7f4bf3c9484
test_coroutine_orchestrators.py https://github.com/microsoft/durabletask-python/pull/358/files#diff-b0f87c14cdff5ff60109ff89e27ae6fcf0a30c4b0e555249eb6fcb88435abb3c
docs/async-orchestrators.mdhttps://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
View file https://github.com/microsoft/durabletask-python/blob/cd0afdb989dd81122b5dc62420feaa29672b081a/docs/async-orchestrators.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/358/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
https://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
https://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
https://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
https://github.com/microsoft/durabletask-python/pull/358/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
durabletask/internal/asyncio_loop.pyhttps://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
View file https://github.com/microsoft/durabletask-python/blob/cd0afdb989dd81122b5dc62420feaa29672b081a/durabletask/internal/asyncio_loop.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/358/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/358/files
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/358/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/358/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/358/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.