

def handle_actor_migrate(self, handle, connection, match, data, hdr):
    ' Migrate actor\n        '
    status = calvinresponse.OK
    if ('peer_node_id' in data):
        try:
            self.node.am.migrate(match.group(1), data['peer_node_id'], callback=CalvinCB(self.actor_migrate_cb, handle, connection))
        except:
            _log.exception('Migration failed')
            status = calvinresponse.INTERNAL_ERROR
    elif ('requirements' in data):
        try:
            self.node.am.update_requirements(match.group(1), data['requirements'], extend=(data['extend'] if ('extend' in data) else False), move=(data['move'] if ('move' in data) else False), callback=CalvinCB(self.actor_migrate_cb, handle, connection))
        except:
            _log.exception('Migration failed')
            status = calvinresponse.INTERNAL_ERROR
    else:
        status = calvinresponse.BAD_REQUEST
    if (status != calvinresponse.OK):
        self.send_response(handle, connection, None, status=status)

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvincontrol.py CalvinControl.handle_actor_migrate/original