当前位置: 首页>>代码示例>>Python>>正文


Python State.isErrored方法代码示例

本文整理汇总了Python中uds.core.util.State.State.isErrored方法的典型用法代码示例。如果您正苦于以下问题:Python State.isErrored方法的具体用法?Python State.isErrored怎么用?Python State.isErrored使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uds.core.util.State.State的用法示例。


在下文中一共展示了State.isErrored方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkAndUpdateState

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isErrored [as 别名]
 def checkAndUpdateState(userService, userServiceInstance, state):
     """
     Checks the value returned from invocation to publish or checkPublishingState, updating the servicePoolPub database object
     Return True if it has to continue checking, False if finished
     """
     try:
         if State.isFinished(state):
             checkLater = False
             userServiceInstance.finish()
             userService.updateData(userServiceInstance)
             userService.setState(State.USABLE)  # Wi will only migrate fully functional services
         elif State.isErrored(state):
             checkLater = False
             userService.updateData(userServiceInstance)
             userService.setState(State.ERROR)
         else:
             checkLater = True  # The task is running
             userService.updateData(userServiceInstance)
         userService.save()
         if checkLater:
             ClusterMigrationTask.checkLater(userService, userServiceInstance)
     except Exception as e:
         logger.exception('Migrating service')
         log.doLog(userService, log.ERROR, 'Exception: {0}'.format(e), log.INTERNAL)
         userService.setState(State.ERROR)
         userService.save()
开发者ID:glyptodon,项目名称:openuds,代码行数:28,代码来源:ClusteredProviderManagement.py

示例2: getItems

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isErrored [as 别名]
 def getItems(self, parent, item):
     return [{
         'id': i.uuid,
         'revision': i.revision,
         'publish_date': i.publish_date,
         'state': i.state,
         'reason': State.isErrored(i.state) and i.getInstance().reasonOfError() or '',
         'state_date': i.state_date,
     } for i in parent.publications.all()]
开发者ID:dkmstr,项目名称:openuds,代码行数:11,代码来源:user_services.py

示例3: checkAndUpdateState

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isErrored [as 别名]
    def checkAndUpdateState(userService, userServiceInstance, state):
        '''
        Checks the value returned from invocation to publish or checkPublishingState, updating the servicePoolPub database object
        Return True if it has to continue checking, False if finished
        '''
        try:
            prevState = userService.state
            userService.unique_id = userServiceInstance.getUniqueId()  # Updates uniqueId
            userService.friendly_name = userServiceInstance.getName()  # And name, both methods can modify serviceInstance, so we save it later
            if State.isFinished(state):
                checkLater = False
                userServiceInstance.finish()
                if State.isPreparing(prevState):
                    if userServiceInstance.service().publicationType is None or userService.publication == userService.deployed_service.activePublication():
                        userService.setState(State.USABLE)
                        # and make this usable if os manager says that it is usable, else it pass to configuring state
                        if userServiceInstance.osmanager() is not None and userService.os_state == State.PREPARING:  # If state is already "Usable", do not recheck it
                            stateOs = userServiceInstance.osmanager().checkState(userService)
                            # If state is finish, we need to notify the userService again that os has finished
                            if State.isFinished(stateOs):
                                state = userServiceInstance.notifyReadyFromOsManager('')
                                userService.updateData(userServiceInstance)
                        else:
                            stateOs = State.FINISHED

                        if State.isRuning(stateOs):
                            userService.setOsState(State.PREPARING)
                        else:
                            userService.setOsState(State.USABLE)
                    else:
                        # We ignore OsManager info and if userService don't belong to "current" publication, mark it as removable
                        userService.setState(State.REMOVABLE)
                elif State.isRemoving(prevState):
                    if userServiceInstance.osmanager() is not None:
                        userServiceInstance.osmanager().release(userService)
                    userService.setState(State.REMOVED)
                else:
                    # Canceled,
                    logger.debug("Canceled us {2}: {0}, {1}".format(prevState, State.toString(state), State.toString(userService)))
                    userService.setState(State.CANCELED)
                    userServiceInstance.osmanager().release(userService)
                userService.updateData(userServiceInstance)
            elif State.isErrored(state):
                checkLater = False
                userService.updateData(userServiceInstance)
                userService.setState(State.ERROR)
            else:
                checkLater = True  # The task is running
                userService.updateData(userServiceInstance)
            userService.save()
            if checkLater:
                UserServiceOpChecker.checkLater(userService, userServiceInstance)
        except Exception as e:
            logger.exception('Checking service state')
            log.doLog(userService, log.ERROR, 'Exception: {0}'.format(e), log.INTERNAL)
            userService.setState(State.ERROR)
            userService.save()
开发者ID:aiminickwong,项目名称:openuds,代码行数:59,代码来源:UserServiceManager.py

示例4: getItems

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isErrored [as 别名]
 def getItems(self, parent, item):
     return [
         {
             "id": i.uuid,
             "revision": i.revision,
             "publish_date": i.publish_date,
             "state": i.state,
             "reason": State.isErrored(i.state) and i.getInstance().reasonOfError() or "",
             "state_date": i.state_date,
         }
         for i in parent.publications.all()
     ]
开发者ID:AlexeyBychkov,项目名称:openuds,代码行数:14,代码来源:user_services.py

示例5: checkAndUpdateState

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isErrored [as 别名]
    def checkAndUpdateState(servicePoolPub, pi, state):
        """
        Checks the value returned from invocation to publish or checkPublishingState, updating the servicePoolPub database object
        Return True if it has to continue checking, False if finished
        """
        try:
            prevState = servicePoolPub.state
            checkLater = False
            if State.isFinished(state):
                # Now we mark, if it exists, the previous usable publication as "Removable"
                if State.isPreparing(prevState):
                    for old in servicePoolPub.deployed_service.publications.filter(state=State.USABLE):
                        old.state = State.REMOVABLE
                        old.save()

                        osm = servicePoolPub.deployed_service.osmanager
                        # If os manager says "machine is persistent", do not tray to delete "previous version" assigned machines
                        doPublicationCleanup = True if osm is None else not osm.getInstance().isPersistent()

                        if doPublicationCleanup:
                            pc = PublicationOldMachinesCleaner(old.id)
                            pc.register(GlobalConfig.SESSION_EXPIRE_TIME.getInt(True) * 3600, 'pclean-' + str(old.id), True)

                    servicePoolPub.setState(State.USABLE)
                    servicePoolPub.deployed_service.markOldUserServicesAsRemovables(servicePoolPub)
                elif State.isRemoving(prevState):
                    servicePoolPub.setState(State.REMOVED)
                else:  # State is canceling
                    servicePoolPub.setState(State.CANCELED)
                # Mark all previous publications deployed services as removables
                # and make this usable
                pi.finish()
                servicePoolPub.updateData(pi)
            elif State.isErrored(state):
                servicePoolPub.updateData(pi)
                servicePoolPub.state = State.ERROR
            else:
                checkLater = True  # The task is running
                servicePoolPub.updateData(pi)

            servicePoolPub.save()
            if checkLater:
                PublicationFinishChecker.checkLater(servicePoolPub, pi)
        except Exception:
            logger.exception('At checkAndUpdate for publication')
            PublicationFinishChecker.checkLater(servicePoolPub, pi)
开发者ID:glyptodon,项目名称:openuds,代码行数:48,代码来源:PublicationManager.py


注:本文中的uds.core.util.State.State.isErrored方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。