Move gear import to a safe place

Importing gear now imports statsd which initializes a socket
before the fork for geard.  Move the gear import to avoid that
until a better solution is worked out.

Change-Id: I7c1d9911a3b9de072b4784c4af9543baf1aefc27
This commit is contained in:
James E. Blair 2014-01-09 07:04:37 +08:00
parent 200b5d566a
commit dda083b9fb
1 changed files with 2 additions and 2 deletions

View File

@ -30,11 +30,10 @@ import sys
import signal
import traceback
import gear
# No zuul imports here because they pull in paramiko which must not be
# imported until after the daemonization.
# https://github.com/paramiko/paramiko/issues/59
# Similar situation with gear and statsd.
def stack_dump_handler(signum, frame):
@ -149,6 +148,7 @@ class Server(object):
if child_pid == 0:
os.close(pipe_write)
self.setup_logging('gearman_server', 'log_config')
import gear
gear.Server(4730)
# Keep running until the parent dies:
pipe_read = os.fdopen(pipe_read)