Exemple #1
0

@DDFS.add_job_mode
@DDFS.add_classic_reads
@DDFS.add_program_blobs
@DDFS.command
def xcat(program, *urls):
    """Usage: [urls ...]

    Concatenate the extracted results stored in url[s] and print to stdout.
    If any of the url[s] are tags,
    the blobs reachable from the tags will be printed after any non-tag url[s].
    """
    from itertools import chain
    from disco.core import classic_iterator
    from disco.util import iterify, reify

    tags, urls = program.separate_tags(*program.input(*urls))
    stream = reify(program.options.stream)
    reader = program.options.reader
    reader = reify(
        'disco.worker.task_io.chain_reader' if reader is None else reader)
    for record in classic_iterator(chain(urls, program.blobs(*tags)),
                                   input_stream=stream,
                                   reader=reader):
        print('\t'.join('{0}'.format(e) for e in iterify(record)).rstrip())


if __name__ == '__main__':
    DDFS(option_parser=OptionParser()).main()
Exemple #2
0
    Print the version of the Python Disco client library.
    This assumes that the library has an installed egg file."
    """
    from disco.core import client_version
    print(client_version())

@Disco.command
def master_version(program):
    """
    Print the version of the Disco master.
    This assumes that the master is running."
    """
    print(program.disco.master_version())

@Disco.job_command
def wait(program, jobname):
    """Usage: jobname

    Wait for the named job to complete and print the list of results.
    """
    from disco.util import iterify
    for result in program.disco.wait(jobname):
        print('\t'.join('{0}'.format(e,) for e in iterify(result)).rstrip())

if __name__ == '__main__':
    Disco(option_parser=OptionParser()).main()

    # Workaround for "disco test" in Python2.5 which doesn't shutdown the
    # test_server thread properly.
    sys.exit(0) # XXX still needed?