-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
permits black to run in AWS Lambda: #1141
Conversation
baee24f
to
7a75383
Compare
Would be amazing if you could add a test that patches out |
@zsol haha I was afraid you would say that, hmmm let me try |
7a75383
to
8c00c45
Compare
AWS Lambda and some other virtualized environment may not permit access to /dev/shm on Linux and as such, trying to use ProcessPoolExecutor will fail. As using parallelism is only a 'nice to have' feature of black, if it fails we gracefully fallback to a monoprocess implementation, which permits black to finish normally.
8c00c45
to
5559f49
Compare
@zsol I've tried something, but as I'm not that familiar with unittest library and the way "invokeBlack" works, I'm not against a review from you even though the test are failing, to see if i'm missing the elephant in the roomt |
I'm not sure if either of you figured this out already or not, but I've found that simply replacing So, I would suggest using |
yes actually, none default to threadpool, so I think it's more pragmatic to let python use whichever default it consider appropriate ? (I've not strong opinion on it) |
@hawkins btw, help appreciated on this PR, I struggle with the test , so if you're also interested in getting it upstream :) |
Oh - so by setting And sure, I can try to take a stab at the test too. |
@hawkins yes our CI is based on my fork currently, running in lambda , so i can assure you it's working :) |
Just dove through the asyncio docs and now I see how that works. Thanks! Very cool, nice job with using |
CI seems unhappy, could you take a look? Thanks! |
@JelleZijlstra , I tried in the past, but I think I reach the limitation of my understanding on how the tests are made with black. (i.e I think the test I've added is not exactly written the way it should be written, but why ? 🤷♂️ ) |
For what it's worth, Termux on Android also doesn't support
Replacing the executor creation to fall back to a |
Thanks! ✨ 🍰 ✨ |
Looks like this has turned the CI red on master?
|
@ambv is telling me he's fixing it. |
Looks like the PR didn't get updated to also handle |
@Terrance just send a new PR and we'll take a look! |
Submitted #1400. |
AWS Lambda and some other virtualized environment may not permit access
to /dev/shm on Linux and as such, trying to use ProcessPoolExecutor will
fail.
As using parallelism is only a 'nice to have' feature of black, if it fails
we gracefully fallback to a monoprocess implementation, which permits black
to finish normally.
should fix #1138 and #776