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

Pin python version for failing cron jobs #685

Merged
merged 3 commits into from
Oct 25, 2023

Conversation

mvandenburgh
Copy link
Member

@mvandenburgh mvandenburgh commented Oct 25, 2023

Some cron jobs are failing due to an image rebuild that happened recently. Since we don't usually pin python versions, some images got rebuilt with python 3.12, which introduced some compatability issues with some of our pinned dependencies. This PR pins all of these images to python 3.11 as a stopgap until we can sort out how to deal with upgrading dependencies.

(original description)
This upgrades all python dependencies in requirements.txt for our python cron jobs. Some of these are failing now due to incompatibilities between Python 3.12 and the older dependencies that are pinned.

@mvandenburgh
Copy link
Member Author

This is another instance of the issue mentioned in #618.

Copy link
Collaborator

@scottwittenburg scottwittenburg left a comment

Choose a reason for hiding this comment

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

I'm curious how you picked the versions to pin, and whether you have any idea if the new versions have breaking api changes.

@mvandenburgh
Copy link
Member Author

I'm curious how you picked the versions to pin, and whether you have any idea if the new versions have breaking api changes.

I used https://github.com/simion/pip-upgrader to do it, which is a tool that just bumps all the dependencies in a requirements.txt file to the latest version.

As far as breaking changes, I'm not sure. In general I'm not sure the best way to handle upgrades like this; what I was thinking is we just do the upgrade, fully expecting that there may be errors, and just keep an eye on sentry and make any fixes as we encounter them. I'm definitely open to other ideas though.

@scottwittenburg
Copy link
Collaborator

I used https://github.com/simion/pip-upgrader to do it, which is a tool that just bumps all the dependencies in a requirements.txt file to the latest version.

Oh, that looks interesting, though unmaintained for a couple years. I wonder if I should be double-checking what it produced. Like is fast-api really at v0.104.x? Some of them kind of caught my eye.

we just do the upgrade, fully expecting that there may be errors, and just keep an eye on sentry and make any fixes as we encounter them

I think that could be ok, assuming sentry is hooked up to all those, I noticed you've been adding to it some or maybe all our python services recently.

This makes me think of our staging environment, but I have no idea if these pieces are running there, or if not, whether it makes sense to run them there. Also, some cron job that runs every 12 hours, would we just wait to see a successful pod record in staging from all the affected services?

I'm just rambling I guess, maybe @zackgalbreath wants to chime in though.

@mvandenburgh
Copy link
Member Author

I used simion/pip-upgrader to do it, which is a tool that just bumps all the dependencies in a requirements.txt file to the latest version.

Oh, that looks interesting, though unmaintained for a couple years. I wonder if I should be double-checking what it produced. Like is fast-api really at v0.104.x? Some of them kind of caught my eye.

Yup! https://github.com/tiangolo/fastapi/releases/tag/0.104.0

And yeah it's not really maintained, but all the tool really does is parse requirements.txt => grab latest version of each package from PyPI => write those to requirements.txt. I can do a quick double check to make sure it's all valid.

I think that could be ok, assuming sentry is hooked up to all those, I noticed you've been adding to it some or maybe all our python services recently.

Yes, all of the images affected here are hooked up to sentry now.

This makes me think of our staging environment, but I have no idea if these pieces are running there, or if not, whether it makes sense to run them there. Also, some cron job that runs every 12 hours, would we just wait to see a successful pod record in staging from all the affected services?

Sadly, none of these run in staging currently. We should hook those up at some point. But you have a good point about cron jobs, I suppose we would just have to wait (unless, it's something we can invoke manually just to test. Like I think we could do that for the gitlab-api-scrape without any issues, but obviously something like the snapshot-release job we wouldn't want to run).

The only other option I can think of to mitigate this issue is adding tests (with stuff like github/gitlap mocked properly) like we have for the sync script. Or we could of course just pin to an older Python version and leave the existing pinned versions, but that would just delay this for another day.

@mvandenburgh
Copy link
Member Author

@scottwittenburg in light of the points you brought up, I tried a different approach - I backed out the requirements.txt updates, and just pinned the Python version to 3.11 so that the old pinned dependencies can still work. This will at least get these jobs running again, and maybe we can discuss the dependency pinning issue separately. Does that sound ok to you?

@scottwittenburg
Copy link
Collaborator

his will at least get these jobs running again, and maybe we can discuss the dependency pinning issue separately. Does that sound ok to you?

Well, I'm sort of bummed to be the blocker of forward progress, but yes, this sounds ok to me. At least get the jobs running again for now, then we can discuss the right long-term approach without that siren going off in our ears.

@scottwittenburg
Copy link
Collaborator

You maybe are already doing this, but since you merged #686, do you want to rebase this on main now and make sure these images build?

Also, maybe you can update the description since the approach has changed since you wrote the original one?

@mvandenburgh mvandenburgh changed the title Update python dependencies Pin python version for failing cron jobs Oct 25, 2023
@mvandenburgh mvandenburgh merged commit cbac55a into main Oct 25, 2023
16 checks passed
@mvandenburgh mvandenburgh deleted the update-python-dependencies branch October 25, 2023 21:00
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