-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix windows file limit check #10059
Fix windows file limit check #10059
Conversation
👷 Deploy request for prefect-docs-preview pending review.Visit the deploys page to approve it
|
@rpeden It's been many a year since i've been in the OS level api calls. This is great. Avoids a dependency, and uses os.name which is, from my googling the differences here on a sat morning, probably a simpler alternative. (also, today i learned about Jython, which causes os.name to return 'java' - what an odd beast it is) Anyway, I closed my PR and referenced here since this is a better solution. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @rpeden!
Prefect 2.10.17 added a Unix only import in
utilities/filesystem.py
that breaks when running Prefect server or an agent on Windows.Credit to @grenzi for suggesting a solution to this; this PR only differs from their PR #10055 in calling
getmaxstdio
without adding a dependency onpywin32
.This PR calls a function in the Windows Universal C runtime to perform the same check on Windows, and scopes the
resource
module import to ensure it won't run on Windows. Usingctypes
in this instance should be safe, as Microsoft is unlikely to remove the Universal C runtime DLL from Windows given how many of their own applications depend on it.See https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/getmaxstdio for more detail.
Closes #10054
Closes #10058
Although this PR adds a test for
get_open_file_limit
, many other tests intests/utilities/test_filesystem.py
fail on Windows due to hardcoded Unix file paths. In case it is useful, I opened a draft PR (#10065) with a potential solution that makes the failing tests work cross-platform.Example
Before: run
prefect server start
on Windows and get an error:ImportError: No module named 'resource'
After:
prefect server start
works as expected.The same applies for the
prefect agent start
command.Checklist
<link to issue>
"fix
,feature
,enhancement
,docs
.For documentation changes:
netlify.toml
for files that are removed or renamed