<commit_before># -*- test-case-name: go.scripts.test.test_roundtrip_test -*-
import sys

from twisted.internet.defer import (maybeDeferred, inlineCallbacks,
                                    DeferredQueue)
from twisted.internet import reactor
from twisted.python import usage

from vumi.servicemaker import VumiOptions
from vumi.service import WorkerCreator
from vumi.worker import BaseWorker


class RoundTripOptions(VumiOptions):
    optParameters = [
        ["config", "c", None,
            "YAML config file to load for roundtrip test."],
    ]

    def postOptions(self):
        VumiOptions.postOptions(self)
        if not self['config']:
            raise usage.UsageError("Please provide the config parameter.")


class RoundTripTester(BaseWorker):

    WORKER_QUEUE = DeferredQueue()

    def setup_connectors(self):
        print 'setting up connectors'

    def setup_worker(self):
        print 'setup worker called'
        self.WORKER_QUEUE.put(self)


@inlineCallbacks
def main(options):
    worker_creator = WorkerCreator(options.vumi_options)
    worker_creator.create_worker_by_class(
        RoundTripTester, options)
    worker = yield RoundTripTester.WORKER_QUEUE.get()
    print worker
    reactor.stop()


if __name__ == '__main__':
    try:
        options = RoundTripOptions()
        options.parseOptions()
    except usage.UsageError, e:
        print '%s: %s' % (sys.argv[0], e)
        print '%s: Try --help for usage details.' % (sys.argv[0])
        sys.exit(1)

    def _eb(f):
        f.printTraceback()

    def _main():
        maybeDeferred(main, options).addErrback(_eb)

    reactor.callLater(0, _main)
    reactor.run()<commit_msg>Turns out we need to actually start the service.<commit_after># -*- test-case-name: go.scripts.test.test_roundtrip_test -*-
import sys

from twisted.internet.defer import (maybeDeferred, inlineCallbacks,
                                    DeferredQueue)
from twisted.internet import reactor
from twisted.python import usage

from vumi.servicemaker import VumiOptions
from vumi.service import WorkerCreator
from vumi.worker import BaseWorker


class RoundTripOptions(VumiOptions):
    optParameters = [
        ["config", "c", None,
            "YAML config file to load for roundtrip test."],
    ]

    def postOptions(self):
        VumiOptions.postOptions(self)
        if not self['config']:
            raise usage.UsageError("Please provide the config parameter.")


class RoundTripTester(BaseWorker):

    WORKER_QUEUE = DeferredQueue()

    def setup_connectors(self):
        print 'setting up connectors'

    def setup_worker(self):
        print 'setup worker called'
        self.WORKER_QUEUE.put(self)


@inlineCallbacks
def main(options):
    worker_creator = WorkerCreator(options.vumi_options)
    worker_creator.create_worker_by_class(
        RoundTripTester, options).startService()
    worker = yield RoundTripTester.WORKER_QUEUE.get()
    print worker
    reactor.stop()


if __name__ == '__main__':
    try:
        options = RoundTripOptions()
        options.parseOptions()
    except usage.UsageError, e:
        print '%s: %s' % (sys.argv[0], e)
        print '%s: Try --help for usage details.' % (sys.argv[0])
        sys.exit(1)

    def _eb(f):
        f.printTraceback()

    def _main():
        maybeDeferred(main, options).addErrback(_eb)

    reactor.callLater(0, _main)
    reactor.run()
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.002352941176470588, 'mean_word_length': 2.913693901035673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1754761', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1014, 'n_words': 251}