Skip to content

Add support for Python 3.14 - #7574

Open
hgreebe wants to merge 4 commits into
aws:developfrom
hgreebe:develop
Open

Add support for Python 3.14#7574
hgreebe wants to merge 4 commits into
aws:developfrom
hgreebe:develop

Conversation

@hgreebe

@hgreebe hgreebe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description of changes

  • Add support for Python 3.14 to the ParallelCluster CLI.
    1. Replace deprecated asyncio.get_event_loop() calls with a new utility function.
      In Python 3.14, get_event_loop() raises RuntimeError when no event loop is running instead of implicitly creating one.
      This is documented in Python official doc: https://docs.python.org/3.14/whatsnew/3.14.html#asyncio
    2. Add explicit support for Python 3.14.
    3. Enable unit tests for Python 3.14

Tests

  • Manually verified that the CLI works with Python 3.13 and 3.14
  • Unit tests

References

Please review the guidelines for contributing and Pull Request Instructions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hgreebe
hgreebe marked this pull request as ready for review August 20, 2026 13:54
@hgreebe
hgreebe requested review from a team as code owners August 20, 2026 13:54
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.07%. Comparing base (abee849) to head (4f0b2d0).
⚠️ Report is 6 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7574      +/-   ##
===========================================
+ Coverage    89.94%   90.07%   +0.13%     
===========================================
  Files          180      180              
  Lines        16255    16400     +145     
===========================================
+ Hits         14621    14773     +152     
+ Misses        1634     1627       -7     
Flag Coverage Δ
unittests 90.07% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmarciani

Copy link
Copy Markdown
Contributor

Commit message 410dcbf says we are introducing the support for python 3.13, but I think this is now stale bnecause we already introduced support for python 3.13 in pcluster 3.16.0.

@hgreebe
hgreebe force-pushed the develop branch 2 times, most recently from e5129f8 to d4b56a2 Compare August 24, 2026 14:33
Comment thread cli/src/pcluster/utils.py Outdated
Comment thread cli/src/pcluster/utils.py Outdated
This approach is required to support Python 3.14 and maintain retrocompatibility with Python 3.8+.
"""
try:
return asyncio.get_running_loop()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I started looking at this change, I remember that this creation was triggering lot of warning messages related to event loop not being closed.
That was from months ago, so may be not true anymore, but worth checking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now added a event loop context manager that handles and creation and closing of loops so that these warnings do not happen.

Comment thread CHANGELOG.md Outdated
adding progress reporting, and supporting running on deleted clusters.

**CHANGES**
- Add support for Python 3.14.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to be more explicit syaing Add support for Python 3.14 in the pcluster CLI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread cli/src/pcluster/utils.py
@functools.wraps(func)
async def wrapper(self, *args, **kwargs):
return await asyncio.get_event_loop().run_in_executor(
return await asyncio.get_running_loop().run_in_executor(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only happens inside a running loop because it is awaiting so we don't need to create a new loop.

Helena Greebe added 3 commits August 27, 2026 09:42
In Python 3.14, asyncio.get_event_loop() raises a RuntimeError when there is
no running loop instead of implicitly creating one. Introduce an event_loop()
context manager that reuses a running loop when present and otherwise creates
a new loop and closes it on exit, avoiding leaked (unclosed) event loops.
Use asyncio.get_running_loop() directly where already inside a running loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants