fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Threads to run commands in the same Server


From: Sign Up
Subject: Re: [Fab-user] Threads to run commands in the same Server
Date: Thu, 13 Dec 2012 07:51:16 -0600

Use the multiprocessing module of core python to create child processes instead of using threads.  Its API is very similar to threading.  I've had success doing this.  If you need examples, let me know.

On Dec 13, 2012 7:13 AM, "Agustin Casiva" <address@hidden> wrote:
Hi Folks, I wanna know if is possible execute fabric commands (run, exists, etc) over the same server in a different thread or different process.

I have to run several commands in different folders over the same server and I need to execute this commands in parallel.

I tried with Threads but I'm getting SSH errors in the threads. Errors like these

Exception in thread Thread-32:
Traceback (most recent call last):
  File "/app/data/software/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/app/data/software/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/app/scripts/fabric/nyx/deploy/deploy_base.py", line 252, in doRunParallelCommands
    if exists('%s/settings.php' % site_info['site_path']):
  File "/app/data/software/lib/python2.7/site-packages/fabric/contrib/files.py", line 35, in exists
    return not func(cmd).failed
  File "/app/data/software/lib/python2.7/site-packages/fabric/network.py", line 463, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "/app/data/software/lib/python2.7/site-packages/fabric/operations.py", line 909, in run
    return _run_command(command, shell, pty, combine_stderr)
  File "/app/data/software/lib/python2.7/site-packages/fabric/operations.py", line 819, in _run_command
    stdout, stderr, status = _execute(default_channel(), wrapped_command, pty,
  File "/app/data/software/lib/python2.7/site-packages/fabric/state.py", line 340, in default_channel
    chan = connections[env.host_string].get_transport().open_session()
  File "/app/data/software/lib/python2.7/site-packages/ssh/transport.py", line 660, in open_session
    return self.open_channel('session')
  File "/app/data/software/lib/python2.7/site-packages/ssh/transport.py", line 771, in open_channel
    raise e
SSHException: Unable to open channel.

Or

Exception in thread Thread-50:
Traceback (most recent call last):
  File "/app/data/software/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/app/data/software/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/app/scripts/fabric/nyx/deploy/deploy_base.py", line 252, in doRunParallelCommands
    if exists('%s/settings.php' % site_info['site_path']):
  File "/app/data/software/lib/python2.7/site-packages/fabric/contrib/files.py", line 35, in exists
    return not func(cmd).failed
  File "/app/data/software/lib/python2.7/site-packages/fabric/network.py", line 463, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "/app/data/software/lib/python2.7/site-packages/fabric/operations.py", line 909, in run
    return _run_command(command, shell, pty, combine_stderr)
  File "/app/data/software/lib/python2.7/site-packages/fabric/operations.py", line 819, in _run_command
    stdout, stderr, status = _execute(default_channel(), wrapped_command, pty,
  File "/app/data/software/lib/python2.7/site-packages/fabric/state.py", line 340, in default_channel
    chan = connections[env.host_string].get_transport().open_session()
  File "/app/data/software/lib/python2.7/site-packages/ssh/transport.py", line 660, in open_session
    return self.open_channel('session')
  File "/app/data/software/lib/python2.7/site-packages/ssh/transport.py", line 771, in open_channel
    raise e
ChannelException: Administratively prohibited

Thoughts ?

Thanks in Advance

--
Ing. Casiva  Agustin

Mail/Msn/GTalk/Jabber: address@hidden
Skype: casivaagustin
CEL : 054-0364-154270639
Site: http://www.casivaagustin.com.ar

_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user


reply via email to

[Prev in Thread] Current Thread [Next in Thread]