예제 #1
0
파일: test_state.py 프로젝트: ooici/pyon
    def test_process_state(self):
        pid = "testproc_%s" % uuid.uuid4().hex
        # Create a process
        newpid = self.container.spawn_process("testproc", "pyon.ion.test.test_state", "StatefulTestProcess", process_id=pid)
        self.assertEquals(pid, newpid)

        # Send it a message to do stuff and change state
        proc_client = SampleServiceClient(to_name=pid)
        result = proc_client.sample_other_op("state1", name="setstate")
        self.assertEquals(result, "")

        # Try the force state store and load
        proc_client.sample_ping()

        # Check state
        # Kill process (not terminate)
        self.container.terminate_process(pid)

        # Restart process with prior id
        newpid = self.container.spawn_process("testproc", "pyon.ion.test.test_state", "StatefulTestProcess", process_id=pid)
        self.assertEquals(pid, newpid)

        # Send it a message to get current "preserved" state and check it's the preserved one.
        result1 = proc_client.sample_other_op(name="getstate")
        self.assertEquals(result1, "state1")
예제 #2
0
파일: test_state.py 프로젝트: ooici/pyon
    def test_process_state_concurrent(self):
        pid = "testproc_%s" % uuid.uuid4().hex
        self.container.spawn_process("testproc", "pyon.ion.test.test_state", "StatefulTestProcess", process_id=pid)

        # Send it a message to do stuff and change state
        proc_client = SampleServiceClient(to_name=pid)

        result = proc_client.sample_other_op("state1", name="concurrent")
        self.container.terminate_process(pid)
예제 #3
0
    def test_process_state(self):
        pid = "testproc_%s" % uuid.uuid4().hex
        # Create a process
        newpid = self.container.spawn_process("testproc", "pyon.ion.test.test_state", "StatefulTestProcess", process_id=pid)
        self.assertEquals(pid, newpid)

        # Send it a message to do stuff and change state
        proc_client = SampleServiceClient(to_name=pid)
        result = proc_client.sample_other_op("state1")
        self.assertEquals(result, "")

        # Try the force state store and load
        proc_client.sample_ping()

        # Check state
        # Kill process (not terminate)
        self.container.terminate_process(pid)