-
Notifications
You must be signed in to change notification settings - Fork 0
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
langgraph: seg fault #20
Comments
ok it's def loguru mixed w/ the enqueue setting. I just need to find a way to disable the intercept logger. |
Ok it looks like langsmith introduced the multiprocessing module in this merge langchain-ai/langsmith-sdk@0243f79, it's possible that reverting to a version before this avoids everything. |
Delgan/loguru#1264 |
![]() this is a very good point to realize Delgan/loguru#108 (comment) |
![]() great insight, i'm new to multiprocessing module Delgan/loguru#108 (comment) |
also good info re: understanding langraph_api module https://langchain-ai.github.io/langgraph/concepts/langgraph_server/#cron-jobs old rendered Dockerfile source from Docker Desktop:
|
ok https://medium.com/@muh.bazm/how-i-unified-logging-in-fastapi-with-uvicorn-and-loguru-6813058c48fc |
Got the following message when I tried to talk to my graph:
Current thought process is the following (thx perplexity):
NOTE: Here is the potentially problematic file: https://github.com/langchain-ai/langsmith-sdk/blob/9a2e4961e389f4bdbe4b822c193e0b917e71d651/python/langsmith/_internal/_background_thread.py#L40C62-L40C71
Inside a Docker container, the behavior of
os.cpu_count()
(which is typically used to get the CPU count) can be misleading. Python'scpu_count()
function usually reports the number of CPUs available on the host machine, not the number of CPUs allocated to the container[5][8]. This means that usingcpu_count()
directly in your ThreadPoolExecutor configuration might not accurately reflect the resources available to your container.To address this issue, you have a few options:
Use container-aware methods:
Instead of relying on
cpu_count()
, you can use container-aware methods to determine the number of CPUs allocated to your container. For example:This method reads the CPU quota and period from the cgroup filesystem, which reflects the container's CPU allocation[5].
Use environment variables:
You can pass the number of CPUs as an environment variable when running your Docker container and use that in your code:
Then, when running your container:
Hardcode the value:
If you know the exact number of CPUs you'll allocate to your container, you can hardcode this value:
Remember that the optimal number of threads doesn't always directly correlate with the number of CPUs, especially for I/O-bound tasks. You might need to experiment to find the best configuration for your specific use case[7].
Also, keep in mind that if you're using the
--cpuset-cpus
flag when running your Docker container, this will limit which CPUs your container can use, but it won't change whatos.cpu_count()
reports inside the container[9].Citations:
[1] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/39473573/54ebe82e-61c3-4079-ae0b-c388be238b27/paste.txt
[2] https://stackoverflow.com/questions/76415968/docker-container-using-only-one-cpu-core/76416074
[3] moby/moby#43587
[4] https://stackoverflow.com/questions/56195679/why-is-threadpoolexecutors-default-max-workers-decided-based-on-the-number-of-c
[5] python/cpython#80235
[6] https://www.tutorialspoint.com/how-many-cpus-does-a-docker-container-use
[7] https://superfastpython.com/threadpoolexecutor-number-of-threads/
[8] https://www.geeksforgeeks.org/python-os-cpu_count-method/
[9] https://stackoverflow.com/questions/47545960/how-to-check-the-number-of-cores-used-by-docker-container/51998044
The text was updated successfully, but these errors were encountered: