Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block on Python 3.13 version #1899

Merged
merged 82 commits into from
Oct 25, 2024

Conversation

joecummings
Copy link
Contributor

@joecummings joecummings commented Oct 24, 2024

The worst hack I've written so far in my life. Github Actions is a (useful) abomination.

Goal: Don't run nightly builds on Python 3.13. We depend on HF Datasets, which depends on PyArrow, who haven't released a Python 3.13 wheel. It is expected to come out soon in version v18. Therefore, Python 3.13 builds break.

Simple enough, right?

WRONG

SO WRONG

UNBELIEVABLY WRONG.

Attempt 1: Figure out a way to make the build job conditional on whether the matrix entry way for Python 3.13. Eight hours later, it's pretty clear that this isn't possible (through torchtune) b/c the build job is controlled by dev-infra and we just pass in the entire matrix and it handles the actual execution.

Attempt 2: Filter the matrix generated by the generate-matrix job to remove all Python 3.13 entries. It was about three hours in that I figured out I could create a Python shell in the filtering job. This sped things up and after another couple hours, here we are. But, Joe, how do you know it works if Python 3.13 jobs are only kicked off for nightly builds and you've done all your testing on this PR? I toggled the filtering function to exclude Python 3.9 jobs (since those are the only ones kicked off on PRs) and confirmed that these jobs were not passed down to the build job. Is that good enough? No probably not, but what are you going to do about it?

Final question - Was this a good use of my time?: Probably not. PyArrow will be out soon and we could've just had broken nightlies for Python 3.13 until then b/c no one is really using Python 3.13. But I know that my teammates will express great admiration and gratitude for making the little box green instead of red and that makes it alllllll worth it.

Copy link

pytorch-bot bot commented Oct 24, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/1899

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit ffcf4f1 with merge base 74139c9 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 24, 2024
@ebsmothers
Copy link
Contributor

OK this is pretty impressive. Overall it looks reasonable, one thing I don't see is how you tested it though. Did you manually trigger the build job to confirm everything works now?

@joecummings joecummings merged commit 8e013c2 into pytorch:main Oct 25, 2024
17 checks passed
@joecummings joecummings deleted the filter-python-build-version branch October 25, 2024 18:09
Comment on lines +31 to +58
filter-python-versions:
needs: generate-matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Filter matrix to exclude Python 3.13
id: set-matrix
shell: python
env:
input-matrix: ${{ needs.generate-matrix.outputs.matrix }}
run: |
import os
import json

# Grab environment variables
input_matrix = json.loads(os.environ["input-matrix"])
github_output_file = os.environ["GITHUB_OUTPUT"]

# Filter out any builds for 3.13
filtered_matrix = {"include": []}
for build in input_matrix["include"]:
if build["python_version"] != "3.13":
filtered_matrix["include"].append(build)

# Write the new matrix to the default outputs file
with open(github_output_file, "w") as handle:
handle.write(f"matrix={json.dumps(filtered_matrix)}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants