Esempio n. 1
0
def _build_parallel_multiprocessing(processes):

    if processes is None or processes == 0:
        communicationChannel = concurrently.CommunicationChannel0()
    else:
        dropbox = concurrently.MultiprocessingDropbox(processes)
        communicationChannel = concurrently.CommunicationChannel(
            dropbox=dropbox)
    return Parallel(None, communicationChannel)
Esempio n. 2
0
def _build_parallel_dropbox_(workingarea_options, dispatcher_class,
                             dispatcher_options):

    workingarea = concurrently.WorkingArea(**workingarea_options)

    dispatcher = dispatcher_class(**dispatcher_options)

    dropbox = concurrently.TaskPackageDropbox(workingArea=workingarea,
                                              dispatcher=dispatcher)
    communicationChannel = concurrently.CommunicationChannel(dropbox=dropbox)

    return Parallel(None, communicationChannel, workingarea)
Esempio n. 3
0
def _build_parallel_dropbox_(workingarea_options, dropbox_options,
                             dispatcher_class, dispatcher_options):

    workingarea = concurrently.WorkingArea(**workingarea_options)

    dispatcher = dispatcher_class(**dispatcher_options)

    dropbox_options.update(dict(workingArea=workingarea,
                                dispatcher=dispatcher))
    dropbox = concurrently.TaskPackageDropbox(**dropbox_options)
    communicationChannel = concurrently.CommunicationChannel(dropbox=dropbox)

    progressMonitor = progressbar.NullProgressMonitor()

    return Parallel(progressMonitor, communicationChannel, workingarea)
Esempio n. 4
0
def _build_parallel_multiprocessing(quiet, processes):

    if quiet:
        progressBar = None
    elif sys.stdout.isatty():
        progressBar = progressbar.ProgressBar()
    else:
        progressBar = progressbar.ProgressPrint()

    if processes is None or processes == 0:
        progressMonitor = progressbar.NullProgressMonitor() if quiet else progressbar.ProgressMonitor(presentation = progressBar)
        communicationChannel = concurrently.CommunicationChannel0()
    else:
        progressMonitor = progressbar.NullProgressMonitor() if quiet else progressbar.BProgressMonitor(presentation = progressBar)
        dropbox = concurrently.MultiprocessingDropbox(processes, progressMonitor)
        communicationChannel = concurrently.CommunicationChannel(dropbox = dropbox)

    return Parallel(progressMonitor, communicationChannel)