当前位置: 首页>>代码示例>>Python>>正文


Python AsyncTask.is_running方法代码示例

本文整理汇总了Python中katello.client.core.utils.AsyncTask.is_running方法的典型用法代码示例。如果您正苦于以下问题:Python AsyncTask.is_running方法的具体用法?Python AsyncTask.is_running怎么用?Python AsyncTask.is_running使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在katello.client.core.utils.AsyncTask的用法示例。


在下文中一共展示了AsyncTask.is_running方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        provName = self.get_option('name')
        orgName  = self.get_option('org')

        prov = get_provider(orgName, provName)
        if prov == None:
            return os.EX_DATAERR

        task = AsyncTask(self.api.last_sync_status(prov['id']))

        prov['last_sync'] = format_sync_time(prov['last_sync'])
        prov['sync_state'] = format_sync_state(prov['sync_state'])

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            prov['progress'] = ("%d%% done (%d of %d packages downloaded)" % (task.get_progress()*100, pkgsTotal-pkgsLeft, pkgsTotal))

        #TODO: last errors?

        self.printer.addColumn('id')
        self.printer.addColumn('name')

        self.printer.addColumn('last_sync')
        self.printer.addColumn('sync_state')
        self.printer.addColumn('progress', show_in_grep=False)

        self.printer.setHeader(_("Provider Status"))
        self.printer.printItem(prov)
        return os.EX_OK
开发者ID:jsomara,项目名称:katello,代码行数:32,代码来源:provider.py

示例2: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        provName = self.get_option('name')
        orgName  = self.get_option('org')

        prov = get_provider(orgName, provName)

        task = AsyncTask(self.api.last_sync_status(prov['id']))

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            prov['progress'] = (_("%d%% done (%d of %d packages downloaded)") % \
                (task.get_progress()*100, pkgsTotal-pkgsLeft, pkgsTotal))

        #TODO: last errors?

        self.printer.add_column('id')
        self.printer.add_column('name')

        self.printer.add_column('last_sync', formatter=format_sync_time)
        self.printer.add_column('sync_state', formatter=format_sync_state)
        self.printer.add_column('progress', show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Provider Status"))
        self.printer.print_item(prov)
        return os.EX_OK
开发者ID:Pajk,项目名称:katello,代码行数:28,代码来源:provider.py

示例3: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        provName = self.get_option("name")
        orgName = self.get_option("org")

        prov = get_provider(orgName, provName)

        task = AsyncTask(self.api.last_sync_status(prov["id"]))

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            prov["progress"] = _("%d%% done (%d of %d packages downloaded)") % (
                task.get_progress() * 100,
                pkgsTotal - pkgsLeft,
                pkgsTotal,
            )

        # TODO: last errors?

        self.printer.add_column("id")
        self.printer.add_column("name")

        self.printer.add_column("last_sync", formatter=format_sync_time)
        self.printer.add_column("sync_state", formatter=format_sync_state)
        self.printer.add_column("progress", show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Provider Status"))
        self.printer.print_item(prov)
        return os.EX_OK
开发者ID:gstoeckel,项目名称:katello,代码行数:31,代码来源:provider.py

示例4: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        orgName     = self.get_option('org')
        prodName    = self.get_option('name')

        prod = get_product(orgName, prodName)
        if (prod == None):
            return os.EX_DATAERR

        task = AsyncTask(self.api.last_sync_status(orgName, prod['id']))

        prod['last_sync'] = format_sync_time(prod['last_sync'])
        prod['sync_state'] = format_sync_state(prod['sync_state'])

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            prod['progress'] = ("%d%% done (%d of %d packages downloaded)" % (task.get_progress()*100, pkgsTotal-pkgsLeft, pkgsTotal))

        #TODO: last errors?

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('provider_id')
        self.printer.add_column('provider_name')
        self.printer.add_column('last_sync')
        self.printer.add_column('sync_state')
        self.printer.add_column('progress', show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Product Status"))
        self.printer.print_item(prod)
        return os.EX_OK
开发者ID:ohadlevy,项目名称:katello,代码行数:33,代码来源:product.py

示例5: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        orgName     = self.get_option('org')
        prodName    = self.get_option('name')
        prodLabel   = self.get_option('label')
        prodId      = self.get_option('id')

        prod = get_product(orgName, prodName, prodLabel, prodId)

        task = AsyncTask(self.api.last_sync_status(orgName, prod['id']))

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            prod['progress'] = ("%d%% done (%d of %d packages downloaded)" %
                (task.get_progress()*100, pkgsTotal-pkgsLeft, pkgsTotal))

        #TODO: last errors?

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'provider_id': _("Provider ID")}, {'provider_name': _("Provider Name")})
        self.printer.add_column('last_sync', _("Last Sync"), formatter=format_sync_time)
        self.printer.add_column('sync_state', _("Sync State"), formatter=format_sync_state)
        self.printer.add_column('progress', _("Progress"), show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Product Status"))
        self.printer.print_item(prod)
        return os.EX_OK
开发者ID:chiehwen,项目名称:katello,代码行数:29,代码来源:product.py

示例6: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        repo = self.get_repo()

        task = AsyncTask(self.api.last_sync_status(repo['id']))

        repo['last_sync'] = format_sync_time(repo['last_sync'])
        repo['sync_state'] = format_sync_state(repo['sync_state'])
        if 'next_scheduled_sync' in repo:
            repo['next_scheduled_sync'] = format_sync_time(repo['next_scheduled_sync'])

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            repo['progress'] = ("%d%% done (%d of %d packages downloaded)" % (task.get_progress()*100, pkgsTotal-pkgsLeft, pkgsTotal))

        repo['last_errors'] = format_sync_errors(task)

        self.printer.addColumn('package_count')
        self.printer.addColumn('last_sync')
        self.printer.addColumn('sync_state')
        if 'next_scheduled_sync' in repo:
            self.printer.addColumn('next_scheduled_sync')
        self.printer.addColumn('progress', show_in_grep=False)
        self.printer.addColumn('last_errors', multiline=True, show_in_grep=False)

        self.printer.setHeader(_("Repository Status"))
        self.printer.printItem(repo)
        return os.EX_OK
开发者ID:jsomara,项目名称:katello,代码行数:30,代码来源:repo.py

示例7: run

# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import is_running [as 别名]
    def run(self):
        repo = self.get_repo()

        task = AsyncTask(self.api.last_sync_status(repo['id']))

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            repo['progress'] = ("%(task_progress)d%% done (%(pkgs_count)d of %(pkgs_total)d packages downloaded)" % 
                {'task_progress':task.get_progress()*100, 'pkgs_count':pkgsTotal-pkgsLeft, 'pkgs_total':pkgsTotal})

        repo['last_errors'] = format_sync_errors(task)

        self.printer.add_column('package_count', _("Package Count"))
        self.printer.add_column('last_sync', _("Last Sync"), formatter=format_sync_time)
        self.printer.add_column('sync_state', _("Sync State"), formatter=format_sync_state)
        if 'next_scheduled_sync' in repo:
            self.printer.add_column('next_scheduled_sync', _("Next Scheduled Sync"), formatter=format_sync_time)
        self.printer.add_column('progress', _("Progress"), show_with=printer.VerboseStrategy)
        self.printer.add_column('last_errors', _("Last Errors"), multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Repository Status"))
        self.printer.print_item(repo)
        return os.EX_OK
开发者ID:chiehwen,项目名称:katello,代码行数:26,代码来源:repo.py


注:本文中的katello.client.core.utils.AsyncTask.is_running方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。