Pārlūkot izejas kodu

[jobsub] Authenticate to Oozie in non-secure mode

* Always include `user.name' as the Hue user. Oozie gives back auth cookie. If
  we switch the username, the cookie will be invalid.

Also:
* Fix ui modal dialog and broken history listing
* Specify oozie.use.system.libpath for streaming jobs
bc Wong 13 gadi atpakaļ
vecāks
revīzija
674c23347f

+ 1 - 1
apps/jobsub/src/jobsub/oozie_lib/oozie_api.py

@@ -89,7 +89,7 @@ class OozieApi(object):
   def _get_params(self):
     if self.security_enabled:
       return { 'doAs': self.user }
-    return { }
+    return { 'user.name': DEFAULT_USER, 'doAs': self.user }
 
 
   VALID_JOB_FILTERS = ('name', 'user', 'group', 'status')

+ 11 - 2
apps/jobsub/src/jobsub/submit.py

@@ -81,12 +81,13 @@ class Submission(object):
     wf_xml = self._generate_workflow_xml(fs_defaultfs)
     self._do_as(self._username, self._copy_files, wf_dir, wf_xml)
     LOG.info("Prepared deployment directory at '%s' for %s" % (wf_dir, self))
+    LOG.info("Submitting design id %s to %s as `%s'" % (self._design_obj.id, jobtracker, self._username))
 
     try:
       prev = get_oozie().setuser(self._username)
       self._job_id = get_oozie().submit_workflow(
             self._fs.get_hdfs_path(wf_dir),
-            properties={ 'jobTracker': jobtracker })
+            properties=self._get_properties(jobtracker))
       LOG.info("Submitted: %s" % (self,))
 
       # Now we need to run it
@@ -96,7 +97,15 @@ class Submission(object):
       get_oozie().setuser(prev)
 
     return self.job_id
-    
+
+
+  def _get_properties(self, jobtracker_addr):
+    res = { 'jobTracker': jobtracker_addr }
+    if self._design_obj.get_root_action().action_type == \
+          models.OozieStreamingAction.ACTION_TYPE:
+      res['oozie.use.system.libpath'] = 'true'
+    return res
+
 
   def _copy_files(self, wf_dir, wf_xml):
     """

+ 5 - 5
apps/jobsub/src/jobsub/templates/list_history.mako

@@ -51,14 +51,14 @@ ${layout.menubar(section='history')}
         </thead>
         <tbody>
             %for record in history:
-                <% wf = record.design %>
+                <% design = record.design %>
                 <tr>
                     <td><a href="${url('jobsub.views.oozie_job', jobid=record.job_id)}">${record.job_id}</a></td>
                     <td>${record.owner.username}</td>
-                    <td>${wf.name}</td>
-                    <td>${wf.root_action.action_type}</td>
-                    <td>${wf.description}</td>
-                    <td>${date(design.submission_date)} ${time(design.submission_date).replace("p.m.","PM").replace("a.m.","AM")}</td>
+                    <td>${design.name}</td>
+                    <td>${design.root_action.action_type}</td>
+                    <td>${design.description}</td>
+                    <td>${date(record.submission_date)} ${time(record.submission_date).replace("p.m.","PM").replace("a.m.","AM")}</td>
                 </tr>
             %endfor
         </tbody>

+ 6 - 9
apps/jobsub/src/jobsub/templates/workflow.mako

@@ -117,11 +117,10 @@ ${layout.menubar(section='history')}
                 <td>
                   ## Include a modal for action configuration
                   ${action.name}
-                  <a href="javascript:void(0)"><img src="/static/art/led-icons/cog.png"
-                      alt="Show Configuration"
-                      data-controls-modal="actionConfigModal${i}"
-                      data-backdrop="static" data-keyboard="true"/></a>
-                  ${configModal("actionConfigModal" + str(i), "Action Configuration", action.conf_dict)}
+                  <% modal_id = "actionConfigModal" + str(i) %>
+                  <a href="#${modal_id}" data-toggle="modal"><img src="/static/art/led-icons/cog.png"
+                      alt="Show Configuration"></a>
+                  ${configModal(modal_id, "Action Configuration", action.conf_dict)}
                 </td>
                 <td>${action.type}</td>
                 <td>${action.status}</td>
@@ -150,10 +149,8 @@ ${layout.menubar(section='history')}
                 <td>Application Name</td>
                 <td>
                   ${workflow.appName}
-                  <a href="javascript:void(0)"><img src="/static/art/led-icons/cog.png"
-                      alt="Show Configuration"
-                      data-controls-modal="appConfigModal"
-                      data-backdrop="static" data-keyboard="true"/></a>
+                  <a href="#appConfigModal" data-toggle="modal"><img src="/static/art/led-icons/cog.png"
+                      alt="Show Configuration"/></a>
                 </td>
               </tr>
               <tr>