def GetJobProgressRatio(self): if self.status == industry.STATUS_INSTALLED: timeLeft = blue.os.GetWallclockTime() - util.DateToBlue(self.startDate) totalTime = long(self.time.total_seconds()) * const.SEC return float(timeLeft) / totalTime elif self.status == industry.STATUS_PAUSED: timeLeft = blue.os.GetWallclockTime() - util.DateToBlue(self.startDate) totalTime = long(self.time.total_seconds()) * const.SEC return float(timeLeft) / totalTime elif self.status > industry.STATUS_COMPLETED: return 1.0 else: return 0.0
def GetJobTimeLeftLabel(self): if self.status == industry.STATUS_UNSUBMITTED: time = self.time.total_seconds() * const.SEC elif self.status == industry.STATUS_INSTALLED: time = util.DateToBlue(self.endDate) - blue.os.GetWallclockTime() elif self.status == industry.STATUS_PAUSED: time = util.DateToBlue(self.endDate) - util.DateToBlue(self.pauseDate) elif self.status == industry.STATUS_READY: time = 0 else: return '-' time = long(max(time, 0L)) return FormatTimeInterval(time)
def _PollJobCompletionThreaded(self): for job in self.installed.values(): if job.status == industry.STATUS_INSTALLED and util.DateToBlue( job.endDate) < blue.os.GetWallclockTime(): job.status = industry.STATUS_READY sm.ScatterEvent('OnIndustryJob', job.jobID, job.ownerID, job.blueprintID, job.installerID, job.status, None)
def _PollJobCompletionThreaded(self): """ Polls the weakref dictionary of loaded jobs to see if their end date has passed in which case the job is completed. Scatters an OnIndustryJob event if they change. """ for job in self.installed.values(): if job.status == industry.STATUS_INSTALLED and util.DateToBlue( job.endDate) < blue.os.GetWallclockTime(): job.status = industry.STATUS_READY sm.ScatterEvent('OnIndustryJob', job.jobID, job.ownerID, job.blueprintID, job.installerID, job.status, None)
def GetEndDateLabel(self): return util.FmtDate(util.DateToBlue(self.endDate), 'ls')
def GetStartDateLabel(self): return util.FmtDate(util.DateToBlue(self.startDate), 'ls')