示例#1
0
 def setUp(self):
     # Start Plasma store.
     plasma_store_name, self.p1 = plasma.start_plasma_store()
     self.plasma_client = plasma.PlasmaClient(plasma_store_name)
     # Start a local scheduler.
     scheduler_name, self.p2 = photon.start_local_scheduler(
         plasma_store_name, use_valgrind=USE_VALGRIND)
     # Connect to the scheduler.
     self.photon_client = photon.PhotonClient(scheduler_name)
示例#2
0
    def setUp(self):
        # Start one Redis server and N pairs of (plasma, photon)
        redis_path = os.path.join(
            os.path.abspath(os.path.dirname(__file__)),
            "../../core/src/common/thirdparty/redis/src/redis-server")
        redis_module = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            "../../core/src/common/redis_module/libray_redis_module.so")
        assert os.path.isfile(redis_path)
        assert os.path.isfile(redis_module)
        node_ip_address = "127.0.0.1"
        redis_port = new_port()
        redis_address = "{}:{}".format(node_ip_address, redis_port)
        self.redis_process = subprocess.Popen([
            redis_path, "--port",
            str(redis_port), "--loglevel", "warning", "--loadmodule",
            redis_module
        ])
        time.sleep(0.1)
        # Create a Redis client.
        self.redis_client = redis.StrictRedis(host=node_ip_address,
                                              port=redis_port)
        # Start one global scheduler.
        self.p1 = global_scheduler.start_global_scheduler(
            redis_address, use_valgrind=USE_VALGRIND)
        self.plasma_store_pids = []
        self.plasma_manager_pids = []
        self.local_scheduler_pids = []
        self.plasma_clients = []
        self.photon_clients = []

        for i in range(NUM_CLUSTER_NODES):
            # Start the Plasma store. Plasma store name is randomly generated.
            plasma_store_name, p2 = plasma.start_plasma_store()
            self.plasma_store_pids.append(p2)
            # Start the Plasma manager.
            # Assumption: Plasma manager name and port are randomly generated by the plasma module.
            plasma_manager_name, p3, plasma_manager_port = plasma.start_plasma_manager(
                plasma_store_name, redis_address)
            self.plasma_manager_pids.append(p3)
            plasma_address = "{}:{}".format(node_ip_address,
                                            plasma_manager_port)
            plasma_client = plasma.PlasmaClient(plasma_store_name,
                                                plasma_manager_name)
            self.plasma_clients.append(plasma_client)
            # Start the local scheduler.
            local_scheduler_name, p4 = photon.start_local_scheduler(
                plasma_store_name,
                plasma_manager_name=plasma_manager_name,
                plasma_address=plasma_address,
                redis_address=redis_address,
                static_resource_list=[10, 0])
            # Connect to the scheduler.
            photon_client = photon.PhotonClient(local_scheduler_name,
                                                NIL_ACTOR_ID)
            self.photon_clients.append(photon_client)
            self.local_scheduler_pids.append(p4)
示例#3
0
 def setUp(self):
   # Start a Redis server.
   redis_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../../common/thirdparty/redis/src/redis-server")
   node_ip_address = "127.0.0.1"
   redis_port = new_port()
   redis_address = "{}:{}".format(node_ip_address, redis_port)
   self.redis_process = subprocess.Popen([redis_path, "--port", str(redis_port), "--loglevel", "warning"])
   time.sleep(0.1)
   # Create a Redis client.
   self.redis_client = redis.StrictRedis(host=node_ip_address, port=redis_port)
   # Start the global scheduler.
   self.p1 = global_scheduler.start_global_scheduler(redis_address, USE_VALGRIND)
   # Start the Plasma store.
   plasma_store_name, self.p2 = plasma.start_plasma_store()
   # Start the local scheduler.
   local_scheduler_name, self.p3 = photon.start_local_scheduler(plasma_store_name, redis_address=redis_address)
   # Connect to the scheduler.
   self.photon_client = photon.PhotonClient(local_scheduler_name)