def new_from_migration(self, actor_type, state, prev_connections=None, callback=None): """Instantiate an actor of type 'actor_type' and apply the 'state' to the actor.""" try: _log.analyze(self.node.id, "+", state) subject_attributes = state.pop('subject_attributes', None) migration_info = state.pop('migration_info', None) try: state['_managed'].remove('subject_attributes') state['_managed'].remove('migration_info') except: pass if security_enabled(): security = Security(self.node) security.set_subject_attributes(subject_attributes) else: security = None actor_def, signer = self.lookup_and_verify(actor_type, security) requirements = actor_def.requires if hasattr(actor_def, "requires") else [] self.check_requirements_and_sec_policy(requirements, security, state['id'], signer, migration_info, CalvinCB(self.new, actor_type, None, state, prev_connections, callback=callback, actor_def=actor_def, security=security)) except Exception: # Still want to create shadow actor. self.new(actor_type, None, state, prev_connections, callback=callback, shadow_actor=True)
def new_from_migration(self, actor_type, state, prev_connections=None, connection_list=None, callback=None): """Instantiate an actor of type 'actor_type' and apply the 'state' to the actor.""" try: _log.analyze(self.node.id, "+", state) subject_attributes = state['security'].pop('_subject_attributes', None) migration_info = state['private'].pop('_migration_info', None) try: state['security'].remove('_subject_attributes') state['private'].remove('_migration_info') except: pass if security_enabled(): security = Security(self.node) security.set_subject_attributes(subject_attributes) else: security = None actor_def, signer = self.lookup_and_verify(actor_type, security) requirements = actor_def.requires if hasattr( actor_def, "requires") else [] self.check_requirements_and_sec_policy( requirements, security, state['private']['_id'], signer, migration_info, CalvinCB(self.new, actor_type, None, state, prev_connections=prev_connections, connection_list=connection_list, callback=callback, actor_def=actor_def, security=security)) except Exception: # Still want to create shadow actor. self.new(actor_type, None, state, prev_connections=prev_connections, connection_list=connection_list, callback=callback, shadow_actor=True)