-
Notifications
You must be signed in to change notification settings - Fork 98
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
Question: Get worker number from within worker? #54
Comments
Does this work? import os
print(os.getpid()) |
No, that is the pid |
Thanks -- I saw this is marked closed as "completed", though am not finding it in the docs or closed PRs, is there a feature implementing this I should be looking for? |
Each Hypercorn worker is a process so the pid can be used to identify which worker at runtime. |
When we launch N workers, we cannot tell which 1 of N, eg, leader. It's fine not implementing, thanks for the clarification. |
There shouldn't be a leader, as the primary Hypercorn process doesn't handle any requests, rather it manages the other processes. |
This isn't about what hypercorn needs but the software on top. In our case, it helps to know the worker number. Again, it is fine the issue is closed, just it hasn't be completed. |
Is there a way for a worker to know which # worker it is? In other systems, it is common to have an environment variable (
WORKER=0
, ...), but I didn't see anythingWe're trying to match the CPU + GPU NUMA hierarchy for our workers, and are currently launching our Quart workers as
hypercorn -b 0.0.0.0:$PORT --worker-class uvloop ...
.The text was updated successfully, but these errors were encountered: