예제 #1
0
def main(client_class):
    setupLogging()
    factory = ExperimentClientFactory({}, client_class)
    msg("Connecting to: %s:%s" % (environ['SYNC_HOST'], int(environ['SYNC_PORT'])))
    reactor.connectTCP(environ['SYNC_HOST'], int(environ['SYNC_PORT']), factory)

    reactor.exitCode = 0
    reactor.run()
    exit(reactor.exitCode)
예제 #2
0
def main(client_class):
    setupLogging()
    factory = ExperimentClientFactory({}, client_class)
    msg("Connecting to: %s:%s" % (environ['SYNC_HOST'], int(environ['SYNC_PORT'])))
    # Wait for a random amount of time before connecting to try to not overload the server when we have a lot of connections
    reactor.callLater(random() * 10,
                      lambda: reactor.connectTCP(environ['SYNC_HOST'], int(environ['SYNC_PORT']), factory))
    reactor.exitCode = 0
    reactor.run()
    exit(reactor.exitCode)
예제 #3
0
def main(client_class):
    setupLogging()
    factory = ExperimentClientFactory({}, client_class)
    msg("Connecting to: %s:%s" %
        (environ['SYNC_HOST'], int(environ['SYNC_PORT'])))
    reactor.connectTCP(environ['SYNC_HOST'], int(environ['SYNC_PORT']),
                       factory)

    reactor.exitCode = 0
    reactor.run()
    exit(reactor.exitCode)
예제 #4
0
def main(client_class):
    from gumby.instrumentation import init_instrumentation
    init_instrumentation()
    setupLogging()
    factory = ExperimentClientFactory({}, client_class)
    msg("Connecting to: %s:%s" %
        (environ['SYNC_HOST'], int(environ['SYNC_PORT'])))
    # Wait for a random amount of time before connecting to try to not overload the server when we have a lot of connections
    reactor.callLater(
        random() * 10,
        lambda: reactor.connectTCP(environ['SYNC_HOST'],
                                   int(environ['SYNC_PORT']), factory))
    reactor.exitCode = 0
    reactor.run()
    exit(reactor.exitCode)
예제 #5
0
class DummyExperimentClient(ExperimentClient):
    def startExperiment(self):
        msg("Starting dummy experiment (exiting in a couple of seconds)")
        msg("in-experiment DEFAULT_LEVEL")
        err("in-experiment ERROR_LEVEL")
        reactor.callLater(2, reactor.stop)


def main():
    factory = ExperimentClientFactory({"random_key": "random value"}, DummyExperimentClient)
    msg("Connecting to: %s:%s" % (environ['SYNC_HOST'], int(environ['SYNC_PORT'])))
    reactor.connectTCP(environ['SYNC_HOST'], int(environ['SYNC_PORT']), factory)

    reactor.exitCode = 0
    reactor.run()
    print >> stderr, "post-main STDERR"
    print >> stdout, "post-main STDOUT"
    exit(reactor.exitCode)

if __name__ == '__main__':
    print >> stderr, "pre-startLogging STDERR"
    print >> stdout, "pre-startLogging STDOUT"
    setupLogging()
    print >> stderr, "post-startLogging STDERR"
    print >> stdout, "post-startLogging STDOUT"
    main()


#
# experiment_client.py ends here
예제 #6
0
        msg("in-experiment DEFAULT_LEVEL")
        err("in-experiment ERROR_LEVEL")
        reactor.callLater(2, reactor.stop)


def main():
    factory = ExperimentClientFactory({"random_key": "random value"},
                                      DummyExperimentClient)
    msg("Connecting to: %s:%s" %
        (environ['SYNC_HOST'], int(environ['SYNC_PORT'])))
    reactor.connectTCP(environ['SYNC_HOST'], int(environ['SYNC_PORT']),
                       factory)

    reactor.exitCode = 0
    reactor.run()
    print >> stderr, "post-main STDERR"
    print >> stdout, "post-main STDOUT"
    exit(reactor.exitCode)


if __name__ == '__main__':
    print >> stderr, "pre-startLogging STDERR"
    print >> stdout, "pre-startLogging STDOUT"
    setupLogging()
    print >> stderr, "post-startLogging STDERR"
    print >> stdout, "post-startLogging STDOUT"
    main()

#
# experiment_client.py ends here