• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python client.saharaclient函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self, request, *args, **kwargs):
        super(JobConfigAction, self).__init__(request, *args, **kwargs)
        job_ex_id = request.REQUEST.get("job_execution_id")
        if job_ex_id is not None:
            client = saharaclient(request)
            job_ex_id = request.REQUEST.get("job_execution_id")
            job_ex = client.job_executions.get(job_ex_id)
            job_configs = job_ex.job_configs
            edp_configs = {}

            if 'configs' in job_configs:
                configs, edp_configs = (
                    self.clean_edp_configs(job_configs['configs']))
                self.fields['job_configs'].initial = (
                    json.dumps(configs))

            if 'params' in job_configs:
                self.fields['job_params'].initial = (
                    json.dumps(job_configs['params']))
            job_args = json.dumps(job_configs['args'])
            self.fields['job_args_array'].initial = job_args

            if self.MAIN_CLASS in edp_configs:
                self.fields['main_class'].initial = (
                    edp_configs[self.MAIN_CLASS])
            if self.JAVA_OPTS in edp_configs:
                self.fields['java_opts'].initial = (
                    edp_configs[self.JAVA_OPTS])

            if self.EDP_MAPPER in edp_configs:
                self.fields['streaming_mapper'].initial = (
                    edp_configs[self.EDP_MAPPER])
            if self.EDP_REDUCER in edp_configs:
                self.fields['streaming_reducer'].initial = (
                    edp_configs[self.EDP_REDUCER])
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:35,代码来源:launch.py


示例2: handle

    def handle(self, request, context):
        sahara = saharaclient(request)
        node_groups = None

        plugin, hadoop_version = (
            whelpers.get_plugin_and_hadoop_version(request))

        ct_id = context["cluster_general_cluster_template"] or None
        user_keypair = context["cluster_general_keypair"] or None

        cluster = sahara.clusters.create(
            context["cluster_general_cluster_name"],
            plugin, hadoop_version,
            cluster_template_id=ct_id,
            default_image_id=context["cluster_general_image"],
            description=context["cluster_general_description"],
            node_groups=node_groups,
            user_keypair_id=user_keypair,
            is_transient=not(context["cluster_general_persist_cluster"]),
            net_id=context.get("cluster_general_neutron_management_network",
                               None))

        sahara.job_executions.create(
            context["job_general_job"],
            cluster.id,
            context["job_general_job_input"],
            context["job_general_job_output"],
            context["job_config"])

        return True
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:30,代码来源:launch.py


示例3: get_object

 def get_object(self, *args, **kwargs):
     if not hasattr(self, "_object"):
         template_id = self.kwargs['template_id']
         sahara = saharaclient(self.request)
         template = sahara.cluster_templates.get(template_id)
         self._object = template
     return self._object
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:7,代码来源:views.py


示例4: populate_anti_affinity_choices

def populate_anti_affinity_choices(self, request, context):
    sahara = saharaclient(request)
    plugin, version = whelpers.get_plugin_and_hadoop_version(request)

    version_details = sahara.plugins.get_version_details(plugin, version)
    process_choices = []
    for service, processes in version_details.node_processes.items():
        for process in processes:
            process_choices.append((process, process))

    cluster_template_id = request.REQUEST.get("cluster_template_id", None)
    if cluster_template_id is None:
        selected_processes = request.REQUEST.get("aa_groups", [])
    else:
        cluster_template = sahara.cluster_templates.get(cluster_template_id)
        selected_processes = cluster_template.anti_affinity

    checked_dict = dict()

    for process in selected_processes:
        checked_dict[process] = process

    self.fields['anti_affinity'].initial = checked_dict

    return process_choices
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:25,代码来源:anti_affinity.py


