Ejemplo n.º 1
0
    def __init__(self, process_id, process=None):
        self.replay_process_id = process_id
        self.process = process

        if self.process:
            self.client = ReplayProcessProcessClient(process=self.process, to_name=self.replay_process_id)
        else:
            self.client = ReplayProcessClient(self.replay_process_id)
Ejemplo n.º 2
0
    def __init__(self, process_id, process=None):
        self.replay_process_id = process_id
        self.process = process

        if self.process:
            self.client = ReplayProcessProcessClient(
                process=self.process, to_name=self.replay_process_id)
        else:
            self.client = ReplayProcessClient(self.replay_process_id)
    def start_replay(self, replay_id=''):
        """
        Problem: start_replay does not return until execute replay is complete - it is all chained rpc.
        Execute replay should be a command which is fired, not RPC???
        """

        replay = self.clients.resource_registry.read(replay_id)
        pid = replay.process_id
        cli = ReplayProcessClient(name=pid)
        cli.execute_replay()
Ejemplo n.º 4
0
    def start_replay(self, replay_id=''):
        """
        Problem: start_replay does not return until execute replay is complete - it is all chained rpc.
        Execute replay should be a command which is fired, not RPC???
        """

        replay = self.clients.resource_registry.read(replay_id)
        pid = replay.process_id
        cli = ReplayProcessClient(name=pid)
        cli.execute_replay()
Ejemplo n.º 5
0
class ReplayClient(object):
    '''
    Provides a wrapper interface to a Replay Process/Agent Client.

    Use this to interact with a replay process.

    First define the replay. Then, create a ReplayClient with the process id (and process if in a process/service). Then call start_replay_agent to spin up the replay process with CEI. After the client calls start_replay_agent, a client can interact with the replay process with this client.

    replay_id, process_id = data_retreiver.define_replay(dataset_id=dataset_id, stream_id=replay_stream_id)
    replay_client = ReplayClient(process_id, process=self)

    data_retriever.start_replay_agent(replay_id)


    replay_client.start_replay()
    replay_client.pause_replay()
    replay_client.resume_replay()
    '''
    replay_process_id  = ''
    process            = None
    process_started    = False
    client             = None
    
    def __init__(self, process_id, process=None):
        self.replay_process_id = process_id
        self.process = process

        if self.process:
            self.client = ReplayProcessProcessClient(process=self.process, to_name=self.replay_process_id)
        else:
            self.client = ReplayProcessClient(self.replay_process_id)


    def await_agent_ready(self, replay_timeout=5):
        '''
        Determines if the process has been started
        @param replay_timeout Time to wait before raising a timeout
        @retval               True if the process has been started
        '''
        if self.process:
            pd_cli = ProcessDispatcherServiceProcessClient(process=self.process)
        else:
            pd_cli = ProcessDispatcherServiceClient()
        process_gate = ProcessStateGate(pd_cli.read_process, self.replay_process_id, ProcessStateEnum.RUNNING)
        return process_gate.await(replay_timeout)

    def start_replay(self):
        '''
        Begins a replay
        '''
        if not self.process_started:
            self.await_agent_ready()
            self.process_started = True

        self.client.execute_replay()

    def pause_replay(self):
        '''
        Pauses a replay
        '''
        self.client.pause()

    def resume_replay(self):
        '''
        Resumes a replay after a pause
        '''
        self.client.resume()

    def stop_replay(self):
        '''
        Stops the replay
        '''
        self.client.stop()
Ejemplo n.º 6
0
class ReplayClient(object):
    '''
    Provides a wrapper interface to a Replay Process/Agent Client.

    Use this to interact with a replay process.

    First define the replay. Then, create a ReplayClient with the process id (and process if in a process/service). Then call start_replay_agent to spin up the replay process with CEI. After the client calls start_replay_agent, a client can interact with the replay process with this client.

    replay_id, process_id = data_retreiver.define_replay(dataset_id=dataset_id, stream_id=replay_stream_id)
    replay_client = ReplayClient(process_id, process=self)

    data_retriever.start_replay_agent(replay_id)


    replay_client.start_replay()
    replay_client.pause_replay()
    replay_client.resume_replay()
    '''
    replay_process_id = ''
    process = None
    process_started = False
    client = None

    def __init__(self, process_id, process=None):
        self.replay_process_id = process_id
        self.process = process

        if self.process:
            self.client = ReplayProcessProcessClient(
                process=self.process, to_name=self.replay_process_id)
        else:
            self.client = ReplayProcessClient(self.replay_process_id)

    def await_agent_ready(self, replay_timeout=5):
        '''
        Determines if the process has been started
        @param replay_timeout Time to wait before raising a timeout
        @retval               True if the process has been started
        '''
        if self.process:
            pd_cli = ProcessDispatcherServiceProcessClient(
                process=self.process)
        else:
            pd_cli = ProcessDispatcherServiceClient()
        process_gate = ProcessStateGate(pd_cli.read_process,
                                        self.replay_process_id,
                                        ProcessStateEnum.RUNNING)
        return process_gate. await (replay_timeout)

    def start_replay(self):
        '''
        Begins a replay
        '''
        if not self.process_started:
            self.await_agent_ready()
            self.process_started = True

        self.client.execute_replay()

    def pause_replay(self):
        '''
        Pauses a replay
        '''
        self.client.pause()

    def resume_replay(self):
        '''
        Resumes a replay after a pause
        '''
        self.client.resume()

    def stop_replay(self):
        '''
        Stops the replay
        '''
        self.client.stop()