1

We are building our application using django web framework. We are facing this very critical issue in our application. We are trying to connect to remote server using fabric library. Normally from command line we are able to connect to the server. Also it runs fine in the inbuilt server which comes in django as it runs from the command line. Command

fab get_string -H user@10.10.10.10>>django.txt 2>&1

We deployed our code in apache and the application gets stuck when it encounters this command in the function. Once in a while we get these logs

"> Using fabfile 'C:\fabfile.py'
Commands to run: generic_task_linux_django
Parallel tasks now using pool size of 1
[user@10.10.10.10] Executing task 'generic_task_linux_django'
2012-08-30 09:36:15.805000
[user@10.10.10.10] run: /bin/bash -l -c "rm -rf /tmp//admin7"
Timed out trying to connect to 10.10.10.10 (attempt 1 of 1), giving up)

Fatal error: Timed out trying to connect to 10.10.10.10 (tried 1 time)

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\tasks.py", line 298, in execute
    multiprocessing
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\tasks.py", line 197, in _execute
    return task.run(*args, **kwargs)
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\tasks.py", line 112, in run
    return self.wrapped(*args, **kwargs)
  File "C:\fabfile.py", line 314, in generic_task_linux_django
    run("rm -rf "+remote_path + '/' + local_dir_name)
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\network.py", line 457, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\operations.py", line 905, in run
    return _run_command(command, shell, pty, combine_stderr)
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\operations.py", line 815, in _run_command
    stdout, stderr, status = _execute(default_channel(), wrapped_command, pty,
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\state.py", line 340, in default_channel
    chan = connections[env.host_string].get_transport().open_session()
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\network.py", line 84, in __getitem__
    self.connect(key)
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\network.py", line 76, in connect
    self[key] = connect(user, host, port)
  File "C:\Python27\lib\site-packages\fabric-1.4.1-py2.7.egg\fabric\network.py", line 393, in connect
    raise NetworkError(msg, e)
NetworkError: Timed out trying to connect to 10.10.10.10 (tried 1 time)


Aborting."

as it is able to terminate the connection.But in majority of the cases it is getting stuck and we don’t have any logs to show.

Then we decided to run it as a windows service.We used the attached python file which creates service for us(recipe.py). Again we are facing same issue as we are facing with apache.

schneck
  • 10,556
  • 11
  • 49
  • 74

1 Answers1

1

You might want to see if your connection if failing due to ssh credentials or similar. You can get more information if you follow my suggestion here and have the ssh/paramiko lib verbosely log.

Community
  • 1
  • 1
Morgan
  • 4,143
  • 27
  • 35