示例5: get_context_data

    def get_context_data(self, request):
        cluster_id = self.tab_group.kwargs['cluster_id']
        sahara = saharaclient(request)
        cluster = sahara.clusters.get(cluster_id)

        for info_key, info_val in cluster.info.items():
            for key, val in info_val.items():
                if str(val).startswith(('http://', 'https://')):
                    cluster.info[info_key][key] = build_link(val)

        base_image = glance.image_get(request,
                                      cluster.default_image_id)

        if getattr(cluster, 'cluster_template_id', None):
            cluster_template = helpers.safe_call(sahara.cluster_templates.get,
                                                 cluster.cluster_template_id)
        else:
            cluster_template = None

        if getattr(cluster, 'neutron_management_network', None):
            net_id = cluster.neutron_management_network
            network = neutron.network_get(request, net_id)
            network.set_id_as_name_if_empty()
            net_name = network.name
        else:
            net_name = None

        return {"cluster": cluster,
                "base_image": base_image,
                "cluster_template": cluster_template,
                "network": net_name}
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:31,代码来源:tabs.py


示例6: populate_property_name_choices

 def populate_property_name_choices(self, request, context):
     client = saharaclient(request)
     job_id = request.REQUEST.get("job_id") or request.REQUEST.get("job")
     job_type = client.jobs.get(job_id).type
     job_configs = client.jobs.get_configs(job_type).job_config
     choices = [(param['value'], param['name'])
                for param in job_configs['configs']]
     return choices
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:8,代码来源:launch.py


示例7: populate_job_choices

    def populate_job_choices(self, request):
        sahara = saharaclient(request)
        jobs = sahara.jobs.list()

        choices = [(job.id, job.name)
                   for job in jobs]

        return choices
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:8,代码来源:launch.py


示例8: populate_cluster_choices

    def populate_cluster_choices(self, request, context):
        sahara = saharaclient(request)
        clusters = sahara.clusters.list()

        choices = [(cluster.id, cluster.name)
                   for cluster in clusters]

        return choices
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:8,代码来源:launch.py


示例9: populate_main_binary_choices

    def populate_main_binary_choices(self, request, context):
        sahara = saharaclient(request)
        job_binaries = sahara.job_binaries.list()

        choices = [(job_binary.id, job_binary.name)
                   for job_binary in job_binaries]
        choices.insert(0, ('', '-- not selected --'))
        return choices
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:8,代码来源:create.py


示例10: get_data_source_choices

    def get_data_source_choices(self, request, context):
        sahara = saharaclient(request)
        data_sources = sahara.data_sources.list()

        choices = [(data_source.id, data_source.name)
                   for data_source in data_sources]
        choices.insert(0, (None, 'None'))

        return choices
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:9,代码来源:launch.py


示例11: get

 def get(self, request, *args, **kwargs):
     if request.is_ajax():
         if request.REQUEST.get("json", None):
             job_id = request.REQUEST.get("job_id")
             sahara = saharaclient(request)
             job_type = sahara.jobs.get(job_id).type
             return HttpResponse(json.dumps({"job_type": job_type}),
                                 mimetype='application/json')
     return super(LaunchJobView, self).get(request, args, kwargs)
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:9,代码来源:views.py


示例12: handle

 def handle(self, request, context):
     sahara = saharaclient(request)
     sahara.data_sources.create(
         context["general_data_source_name"],
         context["general_data_source_description"],
         context["general_data_source_type"],
         context["source_url"],
         context.get("general_data_source_credential_user", None),
         context.get("general_data_source_credential_pass", None))
     return True
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:10,代码来源:create.py


示例13: get_data

 def get_data(self, request, instance_id):
     sahara = saharaclient(request)
     try:
         return sahara.clusters.get(instance_id)
     except api_base.APIException as e:
         if e.error_code == 404:
             # returning 404 to the ajax call removes the
             # row from the table on the ui
             raise Http404
         else:
             messages.error(request, e)
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:11,代码来源:tables.py


