def prepare_for_mpi_tasks(root=0, comm=None):

    if comm is None:
        from mpi4py import MPI

        comm = MPI.COMM_WORLD
    verify_mpi_communicator(comm)

    # Using a setter for the communicator protects us from operating within the
    # MPI.COMM_WORLD context
    set_task_mpi_comm(parent_comm=comm)

    # the task communicator is now behind a getter, so we need to grab it
    task_comm = get_task_mpi_comm()

    rank = task_comm.Get_rank()

    if rank == root:
        # Start dask so root reports to scheduler and accepts tasks
        # Task distribution is part of task itself (via our wrapper)
        from distributed.cli import dask_worker

        dask_worker.go()

        # As a final task, send a shutdown to the other MPI ranks
        serialized_object = serialize_function_and_args(shutdown_mpitask_worker)
        mpi_deserialize_and_execute(
            serialized_object=serialized_object, root=root, comm=task_comm
        )
    else:
        while True:
            # Calling with no serialized_object means these are non-root processes
            # We use get_task_mpi_comm() to allow for dynamic redefinition of the
            # communicator group
            mpi_deserialize_and_execute(root=root, comm=get_task_mpi_comm())
Ejemplo n.º 2
0
def prepare_for_mpi_tasks(root=0, comm=None):

    if comm is None:
        from mpi4py import MPI

        comm = MPI.COMM_WORLD
    verify_mpi_communicator(comm)

    rank = comm.Get_rank()

    if rank == root:
        # Start dask so root reports to scheduler and accepts tasks
        # Task distribution is part of task itself (via our wrapper)
        from distributed.cli import dask_worker

        dask_worker.go()

        # As a final task, send a shutdown to the other MPI ranks
        serialized_object = serialize_function_and_args(
            shutdown_mpitask_worker)
        mpi_deserialize_and_execute(serialized_object=serialized_object,
                                    root=root,
                                    comm=comm)
    else:
        while True:
            # Calling with no serialized_object means these are non-root processes
            mpi_deserialize_and_execute(root=root, comm=comm)
Ejemplo n.º 3
0
def go():
    print("The `dworker` command has been deprecated.")
    print("Please use `dask-worker` in the future.")
    print()
    from distributed.cli.dask_worker import go
    go()
Ejemplo n.º 4
0
def go():
    print("The `dworker` command has been deprecated.")
    print("Please use `dask-worker` in the future.")
    print()
    from distributed.cli.dask_worker import go
    go()


if __name__ == '__main__':
    go()
Ejemplo n.º 5
0
    cmd = sys.argv[1]
    sub_cmd = sys.argv[2:] if len(sys.argv) >= 3 else []
    sys.argv.pop(1)

    if cmd in ('help', '--help', 'h', '-h'):
        help_info()
        sys.exit()

    sys.argv[0] = cmd  # replace prog name
    temp_path = os.path.join(tempfile.gettempdir(), 'rltk', 'remote')
    if not os.path.exists(temp_path):
        os.makedirs(temp_path, exist_ok=True)
    if cmd == 'remote.worker':
        logger = logging.getLogger('distributed.dask_worker')
        logger.setLevel(logging.ERROR)
        sys.argv.append('--local-directory')
        sys.argv.append(temp_path)
        # sys.argv.append('--change-directory')
        sys.exit(dask_worker.go())
    elif cmd == 'remote.scheduler':
        logger = logging.getLogger('distributed.scheduler')
        logger.setLevel(logging.ERROR)
        sys.argv.append('--local-directory')
        sys.argv.append(temp_path)
        sys.exit(dask_scheduler.go())
    else:
        print('Unknown command\n')
        help_info()

    sys.exit()
Ejemplo n.º 6
0
def go():
    print("The `dworker` command has been deprecated.")
    print("Please use `dask-worker` in the future.")
    print()
    from distributed.cli.dask_worker import go
    go()
Ejemplo n.º 7
0
from warnings import warn

def go():
    print("The `dworker` command has been deprecated.")
    print("Please use `dask-worker` in the future.")
    print()
    from distributed.cli.dask_worker import go
    go()


if __name__ == '__main__':
    go()