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


Python client.saharaclient函数代码示例

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


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


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