示例14: __init__

    def __init__(self, request, context_seed, entry_point, *args, **kwargs):
        sahara = saharaclient(request)

        template_id = context_seed["template_id"]
        template = sahara.cluster_templates.get(template_id)
        self._set_configs_to_copy(template.cluster_configs)

        request.GET = request.GET.copy()
        request.GET.update({"plugin_name": template.plugin_name})
        request.GET.update({"hadoop_version": template.hadoop_version})
        request.GET.update({"aa_groups": template.anti_affinity})

        super(CopyClusterTemplate, self).__init__(request, context_seed,
                                                  entry_point, *args,
                                                  **kwargs)

        #init Node Groups

        for step in self.steps:
            if isinstance(step, create_flow.ConfigureNodegroups):
                ng_action = step.action
                template_ngs = template.node_groups

                if 'forms_ids' not in request.POST:
                    ng_action.groups = []
                    for id in range(0, len(template_ngs), 1):
                        group_name = "group_name_" + str(id)
                        template_id = "template_id_" + str(id)
                        count = "count_" + str(id)
                        templ_ng = template_ngs[id]
                        ng_action.groups.append(
                            {"name": templ_ng["name"],
                             "template_id": templ_ng["node_group_template_id"],
                             "count": templ_ng["count"],
                             "id": id,
                             "deletable": "true"})

                        build_node_group_fields(ng_action,
                                                group_name,
                                                template_id,
                                                count)

            elif isinstance(step, create_flow.GeneralConfig):
                fields = step.action.fields

                fields["cluster_template_name"].initial = \
                    template.name + "-copy"

                fields["description"].initial = template.description
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:49,代码来源:copy.py


示例15: get_cluster_instances_data

    def get_cluster_instances_data(self):
        cluster_id = self.tab_group.kwargs['cluster_id']
        sahara = saharaclient(self.request)
        cluster = sahara.clusters.get(cluster_id)

        instances = []
        for ng in cluster.node_groups:
            for instance in ng["instances"]:
                instances.append(Instance(
                    name=instance["instance_name"],
                    id=instance["instance_id"],
                    internal_ip=instance.get("internal_ip",
                                             "Not assigned"),
                    management_ip=instance.get("management_ip",
                                               "Not assigned")))
        return instances
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:16,代码来源:tabs.py


示例16: update_context_with_plugin_tags

def update_context_with_plugin_tags(request, context):
        sahara = saharaclient(request)
        plugins = sahara.plugins.list()

        plugins_object = dict()
        for plugin in plugins:
            plugins_object[plugin.name] = dict()
            for version in plugin.versions:
                plugins_object[plugin.name][version] = []
                details = sahara.plugins.get_version_details(plugin.name,
                                                             version)

                for tag in details.required_image_tags:
                    plugins_object[plugin.name][version].append(tag)

        context["plugins"] = plugins_object
        return context
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:17,代码来源:views.py


示例17: handle

    def handle(self, request, context):
        sahara = saharaclient(request)
        main_locations = []
        lib_locations = []

        for k in context.keys():
            if k.startswith('lib_'):
                lib_locations.append(context.get(k))

        if context.get("main_binary", None):
            main_locations.append(context["main_binary"])

        sahara.jobs.create(
            context["job_name"],
            context["job_type"],
            main_locations,
            lib_locations,
            context["job_description"])
        return True
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:19,代码来源:create.py


示例18: get_context_data

 def get_context_data(self, request):
     plugin_id = self.tab_group.kwargs['plugin_id']
     sahara = saharaclient(request)
     plugin = sahara.plugins.get(plugin_id)
     return {"plugin": plugin}
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:5,代码来源:tabs.py


示例19: action

 def action(self, request, template_id):
     sahara = saharaclient(request)
     sahara.node_group_templates.delete(template_id)
开发者ID:cloudoop,项目名称:sahara-dashboard,代码行数:3,代码来源:tables.py


示例20: action

 def action(self, request, obj_id):
     sahara = saharaclient(request)
     sahara.images.unregister_image(obj_id)
开发者ID:nagyist,项目名称:sahara-dashboard,代码行数:3,代码来源:tables.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python controller.LBSimulationController类代码示例发布时间:2022-05-27
下一篇:
Python xmlutils.load_hadoop_xml_defaults函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap