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


Python execution.execute_async函数代码示例

本文整理汇总了Python中pulp.server.webservices.execution.execute_async函数的典型用法代码示例。如果您正苦于以下问题:Python execute_async函数的具体用法?Python execute_async怎么用?Python execute_async使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: POST

 def POST(self):
     orphans = self.params()
     orphan_manager = factory.content_orphan_manager()
     tags = [action_tag('delete_orphans'),
             resource_tag(dispatch_constants.RESOURCE_CONTENT_UNIT_TYPE, 'orphans')]
     call_request = CallRequest(orphan_manager.delete_orphans_by_id, [orphans], tags=tags, archive=True)
     return execution.execute_async(self, call_request)
开发者ID:jlsherrill,项目名称:pulp,代码行数:7,代码来源:contents.py

示例2: POST

    def POST(self, repo_group_id):
        params = self.params()
        distributor_id = params.get('id', None)
        overrides = params.get('override_config', None)

        if distributor_id is None:
            raise MissingValue(['id'])

        publish_manager = managers_factory.repo_group_publish_manager()

        resources = {
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE :
                    {repo_group_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE :
                    {distributor_id : dispatch_constants.RESOURCE_UPDATE_OPERATION},
            }
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
                action_tag('publish')
        ]
        weight = pulp_config.config.getint('tasks', 'publish_weight')

        call_request = CallRequest(publish_manager.publish,
                                   args=[repo_group_id, distributor_id],
                                   kwargs={'publish_config_override' : overrides},
                                   resources=resources,
                                   tags=tags,
                                   weight=weight,
                                   archive=True)

        return execution.execute_async(self, call_request)
开发者ID:stpierre,项目名称:pulp,代码行数:31,代码来源:repo_groups.py

示例3: DELETE

 def DELETE(self, content_type, content_id):
     orphan_manager = factory.content_orphan_manager()
     orphan_manager.get_orphan(content_type, content_id)
     ids = [{'content_type_id': content_type, 'unit_id': content_id}]
     tags = [resource_tag(dispatch_constants.RESOURCE_CONTENT_UNIT_TYPE, 'orphans')]
     call_request = CallRequest(orphan_manager.delete_orphans_by_id, [ids], tags=tags, archive=True)
     return execution.execute_async(self, call_request)
开发者ID:jlsherrill,项目名称:pulp,代码行数:7,代码来源:contents.py

示例4: update

 def update(self, id):
     """
     Update content (units) on a consumer.
     Expected body: {units:[], options:<dict>}
     where unit is: {type_id:<str>, unit_key={}} and the
     options is a dict of update options.
     @param id: A consumer ID.
     @type id: str
     @return: TBD
     @rtype: dict
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     resources = {
         dispatch_constants.RESOURCE_CONSUMER_TYPE:
             {id:dispatch_constants.RESOURCE_READ_OPERATION},
     }
     args = [
         id,
         units,
         options,
     ]
     manager = managers.consumer_agent_manager()
     call_request = CallRequest(
         manager.update_content,
         args,
         resources=resources,
         weight=pulp_config.config.getint('tasks', 'consumer_content_weight'),
         asynchronous=True,
         archive=True,)
     result = execution.execute_async(self, call_request)
     return result
开发者ID:ryanschneider,项目名称:pulp,代码行数:33,代码来源:consumers.py

示例5: uninstall

 def uninstall(self, consumer_group_id):
     """
     Uninstall content (units) on a consumer.
     Expected body: {units:[], options:<dict>}
     where unit is: {type_id:<str>, unit_key={}} and the
     options is a dict of uninstall options.
     @param id: A consumer ID.
     @type id: str
     @return: TBD
     @rtype: dict
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     resources = {
         dispatch_constants.RESOURCE_CONSUMER_TYPE:
             {consumer_group_id:dispatch_constants.RESOURCE_READ_OPERATION},
     }
     args = [
         consumer_group_id,
         units,
         options,
     ]
     manager = managers_factory.consumer_group_manager()
     call_request = CallRequest(
         manager.uninstall_content,
         args,
         resources=resources,
         weight=0,
         asynchronous=True,
         archive=True,)
     result = execution.execute_async(self, call_request)
     return result
开发者ID:ehelms,项目名称:pulp,代码行数:33,代码来源:consumer_groups.py

