예제 #1
0
 def runx(self):
     self._com = Dispatcher(moduleName='client-%s-%d' % (platform.node(), os.getpid()))
     self._proxy = DaemonProxy(self._opts,
                               dispatcher=self._com,
                               lineHandler=self.handleDaemonLine,
                               connectHandler=self.handleDaemonConnect)
     self._proxy.open()
     self._com.connect('console:', lineHandler=self.handleStdinLine)
     self._printIfInteractive('example commands: "start bc", "stop bc", "get status.bc"\n')
     self._prompt()
     self._com.runForever()
예제 #2
0
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__

# used this for debugging an intermittent problem with connecting
# to pyraptord over tcp.  the problem seems to be gone now but
# the tester may still be useful.

from geocamPycroraptor.DaemonProxy import DaemonProxy


def handleLine(sock, line):
    print 'testProxy: line =', line


pyraptordProxy = DaemonProxy(lineHandler=handleLine)


def waitOnce():
    print 'testProxy: sending get status'
    _retCode, namespace = pyraptordProxy.returnGetResponse('status')
    taskStatus = namespace['status']
    print 'testProxy: status =', taskStatus
    pyraptordProxy.close()
    print 'testProxy: closed'


for i in xrange(0, 3):
    waitOnce()