Sfoglia il codice sorgente

HUE-8737 [core] Futurize apps/jobsub for Python 3.5

Ying Chen 6 anni fa
parent
commit
ba82744e09

+ 5 - 4
apps/jobsub/src/jobsub/forms.py

@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from builtins import object
 import logging
 
 from django import forms
@@ -31,7 +32,7 @@ _OOZIE_WORKFLOW_NAME_REGEX = '^([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}$'
 
 class WorkflowDesignForm(forms.ModelForm):
   """Used for specifying a design"""
-  class Meta:
+  class Meta(object):
     model = models.OozieDesign
     exclude = ('root_action', 'owner')
 
@@ -46,7 +47,7 @@ class WorkflowDesignForm(forms.ModelForm):
 
 class JavaActionForm(forms.ModelForm):
   """Used for specifying a java action"""
-  class Meta:
+  class Meta(object):
     model = models.OozieJavaAction
     exclude = ('action_type',)
     widgets = {
@@ -65,7 +66,7 @@ class JavaActionForm(forms.ModelForm):
 
 class MapreduceActionForm(forms.ModelForm):
   """Used for specifying a mapreduce action"""
-  class Meta:
+  class Meta(object):
     model = models.OozieMapreduceAction
     exclude = ('action_type',)
     widgets = {
@@ -83,7 +84,7 @@ class MapreduceActionForm(forms.ModelForm):
 
 class StreamingActionForm(forms.ModelForm):
   """Used for specifying a streaming action"""
-  class Meta:
+  class Meta(object):
     model = models.OozieStreamingAction
     exclude = ('action_type',)
     widgets = {

+ 1 - 0
apps/jobsub/src/jobsub/models.py

@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from builtins import str
 import logging
 
 from django.db import models

+ 1 - 1
apps/jobsub/src/jobsub/old_migrations/0004_hue1_to_hue2.py

@@ -215,7 +215,7 @@ def job_design_migration_for_streaming(jd):
   add_property('mapred.reduce.tasks', data['num_reduce_tasks'])
 
   property_list = [ ]
-  for k, v in properties.iteritems():
+  for k, v in properties.items():
     property_list.append(dict(name=k, value=v))
 
   action = OozieStreamingAction(action_type=OozieStreamingAction.ACTION_TYPE,

+ 5 - 3
apps/jobsub/src/jobsub/tests.py

@@ -15,6 +15,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from builtins import str
+from builtins import range
 import logging
 import json
 import time
@@ -39,7 +41,7 @@ class TestJobsubWithHadoop(OozieServerProvider):
   def setUp(self):
     OozieServerProvider.setup_class()
     self.cluster.fs.do_as_user('jobsub_test', self.cluster.fs.create_home_dir, '/user/jobsub_test')
-    self.cluster.fs.do_as_superuser(self.cluster.fs.chmod, '/user/jobsub_test', 0777, True) # Hum?
+    self.cluster.fs.do_as_superuser(self.cluster.fs.chmod, '/user/jobsub_test', 0o777, True) # Hum?
     self.client = make_logged_in_client(username='jobsub_test')
     self.user = User.objects.get(username='jobsub_test')
 
@@ -48,9 +50,9 @@ class TestJobsubWithHadoop(OozieServerProvider):
     # different user than what was previously used.
     for i in range(0,10):
       try:
-        self.cluster.fs.do_as_superuser(self.cluster.fs.chmod, '/tmp', 0777, recursive=True)
+        self.cluster.fs.do_as_superuser(self.cluster.fs.chmod, '/tmp', 0o777, recursive=True)
         break
-      except Exception, e:
+      except Exception as e:
         # chmod failure likely do to async processing of resource deletion.
         # If the directory has improper permissions, should fail later in the test case.
         LOG.warn("Received the following exception while change mode attempt %d of /tmp: %s" % (i, str(e)))

+ 1 - 0
apps/jobsub/src/jobsub/views.py

@@ -25,6 +25,7 @@ to the cluster.  A parameterized, submitted job design
 is a "job submission".  Submissions can be "watched".
 """
 
+from builtins import str
 import logging
 import time as py_time