本文整理汇总了Python中calibre.utils.ipc.server.Server.kill_job方法的典型用法代码示例。如果您正苦于以下问题:Python Server.kill_job方法的具体用法?Python Server.kill_job怎么用?Python Server.kill_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.utils.ipc.server.Server
的用法示例。
在下文中一共展示了Server.kill_job方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JobManager
# 需要导入模块: from calibre.utils.ipc.server import Server [as 别名]
# 或者: from calibre.utils.ipc.server.Server import kill_job [as 别名]
#.........这里部分代码省略.........
if jobs:
needs_reset = False
for job in jobs:
orig_state = job.run_state
job.update()
if orig_state != job.run_state:
needs_reset = True
if job.is_finished:
self.job_done.emit(len(self.unfinished_jobs()))
if needs_reset:
self.layoutAboutToBeChanged.emit()
self.jobs.sort()
self.layoutChanged.emit()
else:
for job in jobs:
idx = self.jobs.index(job)
self.dataChanged.emit(
self.index(idx, 0), self.index(idx, 3))
# Kill parallel jobs that have gone on too long
try:
wmax_time = gprefs['worker_max_time'] * 60
except:
wmax_time = 0
if wmax_time > 0:
for job in self.jobs:
if isinstance(job, ParallelJob):
rtime = job.running_time
if (rtime is not None and rtime > wmax_time and
job.duration is None):
job.timed_out = True
self.server.kill_job(job)
def _add_job(self, job):
self.layoutAboutToBeChanged.emit()
self.jobs.append(job)
self.jobs.sort()
self.job_added.emit(len(self.unfinished_jobs()))
self.layoutChanged.emit()
def done_jobs(self):
return [j for j in self.jobs if j.is_finished]
def unfinished_jobs(self):
return [j for j in self.jobs if not j.is_finished]
def row_to_job(self, row):
return self.jobs[row]
def has_device_jobs(self, queued_also=False):
for job in self.jobs:
if isinstance(job, DeviceJob):
if job.duration is None: # Running or waiting
if (job.is_running or queued_also):
return True
return False
def has_jobs(self):
for job in self.jobs:
if job.is_running:
return True
return False
def run_job(self, done, name, args=[], kwargs={},