Re: [paramiko] Multithreading

2010-07-02 Thread Marcin Krol
Andrew Bennetts wrote: If you meant “can handle many concurrent connections” instead, I'd suggest Twisted, it tends to excel at that sort of task (and without threads, usually). Personally, even if threads are required I'd probably lean towards using it anyway :) Threads are not a hard

Re: [paramiko] Multithreading

2010-07-01 Thread Marcin Krol
james bardin wrote: The main loop is a busy loop! It's hogging the GIL itself, and pegging a cpu core at %100. Because the threads only do work with a lock, there is no time for the GIL to switch threads., The sleep() simply allows a few cycles for the GIL to be released. Oops! I didn't

Re: [paramiko] Multithreading

2010-07-01 Thread james bardin
On Thu, Jul 1, 2010 at 12:06 PM, Nikolaus Rath nikol...@rath.org wrote: You can share it, like you can share anything you want between threads, you need proper locking, as the client only has one channel for communication. Since I can share anything I want if I synchronize access to it

Re: [paramiko] Multithreading

2010-07-01 Thread Nikolaus Rath
On 07/01/2010 12:43 PM, james bardin wrote: On Thu, Jul 1, 2010 at 12:06 PM, Nikolaus Rath nikol...@rath.org wrote: You can share it, like you can share anything you want between threads, you need proper locking, as the client only has one channel for communication. Since I can share

Re: [paramiko] Multithreading

2010-07-01 Thread Nikolaus Rath
On 07/01/2010 01:28 PM, james bardin wrote: On Thu, Jul 1, 2010 at 1:00 PM, Nikolaus Rathnikol...@rath.org wrote: Generally in python, the only objects you can share without explicit locking are single instances of core data types - basically lists and dicts. As well as third-party modules

Re: [paramiko] Multithreading

2010-06-30 Thread Nikolaus Rath
On 06/30/2010 09:03 AM, Marcin Krol wrote: Nikolaus Rath wrote: Hello, I would like to use an SFTPClient instance concurrently with several threads, but I couldn't find any information about thread safety in the API documentation. - Can I just share the SFTPClient instance between several

Re: [paramiko] Multithreading

2010-06-30 Thread Marcin Krol
Nikolaus Rath wrote: All I need is a Python API for uploading, downloading and renaming files over SSH. I chose SFTPClient since it seemed to be the simplest solution, and I don't remember seeing any warnings about performance or compatibility. I don't know about paramiko implementation of

Re: [paramiko] Multithreading

2010-06-30 Thread james bardin
On Wed, Jun 30, 2010 at 11:13 AM, Marcin Krol mrk...@gmail.com wrote: Obviously, all the normal caveats about multithreading apply: remembering to sleep just in case after releasing locks to prevent starvation I never heard of that. Could you explain in more detail what you mean?

Re: [paramiko] Multithreading

2010-06-30 Thread Nikolaus Rath
james bardin jbar...@bu.edu writes: On Wed, Jun 30, 2010 at 9:33 AM, Nikolaus Rath nikol...@rath.org wrote: Nikolaus Rath wrote: Hello, I would like to use an SFTPClient instance concurrently with several threads, but I couldn't find any information about thread safety in the API

Re: [paramiko] Multithreading

2010-06-27 Thread Nikolaus Rath
Hi, Really no one around who knows anything about this? -Nikolaus Nikolaus Rath nikol...@rath.org writes: Hello, I would like to use an SFTPClient instance concurrently with several threads, but I couldn't find any information about thread safety in the API documentation. - Can I just