예제 #1
0
파일: replay.py 프로젝트: pepribas/F3AT
 def apply_snapshot(self, entry):
     old_agent, old_protocols = self.agent, self.protocols
     self.reset()
     args, kwargs = replay.replay(entry, entry.get_arguments)
     self._restore_snapshot(*args, **kwargs)
     self._check_snapshot(old_agent, old_protocols)
     self.agent_type = self.agent.descriptor_type
예제 #2
0
파일: replay.py 프로젝트: zaheerm/feat
    def replay_agency_entry(self, entry):
        # Special case for snapshot call, because we don't want
        # to unserialize any arguments before reseting the registry.
        if entry.function_id == "snapshot":
            self.apply_snapshot(entry)
            return

        self._log_entry(entry)

        method = getattr(self, "effect_%s" % entry.function_id)
        args, kwargs = entry.get_arguments()
        return replay.replay(entry, method, *args, **kwargs)
예제 #3
0
파일: replay.py 프로젝트: zaheerm/feat
 def apply_snapshot(self, entry):
     old_agent, old_protocols = self.agent, self.protocols
     self.reset()
     self.set_current_time(entry._timestamp)
     args, _kwargs = replay.replay(entry, entry.get_arguments)
     if not args:
         # we can get entry without the arguments in case it was
         # impossible to serialize the snapshot of the agent
         raise ReplayError("Malformed agent snapshot, reason: %r" % (entry.result,))
     snapshot = args[0]
     self._restore_snapshot(snapshot)
     self._check_snapshot(old_agent, old_protocols)
     self.agent_type = self.agent.descriptor_type