From 4157c009930c69539263b300bc6eba575e328529 Mon Sep 17 00:00:00 2001 From: Telles Nobrega Date: Fri, 17 Jul 2015 14:11:47 -0300 Subject: [PATCH] Add Storm Job to UI This patch adds Storm as a plugin to allow Storm jobs being submitted via UI. Change-Id: I6dddb09aa7d810d2ad4013af1f45f4e3249288a3 Partially-implements: bp storm-integration --- .../jobs/templates/data_processing.jobs/_create_job_help.html | 1 + .../jobs/templates/data_processing.jobs/config_template.html | 4 ++-- .../sahara/content/data_processing/jobs/workflows/create.py | 1 + .../sahara/content/data_processing/jobs/workflows/launch.py | 2 +- .../contrib/sahara/content/data_processing/utils/helpers.py | 1 + .../contrib/sahara/content/data_processing/wizard/views.py | 3 ++- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/_create_job_help.html b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/_create_job_help.html index c60106b92b..a9cead218e 100644 --- a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/_create_job_help.html +++ b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/_create_job_help.html @@ -9,6 +9,7 @@
  • {% blocktrans %}Pig{% endblocktrans %}
  • {% blocktrans %}Hive{% endblocktrans %}
  • {% blocktrans %}Spark{% endblocktrans %}
  • +
  • {% blocktrans %}Storm{% endblocktrans %}
  • {% blocktrans %}MapReduce{% endblocktrans %}
  • {% blocktrans %}Java Action{% endblocktrans %}
  • {% blocktrans %}Shell Action{% endblocktrans %}
  • diff --git a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/config_template.html b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/config_template.html index ba8a633f15..a677fb739f 100644 --- a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/config_template.html +++ b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/templates/data_processing.jobs/config_template.html @@ -137,7 +137,7 @@ if ($.inArray(job_type, ["Hive", "Pig", "Shell"]) != -1) { res.push("params"); } - if ($.inArray(job_type, ["Java", "Pig", "Spark", "Shell"]) != -1) { + if ($.inArray(job_type, ["Java", "Pig", "Spark", "Shell", "Storm"]) != -1) { res.push("args_array"); } return res; @@ -155,7 +155,7 @@ } function hide_unnecessary_fields() { - if ($.inArray(job_type, ["Java", "Spark", "Shell"]) != -1) { + if ($.inArray(job_type, ["Java", "Spark", "Shell", "Storm"]) != -1) { $("[name=job_input]").closest(".form-group").hide(); $("[name=job_output]").closest(".form-group").hide(); } diff --git a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/create.py b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/create.py index 5278b9307b..b40010e3cd 100644 --- a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/create.py +++ b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/create.py @@ -91,6 +91,7 @@ class GeneralConfigAction(workflows.Action): 'data-jobtype-hive': _("Choose a main binary"), 'data-jobtype-shell': _("Choose a shell script"), 'data-jobtype-spark': _("Choose a main binary"), + 'data-jobtype-storm': _("Choose a main binary"), 'data-jobtype-mapreduce.streaming': _("Choose a main binary") })) diff --git a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/launch.py b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/launch.py index 039b41d3ee..298a2dc1de 100644 --- a/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/launch.py +++ b/openstack_dashboard/contrib/sahara/content/data_processing/jobs/workflows/launch.py @@ -296,7 +296,7 @@ class JobConfig(workflows.Step): context["job_config"] = {"configs": job_config} context["job_config"]["args"] = job_args_array - if job_type in ["Java", "Spark"]: + if job_type in ["Java", "Spark", "Storm"]: context["job_config"]["configs"][JobConfigAction.MAIN_CLASS] = ( data.get("main_class", "")) context["job_config"]["configs"][JobConfigAction.JAVA_OPTS] = ( diff --git a/openstack_dashboard/contrib/sahara/content/data_processing/utils/helpers.py b/openstack_dashboard/contrib/sahara/content/data_processing/utils/helpers.py index 7efe27d6c5..bec240277d 100644 --- a/openstack_dashboard/contrib/sahara/content/data_processing/utils/helpers.py +++ b/openstack_dashboard/contrib/sahara/content/data_processing/utils/helpers.py @@ -126,6 +126,7 @@ class Helpers(object): JOB_TYPE_MAP = {"pig": [_("Pig"), "Pig"], "hive": [_("Hive"), "Hive"], "spark": [_("Spark"), "Spark"], + "storm": [_("Storm"), "Storm"], "mapreduce": [_("MapReduce"), "MapReduce"], "mapreduce.streaming": [_("Streaming MapReduce"), "MapReduce.Streaming"], diff --git a/openstack_dashboard/contrib/sahara/content/data_processing/wizard/views.py b/openstack_dashboard/contrib/sahara/content/data_processing/wizard/views.py index 739e8f71f6..c07301a362 100644 --- a/openstack_dashboard/contrib/sahara/content/data_processing/wizard/views.py +++ b/openstack_dashboard/contrib/sahara/content/data_processing/wizard/views.py @@ -64,7 +64,8 @@ class JobExecutionGuideView(horizon_views.APIView): def show_data_sources(self): try: - if self.request.session["guide_job_type"] in ["Spark", "Java"]: + if self.request.session["guide_job_type"] in ["Spark", "Storm", + "Java"]: return False return True except Exception: