Ejemplo n.º 1
0
    def _start_calc_pool(self):
        mock_addr = f'127.0.0.1:{get_next_port()}'
        with self.create_pool(n_process=1, backend='gevent',
                              address=mock_addr) as pool:
            pool.create_actor(SchedulerClusterInfoActor, [mock_addr],
                              uid=SchedulerClusterInfoActor.default_uid())
            pool.create_actor(WorkerClusterInfoActor, [mock_addr],
                              uid=WorkerClusterInfoActor.default_uid())

            pool.create_actor(ChunkMetaActor, uid=ChunkMetaActor.default_uid())
            pool.create_actor(StatusActor,
                              mock_addr,
                              uid=StatusActor.default_uid())

            pool.create_actor(PlasmaKeyMapActor,
                              uid=PlasmaKeyMapActor.default_uid())
            pool.create_actor(WorkerDaemonActor,
                              uid=WorkerDaemonActor.default_uid())
            pool.create_actor(DispatchActor, uid=DispatchActor.default_uid())
            pool.create_actor(StorageManagerActor,
                              uid=StorageManagerActor.default_uid())
            pool.create_actor(IORunnerActor)
            pool.create_actor(QuotaActor,
                              1024**2,
                              uid=MemQuotaActor.default_uid())
            shared_holder_ref = pool.create_actor(
                SharedHolderActor, uid=SharedHolderActor.default_uid())
            pool.create_actor(InProcHolderActor)
            pool.create_actor(CpuCalcActor, uid=CpuCalcActor.default_uid())

            with self.run_actor_test(pool) as test_actor:
                try:
                    yield pool, test_actor
                finally:
                    shared_holder_ref.destroy()
Ejemplo n.º 2
0
def start_transfer_test_pool(**kwargs):
    address = kwargs.pop('address')
    plasma_size = kwargs.pop('plasma_size')
    with create_actor_pool(n_process=1,
                           backend='gevent',
                           address=address,
                           **kwargs) as pool:
        pool.create_actor(SchedulerClusterInfoActor, [address],
                          uid=SchedulerClusterInfoActor.default_uid())
        pool.create_actor(WorkerClusterInfoActor, [address],
                          uid=WorkerClusterInfoActor.default_uid())

        pool.create_actor(PlasmaKeyMapActor,
                          uid=PlasmaKeyMapActor.default_uid())
        pool.create_actor(StorageManagerActor,
                          uid=StorageManagerActor.default_uid())
        pool.create_actor(ChunkMetaActor, uid=ChunkMetaActor.default_uid())
        pool.create_actor(DispatchActor, uid=DispatchActor.default_uid())
        pool.create_actor(QuotaActor,
                          1024 * 1024 * 20,
                          uid=MemQuotaActor.default_uid())
        shared_holder_ref = pool.create_actor(
            SharedHolderActor,
            plasma_size,
            uid=SharedHolderActor.default_uid())
        pool.create_actor(StatusActor, address, uid=StatusActor.default_uid())
        pool.create_actor(IORunnerActor)
        pool.create_actor(StorageClientActor,
                          uid=StorageClientActor.default_uid())
        pool.create_actor(InProcHolderActor)

        yield pool

        shared_holder_ref.destroy()
Ejemplo n.º 3
0
    def create_pool(*args, **kwargs):
        from mars.worker import SharedHolderActor

        pool = create_actor_pool(*args, **kwargs)
        yield pool

        shared_ref = pool.actor_ref(SharedHolderActor.default_uid())
        if pool.has_actor(shared_ref):
            shared_ref.destroy()
Ejemplo n.º 4
0
    def testStatus(self):
        pool_address = '127.0.0.1:%d' % get_next_port()
        old_spill_dir = options.worker.spill_directory
        dir_name = options.worker.spill_directory = tempfile.mkdtemp(
            prefix='temp-mars-spill-')
        try:
            with create_actor_pool(n_process=1,
                                   backend='gevent',
                                   address=pool_address) as pool:
                pool.create_actor(SchedulerClusterInfoActor, [pool_address],
                                  uid=SchedulerClusterInfoActor.default_uid())
                pool.create_actor(WorkerClusterInfoActor, [pool_address],
                                  uid=WorkerClusterInfoActor.default_uid())

                resource_ref = pool.create_actor(
                    ResourceActor, uid=ResourceActor.default_uid())
                pool.create_actor(SharedHolderActor,
                                  self.plasma_storage_size,
                                  uid=SharedHolderActor.default_uid())
                status_ref = pool.create_actor(StatusActor,
                                               pool_address,
                                               uid=StatusActor.default_uid())
                status_ref.enable_status_upload()

                status_ref.update_slots(dict(cpu=4))
                status_ref.update_stats(dict(min_est_finish_time=10))

                def delay_read():
                    gevent.sleep(1.5)
                    return resource_ref.get_workers_meta()

                gl = gevent.spawn(delay_read)
                gl.join()
                v = gl.value
                self.assertIsNotNone(v)

                pool.destroy_actor(status_ref)
        finally:
            options.worker.spill_directory = old_spill_dir
            shutil.rmtree(dir_name)