本文整理汇总了Python中calibre.utils.ipc.server.Server.run_job方法的典型用法代码示例。如果您正苦于以下问题:Python Server.run_job方法的具体用法?Python Server.run_job怎么用?Python Server.run_job使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.utils.ipc.server.Server
的用法示例。
在下文中一共展示了Server.run_job方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JobManager
# 需要导入模块: from calibre.utils.ipc.server import Server [as 别名]
# 或者: from calibre.utils.ipc.server.Server import run_job [as 别名]
#.........这里部分代码省略.........
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={},
description='', core_usage=1):
job = ParallelJob(name, description, done, args=args, kwargs=kwargs)
job.core_usage = core_usage
self.add_job(job)
self.server.add_job(job)
return job
def run_threaded_job(self, job):
self.add_job(job)
self.threaded_server.add_job(job)
def launch_gui_app(self, name, args=[], kwargs={}, description=''):
job = ParallelJob(name, description, lambda x: x,
args=args, kwargs=kwargs)
self.server.run_job(job, gui=True, redirect_output=False)
def _kill_job(self, job):
if isinstance(job, ParallelJob):
self.server.kill_job(job)
elif isinstance(job, ThreadedJob):
self.threaded_server.kill_job(job)
else:
job.kill_on_start = True
def hide_jobs(self, rows):
for r in rows:
self.jobs[r].hidden_in_gui = True
for r in rows:
self.dataChanged.emit(self.index(r, 0), self.index(r, 0))
def show_hidden_jobs(self):
for j in self.jobs: