graphitesend | Easy python bindings to write to Carbon
kandi X-RAY | graphitesend Summary
kandi X-RAY | graphitesend Summary
[Coverage Status] Easy python bindings to write to Carbon ( Re-write of carbonclient).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Send a message to Graphite
- Convert a Graphite message to a tuple
- Command line interface
- Sends a metric
- Disconnect a message
- Raise GraphiteSendException
- Preserve the message
- Send a message and reconnect
- Try to connect to Graphite
- Connect to the graphite server
- Disconnect from the server
- Disconnect from the device
- Send graphite data
- Send a graphite message
- Send a metric list
- Reset the module instance
graphitesend Key Features
graphitesend Examples and Code Snippets
threads = []
for n in range(7):
th = threading.Thread(target=client, args=(g,))
th.start()
threads.append(th)
# All threads created. Wait for them to finish.
for th in threads:
th.join()
server.stop()
Community Discussions
Trending Discussions on graphitesend
QUESTION
I'm trying to create a threaded TCP socket server that can handle multiple socket request at a time.
To test it, I launch several thread in the client side to see if my server can handle it. The first socket is printed successfully but I get a [Errno 32] Broken pipe
for the others.
I don't know how to avoid it.
ANSWER
Answered 2018-May-31 at 21:52It's a little bit difficult to determine what exactly you're expecting to happen, but I think the proximate cause is that you aren't giving your clients time to run before killing the server.
When you construct a Thread
object and call its start
method, you're creating a thread, and getting it ready to run. It will then be placed on the "runnable" task queue on your system, but it will be competing with your main thread and all your other threads (and indeed all other tasks on the same machine) for CPU time.
Your multiple threads (main plus others) are also likely being serialized by the python interpreter's GIL (Global Interpreter Lock -- assuming you're using the "standard" CPython) which means they may not have even gotten "out of the gate" yet.
But then you're shutting down the server with server_close()
before they've had a chance to send anything. That's consistent with the "Broken Pipe" error: your remaining clients are attempting to write to a socket that has been closed by the "remote" end.
You should collect the thread objects as you create them and put them in a list (so that you can reference them later). When you're finished creating and starting all of them, then go back through the list and call the .join
method on each thread object. This will ensure that the thread has had a chance to finish. Only then should you shut down the server. Something like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graphitesend
You can use graphitesend like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page