def main(reactor, args):
    try:
        options = Options()
        options.parseOptions(args)
    except usage.UsageError as e:
        print(e.args[0], file=sys.stderr)
        print('', file=sys.stderr)
        print(str(options), file=sys.stderr)
        raise SystemExit(1)

    server_url = b"http://{}:{}".format(
        options['address'], options['port'],
    )

    try:
        result_input = sys.stdin.read()
        result = json.loads(result_input)
    except __HOLE__ as e:
        print(result_input, file=sys.stderr)
        print(
            "Standard input is not valid JSON document: {}".format(e.message),
            file=sys.stderr,
        )
        raise SystemExit(1)

    d = submit(server_url, result)

    def succeeded(result_id):
        print("Assigned result ID: {}".format(result_id))

    def failed(failure):
        failure.trap(SubmitFailure)
        print("Failed to submit the result: {}".format(failure.value),
              file=sys.stderr)
        raise SystemExit(1)

    d.addCallbacks(succeeded, failed)
    return d
dataset/ETHPy150Open ClusterHQ/flocker/benchmark/submit.py/main