Ejemplo n.º 1
0
    def handle(self, request, context):
        try:
            # TODO(nkonovalov) Implement AJAX Node Groups.
            node_groups = None

            plugin, hadoop_version = whelpers.\
                get_plugin_and_hadoop_version(request)

            cluster_template_id = context["general_cluster_template"] or None
            user_keypair = context["general_keypair"] or None

            saharaclient.cluster_create(
                request,
                context["general_cluster_name"],
                plugin,
                hadoop_version,
                cluster_template_id=cluster_template_id,
                default_image_id=context["general_image"],
                description=context["general_description"],
                node_groups=node_groups,
                user_keypair_id=user_keypair,
                count=context['general_cluster_count'],
                net_id=context.get("general_neutron_management_network", None))
            return True
        except api_base.APIException as e:
            self.error_description = str(e)
            return False
        except Exception:
            exceptions.handle(request, _('Unable to create the cluster'))
            return False
Ejemplo n.º 2
0
    def handle(self, request, context):
        try:
            # TODO(nkonovalov) Implement AJAX Node Groups.
            node_groups = None

            plugin, hadoop_version = whelpers.\
                get_plugin_and_hadoop_version(request)

            cluster_template_id = context["general_cluster_template"] or None
            user_keypair = context["general_keypair"] or None

            saharaclient.cluster_create(
                request,
                context["general_cluster_name"],
                plugin, hadoop_version,
                cluster_template_id=cluster_template_id,
                default_image_id=context["general_image"],
                description=context["general_description"],
                node_groups=node_groups,
                user_keypair_id=user_keypair,
                count=context['general_cluster_count'],
                net_id=context.get("general_neutron_management_network", None))
            return True
        except api_base.APIException as e:
            self.error_description = str(e)
            return False
        except Exception:
            exceptions.handle(request,
                              _('Unable to create the cluster'))
            return False
Ejemplo n.º 3
0
    def handle(self, request, context):
        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

        argument_ids = json.loads(context['argument_ids'])
        interface = {name: context["argument_" + str(arg_id)]
                     for arg_id, name in argument_ids.items()}

        try:
            cluster = saharaclient.cluster_create(
                request,
                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))
        except Exception:
            exceptions.handle(request,
                              _("Unable to create new cluster for job."))
            return False

        try:
            saharaclient.job_execution_create(
                request,
                context["job_general_job"],
                cluster.id,
                context["job_general_job_input"],
                context["job_general_job_output"],
                context["job_config"],
                interface)
        except Exception:
            exceptions.handle(request,
                              _("Unable to launch job."))
            return False
        return True
Ejemplo n.º 4
0
    def handle(self, request, context):
        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

        argument_ids = json.loads(context['argument_ids'])
        interface = {
            name: context["argument_" + str(arg_id)]
            for arg_id, name in argument_ids.items()
        }

        try:
            cluster = saharaclient.cluster_create(
                request,
                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))
        except Exception:
            exceptions.handle(request,
                              _("Unable to create new cluster for job."))
            return False

        try:
            saharaclient.job_execution_create(
                request, context["job_general_job"], cluster.id,
                context["job_general_job_input"],
                context["job_general_job_output"], context["job_config"],
                interface)
        except Exception:
            exceptions.handle(request, _("Unable to launch job."))
            return False
        return True