當前位置: 首頁>>代碼示例>>Python>>正文


Python JobItem.load方法代碼示例

本文整理匯總了Python中twext.enterprise.jobs.jobitem.JobItem.load方法的典型用法代碼示例。如果您正苦於以下問題:Python JobItem.load方法的具體用法?Python JobItem.load怎麽用?Python JobItem.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在twext.enterprise.jobs.jobitem.JobItem的用法示例。


在下文中一共展示了JobItem.load方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: checkTemporaryFailure

# 需要導入模塊: from twext.enterprise.jobs.jobitem import JobItem [as 別名]
# 或者: from twext.enterprise.jobs.jobitem.JobItem import load [as 別名]
    def checkTemporaryFailure(self, results):
        """
        Check to see whether whether a temporary failure should be raised as opposed to continuing on with a permanent failure.

        @param results: set of results gathered in L{extractSchedulingResponse}
        @type results: L{list}
        """
        if all([result[1] == iTIPRequestStatus.MESSAGE_PENDING_CODE for result in results]):
            job = yield JobItem.load(self.transaction, self.jobID)
            if job.failed >= config.Scheduling.Options.WorkQueues.MaxTemporaryFailures:
                # Set results to SERVICE_UNAVAILABLE
                for ctr, result in enumerate(results):
                    results[ctr] = (result[0], iTIPRequestStatus.SERVICE_UNAVAILABLE_CODE,)
                returnValue(None)
            else:
                raise JobTemporaryError(config.Scheduling.Options.WorkQueues.TemporaryFailureDelay)
開發者ID:eventable,項目名稱:CalendarServer,代碼行數:18,代碼來源:work.py

示例2: afterWork

# 需要導入模塊: from twext.enterprise.jobs.jobitem import JobItem [as 別名]
# 或者: from twext.enterprise.jobs.jobitem.JobItem import load [as 別名]
    def afterWork(self):
        """
        A hook that gets called after the L{WorkItem} does its real work. This can be used
        for common clean-up behaviors. The base implementation does nothing.
        """
        yield super(ScheduleWorkMixin, self).afterWork()

        # Find the next item and schedule to run immediately after this.
        # We only coalesce ScheduleOrganizerSendWork.
        if self.workType() == ScheduleOrganizerSendWork.workType():
            all = yield self.baseWork.query(
                self.transaction,
                (ScheduleWork.icalendarUID == self.icalendarUID).And(ScheduleWork.workID != self.workID),
                order=ScheduleWork.workID,
                limit=1,
            )
            if all:
                work = all[0]
                if work.workType == self.workType():
                    job = yield JobItem.load(self.transaction, work.jobID)
                    yield job.update(notBefore=datetime.datetime.utcnow())
                    log.debug("ScheduleOrganizerSendWork - promoted job: {id}, UID: '{uid}'", id=work.workID, uid=self.icalendarUID)
開發者ID:eventable,項目名稱:CalendarServer,代碼行數:24,代碼來源:work.py


注:本文中的twext.enterprise.jobs.jobitem.JobItem.load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。