本文整理汇总了Python中katello.client.core.utils.AsyncTask.cancelled方法的典型用法代码示例。如果您正苦于以下问题:Python AsyncTask.cancelled方法的具体用法?Python AsyncTask.cancelled怎么用?Python AsyncTask.cancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类katello.client.core.utils.AsyncTask
的用法示例。
在下文中一共展示了AsyncTask.cancelled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import cancelled [as 别名]
def run(self):
repo = self.get_repo()
task = AsyncTask(self.api.sync(repo['id']))
run_async_task_with_status(task, ProgressBar())
if task.succeeded():
print _("Repo [ %s ] synced" % repo['name'])
return os.EX_OK
elif task.cancelled():
print _("Repo [ %s ] synchronization cancelled" % repo['name'])
return os.EX_OK
else:
print _("Repo [ %s ] failed to sync: %s" % (repo['name'], format_sync_errors(task)) )
return os.EX_DATAERR
示例2: sync_provider
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import cancelled [as 别名]
def sync_provider(self, providerName, orgName):
prov = get_provider(orgName, providerName)
task = AsyncTask(self.api.sync(prov["id"]))
run_async_task_with_status(task, ProgressBar())
if task.failed():
errors = format_sync_errors(task)
print _("Provider [ %s ] failed to sync: %s" % (providerName, errors))
return os.EX_DATAERR
elif task.cancelled():
print _("Provider [ %s ] synchronization canceled" % providerName)
return os.EX_DATAERR
print _("Provider [ %s ] synchronized" % providerName)
return os.EX_OK
示例3: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import cancelled [as 别名]
def run(self):
orgName = self.get_option('org')
prodName = self.get_option('name')
prod = get_product(orgName, prodName)
task = AsyncTask(self.api.sync(orgName, prod["id"]))
run_async_task_with_status(task, ProgressBar())
if task.failed():
errors = [t["result"]['errors'][0] for t in task.get_hashes() if t['state'] == 'error' and
isinstance(t["result"], dict) and
"errors" in t["result"]]
print _("Product [ %s ] failed to sync: %s" % (prodName, errors))
return os.EX_DATAERR
elif task.cancelled():
print _("Product [ %s ] synchronization cancelled" % prodName)
return os.EX_DATAERR
print _("Product [ %s ] synchronized" % prodName)
return os.EX_OK