示例6: POST

    def POST(self, dest_repo_id):

        # Params
        params = self.params()
        source_repo_id = params.get('source_repo_id', None)
        overrides = params.get('override_config', None)

        if source_repo_id is None:
            raise exceptions.MissingValue(['source_repo_id'])

        criteria = params.get('criteria', None)
        if criteria is not None:
            try:
                criteria = UnitAssociationCriteria.from_client_input(criteria)
            except:
                _LOG.exception('Error parsing association criteria [%s]' % criteria)
                raise exceptions.PulpDataException(), None, sys.exc_info()[2]

        association_manager = manager_factory.repo_unit_association_manager()
        resources = {dispatch_constants.RESOURCE_REPOSITORY_TYPE: {source_repo_id: dispatch_constants.RESOURCE_READ_OPERATION,
                                                                   dest_repo_id: dispatch_constants.RESOURCE_UPDATE_OPERATION}}
        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, dest_repo_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_TYPE, source_repo_id),
                action_tag('associate')]
        call_request = CallRequest(association_manager.associate_from_repo,
                                   [source_repo_id, dest_repo_id],
                                   {'criteria': criteria, 'import_config_override': overrides},
                                   resources=resources,
                                   tags=tags,
                                   archive=True)
        return execution.execute_async(self, call_request)
开发者ID:ryanschneider,项目名称:pulp,代码行数:31,代码来源:repositories.py

示例7: POST

    def POST(self):
        """
        Creates an async task to regenerate content applicability data for given updated
        repositories.

        body {repo_criteria:<dict>}
        """
        body = self.params()
        repo_criteria = body.get('repo_criteria', None)
        if repo_criteria is None:
            raise exceptions.MissingValue('repo_criteria')
        try:
            repo_criteria = Criteria.from_client_input(repo_criteria)
        except:
            raise exceptions.InvalidValue('repo_criteria')

        manager = manager_factory.applicability_regeneration_manager()
        regeneration_tag = action_tag('applicability_regeneration')
        call_request = CallRequest(manager.regenerate_applicability_for_repos,
                                   [repo_criteria],
                                   tags = [regeneration_tag])
        # allow only one applicability regeneration task at a time
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_PROFILE_APPLICABILITY_TYPE,
                                      dispatch_constants.RESOURCE_ANY_ID)
        return execution.execute_async(self, call_request)
开发者ID:hennessy80,项目名称:pulp,代码行数:25,代码来源:repositories.py

示例8: POST

    def POST(self, repo_group_id):
        params = self.params()
        distributor_id = params.get('id', None)
        overrides = params.get('override_config', None)

        if distributor_id is None:
            raise MissingValue(['id'])

        publish_manager = managers_factory.repo_group_publish_manager()

        tags = [resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id),
                resource_tag(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id),
                action_tag('publish')
        ]
        weight = pulp_config.config.getint('tasks', 'publish_weight')

        call_request = CallRequest(publish_manager.publish,
                                   args=[repo_group_id, distributor_id],
                                   kwargs={'publish_config_override' : overrides},
                                   tags=tags,
                                   weight=weight,
                                   archive=True)
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_TYPE, repo_group_id)
        call_request.updates_resource(dispatch_constants.RESOURCE_REPOSITORY_GROUP_DISTRIBUTOR_TYPE, distributor_id)
        call_request.add_life_cycle_callback(dispatch_constants.CALL_ENQUEUE_LIFE_CYCLE_CALLBACK, publish_manager.prep_publish)

        return execution.execute_async(self, call_request)
开发者ID:ehelms,项目名称:pulp,代码行数:27,代码来源:repo_groups.py

示例9: POST

    def POST(self, repo_id):

        # Params
        params = self.params()
        distributor_id = params.get('id', None)
        overrides = params.get('override_config', None)

        call_request = publish_itinerary(repo_id, distributor_id, overrides)[0]

        return execution.execute_async(self, call_request)
开发者ID:domcleal,项目名称:pulp,代码行数:10,代码来源:repositories.py

示例10: uninstall

 def uninstall(self, id):
     """
     Uninstall content (units) on a consumer.
     Expected body: {units:[], options:<dict>}
     where unit is: {type_id:<str>, unit_key={}} and the
     options is a dict of uninstall options.
     @param id: A consumer ID.
     @type id: str
     @return: TBD
     @rtype: dict
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     call_request = consumer_content_uninstall_itinerary(id, units, options)[0]
     result = execution.execute_async(self, call_request)
     return result
开发者ID:graco,项目名称:pulp,代码行数:17,代码来源:consumers.py

示例11: uninstall

    def uninstall(self, consumer_group_id):
        """
        Uninstall content (units) from the consumers in a consumer group.
        Expected body: {units:[], options:<dict>}
        where unit is: {type_id:<str>, unit_key={}} and the
        options is a dict of uninstall options.
        @param consumer_group_id: A consumer group ID.
        @type consumer_group_id: str
        @return: list of call requests
        @rtype: list
        """
        body = self.params()
        units = body.get('units')
        options = body.get('options')

        call_request_list = consumer_group_content_uninstall_itinerary(consumer_group_id, units, options)
        results = []
        for call_request in call_request_list:
            result = execution.execute_async(self, call_request)
            results.append(result)
        return results
开发者ID:bartwo,项目名称:pulp,代码行数:21,代码来源:consumer_groups.py


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