Browse Source

AMBARI-8492 - Pig View: readme + blueprint, minor UI (Jeff Sposetti via tbeerbower)

tbeerbower 10 years ago
parent
commit
5fc87355a8

File diff suppressed because it is too large
+ 31 - 0
contrib/views/pig/blueprint.json


+ 13 - 0
contrib/views/pig/clustertemplate.json

@@ -0,0 +1,13 @@
+{
+  "blueprint" : "pig-view",
+  "host_groups" :[
+    {
+      "name" : "single_host",
+      "hosts" : [
+        {
+          "fqdn" : "c6403.ambari.apache.org"
+        }
+      ]
+    }
+  ]
+}

+ 168 - 0
contrib/views/pig/readme.md

@@ -0,0 +1,168 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+Pig View
+============
+
+Description
+-----
+This View provides a UI to create, save and run pig scripts. You can browse the list of pig scripts you have created and saved.
+You can see the history of runs of the pig scripts, view the logs and download the results. You can also upload and use
+UDFs with your pig scripts.
+
+Requirements
+-----
+
+- Ambari 1.7.0
+- HDFS with WebHDFS configured
+- WebHCat with Pig configured
+
+Build
+-----
+
+The view can be built as a maven project.
+
+    mvn clean install
+
+The build will produce the view archive.
+
+    target/pig-0.1.0-SNAPSHOT.jar
+
+Place the view archive on the Ambari Server and restart to deploy.    
+
+    cp pig-0.1.0-SNAPSHOT.jar /var/lib/ambari-server/resources/views/
+    ambari-server restart
+
+View Definition
+-----
+
+    <!-- HDFS Configs -->
+    <parameter>
+        <name>webhdfs.url</name>
+        <description>WebHDFS FileSystem URL (example: webhdfs://namenode.host:50070)</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>webhdfs.username</name>
+        <description>User and doAs for proxy user for HDFS</description>
+        <required>false</required>
+    </parameter>
+
+    <!-- WebHCat Configs -->
+    <parameter>
+        <name>webhcat.url</name>
+        <description>WebHCat URL (example: http://webhcat.host:50111/templeton/v1)</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>webhcat.username</name>
+        <description>User and doAs for proxy user for WebHCat</description>
+        <required>false</required>
+    </parameter>
+
+    <!-- General Configs -->
+    <parameter>
+        <name>dataworker.username</name>
+        <description>The username (defaults to ViewContext username)</description>
+        <required>false</required>
+    </parameter>
+
+    <parameter>
+        <name>scripts.dir</name>
+        <description>HDFS directory path to store Pig scripts (example: /tmp/${username}/scripts)</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>jobs.dir</name>
+        <description>HDFS directory path to store Pig job status (example: /tmp/${username}/jobs)</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>store.dir</name>
+        <description>HDFS directory to store meta information about Pig scripts and jobs (example: /tmp/${username}/store)</description>
+        <required>false</required>
+    </parameter>
+
+Cluster Configuration
+-----
+Configure HDFS for a proxy user. In core-site.xml, add the following properties:
+
+    hadoop.proxyuser.root.hosts=*
+    hadoop.proxyuser.root.groups=*
+    hadoop.proxyuser.hcat.hosts=*
+    hadoop.proxyuser.hcat.groups=*
+
+Configure WebHCat for a proxy user. In webhcat-site.xml, add the following properties:
+
+    webhcat.proxyuser.hcat.hosts=*
+    webhcat.proxyuser.hcat.groups=*
+
+Create Hadoop users and make members of the hdfs, hadoop and users groups. For example, to create a user "admin": 
+
+    useradd -G hdfs admin
+    usermod -a -G users admin
+    usermod -a -G hadoop admin
+
+Check the "admin" user has the correct group membership.
+
+    id admin
+    uid=1002(admin) gid=1002(admin) groups=1002(admin),100(users),503(hadoop),498(hdfs)
+
+
+Single Node Cluster
+-----
+
+The following section describes how to use the [Ambari Vagrant](https://cwiki.apache.org/confluence/display/AMBARI/Quick+Start+Guide) setup to create a single-node cluster with the Pig View. 
+
+Install Ambari Server and Ambari Agent.
+
+Manually register Ambari Agent with Server.
+
+Setup and Start Ambari Server.
+
+Create Blueprint using the provided [blueprint.json](blueprint.json) file.
+  
+    POST
+    http://c6401.ambari.apache.org:8080/api/v1/blueprints/pig-view
+
+Create Cluster using the provided [clustertemplate.json](clustertemplate.json) file
+    
+    POST
+    http://c6401.ambari.apache.org:8080/api/v1/clusters/PigView
+
+After the cluster is created, deploy the Pig View into Ambari.
+
+    cp pig-0.1.0-SNAPSHOT.jar /var/lib/ambari-server/resources/views/
+    ambari-server restart
+
+From the Ambari Administration interface, create a Pig view instance.
+
+|Property|Value|
+|---|---|
+| Details: Instance Name | PIG_1 |
+| Details: Display Name | Pig |
+| Details: Description | Save and execute Pig scripts |
+| Properties: webhdfs.url | webhdfs://c6401.ambari.apache.org:50070 |
+| Properties: webhcat.url | http://c6401.ambari.apache.org:50111/templeton/v1 |
+| Properties: scripts.dir | /tmp/${username}/scripts |
+| Properties: jobs.dir | /tmp/${username}/jobs |
+
+Login to Ambari as "admin" and browse to the view instance.
+
+    http://c6401.ambari.apache.org:8080/#/main/views/PIG/0.1.0/PIG_1

+ 14 - 3
contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less

@@ -24,7 +24,7 @@
 @import './../../bower_components/bootstrap/less/bootstrap.less';
 
 .wrap {
-  padding: 15px;
+  padding: 0px;
 }
 
 .moz-padding (@selector, @pre: ~'', @padding) {
@@ -172,7 +172,7 @@
               text-align: left;
               padding: 0;
               &:hover {
-                color: darken(#fff, 30%);
+                color: #fff;
                 text-decoration: none;
               }
             }
@@ -374,6 +374,7 @@
       padding: 5px;
       background-color: #f5f5f5;
       border-bottom: 1px solid #dddddd;
+      border-radius: 4px;
       .argadd {
         font-size: 13px;
         width:10%;
@@ -486,7 +487,7 @@
       width: 140px;
     }
     th:last-child {
-      width: 110px;
+      width: 260px;
     }
     td > h4 {
       margin: 0;
@@ -506,6 +507,14 @@
   }
 }
 
+.editor-container.CodeMirror-scroll {
+    background-color: #fff;
+}
+
+.main-content {
+    padding-left: 0px;
+}
+
 .job-container {
   .progress-wrap {
     .base-transition( width 200ms linear;);
@@ -535,6 +544,8 @@
     .common-shadow-inset;
     height: 215px;
     border-bottom: 1px solid #dddddd;
+    cursor: not-allowed;
+    background-color: #fcfcfc;
     .CodeMirror-gutters {
       background-color: #fcfcfc;
     }

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs

@@ -48,7 +48,7 @@
 
       {{outlet alert}}
     </div>
-    <div class="col-md-9">
+    <div class="col-md-9 main-content">
       {{outlet}}
     </div>
   </div>

+ 5 - 5
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/history.hbs

@@ -23,7 +23,7 @@
   <table class="table table-striped ">
     <thead> 
       <tr class="label-row">
-        <th>{{t 'common.date'}}</th>
+        <th class="first">{{t 'common.date'}}</th>
         <th>{{t 'scripts.script'}}</th>
         <th>{{t 'job.status'}}</th> 
         <th>{{t 'history.duration'}}</th>
@@ -45,10 +45,10 @@
         <td>{{#unless jobInProgress}}{{durationTime}}{{/unless}}</td>
         <td>
           {{#unless jobInProgress}}
-            <a {{action 'logsPopup' this}} href="#" title="Logs"> <i class="fa fa-file-text-o"></i></a>
-            <a {{action 'resultsPopup' this}} href="#" title="Results"> <i class="fa fa-table"></i></a>
+            <a {{action 'logsPopup' this}} href="#"> <i class="fa fa-file-text-o"></i> {{t 'job.logs'}}</a>
+            <a {{action 'resultsPopup' this}} href="#"> <i class="fa fa-table"></i> {{t 'job.results'}}</a>
           {{/unless}}
-          <a href="#" {{action 'deleteJob' this}} title="Delete"><i class="fa fa-trash-o"></i></a>
+          <a {{action 'deleteJob' this}} href="#"><i class="fa fa-trash-o"></i> {{t 'common.delete'}}</a>
         </td>
       </tr>
     {{/each}}
@@ -61,4 +61,4 @@
 
 {{#if content}}
   {{partial 'partials/paginationControls'}}
-{{/if}}
+{{/if}}

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/udfs.hbs

@@ -36,7 +36,7 @@
           <td> {{this.name}}</td>
           <td> {{this.path}}</td>
           <td> {{this.owner}}</td>
-          <td><a href="#" {{action "deleteUdf" this}} >{{t 'common.delete'}}</a></td>
+          <td><a href="#" {{action "deleteUdf" this}} ><i class="fa fa-trash-o"></i> {{t 'common.delete'}}</a></td>
         </tr>
     {{/each}}
     </tbody>
@@ -50,4 +50,4 @@
     <div class="alert alert-info" role="alert">{{t 'udfs.noUDFs'}}</div>
   {{/unless}}
 
-</div>
+</div>

+ 4 - 4
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs

@@ -55,7 +55,7 @@
       <div class="panel-heading">
         <h4 class="panel-title">
           <a data-toggle="collapse" href="#scriptResults">
-            <i class="toggle-icon fa fa-fw fa-chevron-right"></i>
+            <i class="toggle-icon fa fa-fw fa-chevron-right fa-rotate-90"></i>
             {{t 'job.results'}}
           </a>
           {{#if jobResults.isFulfilled }}
@@ -63,7 +63,7 @@
           {{/if}}
         </h4>
       </div>
-      {{#view "view.collapsePanel" id="scriptResults" class="panel-collapse collapse" }}
+      {{#view "view.collapsePanel" id="scriptResults" class="panel-collapse collapse in" }}
         <div class="panel-body">
         {{#if jobResults.isPending}}
           <pre><div class="spinner-sm"></div></pre>
@@ -112,12 +112,12 @@
       <div class="panel-heading">
         <h4 class="panel-title">
           <a data-toggle="collapse" href="#scriptDetails">
-            <i class="toggle-icon fa fa-fw fa-chevron-right fa-rotate-90"></i>
+            <i class="toggle-icon fa fa-fw fa-chevron-right"></i>
             {{t 'job.script_details'}}
           </a>
         </h4>
       </div>
-      {{#view "view.collapsePanel" id="scriptDetails" class="panel-collapse collapse in" }}
+      {{#view "view.collapsePanel" id="scriptDetails" class="panel-collapse collapse" }}
         <div class="panel-body body-title">
           {{t 'job.script_contents'}}:
         </div>

+ 19 - 19
contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js

@@ -30,7 +30,7 @@ Ember.I18n.translations = {
     'history':"History",
     'clone':"Clone",
     'cancel':"Cancel",
-    'discard_changes':"Discard changes",
+    'discard_changes':"Discard Changes",
     'arguments':"Arguments",
     'errorLog':"Stack Trace",
     'showErrorLog':"Show Stack Trace",
@@ -59,14 +59,14 @@ Ember.I18n.translations = {
       'create_script':'New Script',
       'unsaved_changes_warning':'You have unsaved changes in script.',
       'script_title_placeholder': 'Script name',
-      'file_path_placeholder':'Full path to script file',
+      'file_path_placeholder':'/hdfs/path/to/pig/script',
       'file_path_hint':'Leave empty to create file automatically.',
       'copy_created_massage':'{{title}} created successfully.',
       'copy_created':'Copy Created',
       'continue_editing':'Continue Editing',
       'go_to_copy':'Go to Copy',
 
-      'error_empty_title':'Title can not be empty!',
+      'error_empty_title':'Name cannot be empty',
 
       'confirm_delete':'Confirm Delete',
       'confirm_delete_massage':'Are you sure you want to delete {{title}} script?'
@@ -76,17 +76,17 @@ Ember.I18n.translations = {
       'arg_present':'Argument already present',
       'file_exist_error':'File already exist',
       'script_saved':'{{title}} saved!',
-      'script_created':'{{title}} created!',
-      'script_deleted':'{{title}} deleted!',
-      'create_failed':'Failed to create script!',
-      'delete_failed':'Delete failed!',
+      'script_created':'{{title}} created',
+      'script_deleted':'{{title}} deleted',
+      'create_failed':'Failed to create script',
+      'delete_failed':'Delete failed',
       'save_error':'Error while saving script',
       'save_error_reason':'{{message}}',
       'rename_unfinished':'Please rename script first.'
     }
   },
   'editor':{
-    'title_updated':'Title updated.',
+    'title_updated':'Name updated',
     'pig_argument':'Pig argument',
     'pighelper':'PIG helper',
     'udfhelper':'UDF helper',
@@ -109,14 +109,14 @@ Ember.I18n.translations = {
     'jobId':'Job ID',
     'started':'Started',
     'noJobs': "No jobs to display",
-    'kill_job': "Kill job",
+    'kill_job': "Kill Job",
     'script_details': "Script Details",
     'script_contents': "Script contents",
     'alert':{
       'job_started' :'Job started!',
-      'job_killed' :'{{title}} job killed!',
-      'job_kill_error' :'Job kill failed!',
-      'start_filed' :'Job failed to start!',
+      'job_killed' :'{{title}} job killed',
+      'job_kill_error' :'Job kill failed',
+      'start_filed' :'Job failed to start',
       'load_error' :'Error loading job. Reason: {{message}}',
       'stdout_error' :'Error loading STDOUT. \n Status: {{status}} Message: {{message}}',
       'stderr_error' :'Error loading STDERR. \n Status: {{status}} Message: {{message}}',
@@ -145,15 +145,15 @@ Ember.I18n.translations = {
     },
     'noUDFs': "No UDFs to display",
     'alert':{
-      'udf_created':'{{name}} created!',
-      'udf_deleted':'{{name}} deleted!',
-      'create_failed':'Failed to create UDF!',
-      'delete_failed':'Delete failed!'
+      'udf_created':'{{name}} created',
+      'udf_deleted':'{{name}} deleted',
+      'create_failed':'Failed to create UDF',
+      'delete_failed':'Delete failed'
     },
     'modal':{
       'create_udf':'Create UDF',
       'udf_name':'UDF name',
-      'hdfs_path':'HDFS path'
+      'hdfs_path':'/hdfs/path/to/udf'
     }
   },
   'history':{
@@ -162,8 +162,8 @@ Ember.I18n.translations = {
     'load_error':'Error loading pig history.'
   },
   'splash':{
-    'welcome':'Welcome to Apache Pig UI',
-    'please_wait':'Please wait while we test connection to services',
+    'welcome':'Welcome to the Pig View',
+    'please_wait':'Testing connection to services...please wait.',
     'storage_test':'Storage test',
     'hdfs_test':'HDFS test',
     'webhcat_test':'WebHCat test'

+ 4 - 5
contrib/views/pig/src/main/resources/view.xml

@@ -35,7 +35,7 @@
     <!-- WebHCat Configs -->
     <parameter>
         <name>webhcat.url</name>
-        <description>WebHCat URL (example: http://webhcat.host:50111/templeton)</description>
+        <description>WebHCat URL (example: http://webhcat.host:50111/templeton/v1)</description>
         <required>true</required>
     </parameter>
 
@@ -46,7 +46,6 @@
     </parameter>
 
     <!-- General Configs -->
-
     <parameter>
         <name>dataworker.username</name>
         <description>The username (defaults to ViewContext username)</description>
@@ -55,19 +54,19 @@
 
     <parameter>
         <name>scripts.dir</name>
-        <description>HDFS directory path to store Pig scripts (example: /users/${username})</description>
+        <description>HDFS directory to store Pig scripts (example: /user/${username}/scripts)</description>
         <required>true</required>
     </parameter>
 
     <parameter>
         <name>jobs.dir</name>
-        <description>HDFS directory path to store Pig job status (example: /users/${username})</description>
+        <description>HDFS directory to store Pig job status (example: /user/${username}/jobs)</description>
         <required>true</required>
     </parameter>
 
     <parameter>
         <name>store.dir</name>
-        <description>HDFS directory to store meta information about Pig scripts and jobs (example: /users/${username})</description>
+        <description>HDFS directory to store meta information about Pig scripts and jobs (example: /user/${username}/store)</description>
         <required>false</required>
     </parameter>
 

Some files were not shown because too many files changed in this diff