|
|
@@ -35,7 +35,7 @@ from django.core.urlresolvers import reverse
|
|
|
|
|
|
from desktop.lib.django_test_util import make_logged_in_client
|
|
|
from desktop.lib.test_utils import grant_access, add_permission, add_to_group, reformat_json, reformat_xml
|
|
|
-from desktop.models import Document
|
|
|
+from desktop.models import Document, Document2
|
|
|
|
|
|
from jobsub.models import OozieDesign, OozieMapreduceAction
|
|
|
from liboozie import oozie_api
|
|
|
@@ -47,6 +47,7 @@ from liboozie.types import WorkflowList, Workflow as OozieWorkflow, Coordinator
|
|
|
from oozie.conf import ENABLE_CRON_SCHEDULING, ENABLE_V2
|
|
|
from oozie.models import Workflow, Node, Kill, Link, Job, Coordinator, History,\
|
|
|
find_parameters, NODE_TYPES, Bundle
|
|
|
+from oozie.models2 import _get_hiveserver2_url
|
|
|
from oozie.utils import workflow_to_dict, model_to_dict, smart_path
|
|
|
from oozie.importlib.workflows import import_workflow
|
|
|
from oozie.importlib.jobdesigner import convert_jobsub_design
|
|
|
@@ -723,6 +724,8 @@ class TestAPI(OozieMockBase):
|
|
|
class TestApiPermissionsWithOozie(OozieBase):
|
|
|
|
|
|
def setUp(self):
|
|
|
+ raise SkipTest # Need to move to v2
|
|
|
+
|
|
|
OozieBase.setUp(self)
|
|
|
|
|
|
# When updating wf, update wf_json as well!
|
|
|
@@ -3032,72 +3035,44 @@ class TestImportWorkflow04WithOozie(OozieBase):
|
|
|
|
|
|
class TestOozieSubmissions(OozieBase):
|
|
|
|
|
|
- def test_submit_mapreduce_action(self):
|
|
|
- wf = Document.objects.get_docs(self.user, Workflow).get(name='MapReduce', owner__username='sample', extra='').content_object
|
|
|
- wf.owner = User.objects.get(username='sample')
|
|
|
- wf.save()
|
|
|
- post_data = {u'form-MAX_NUM_FORMS': [u''], u'form-INITIAL_FORMS': [u'1'],
|
|
|
- u'form-0-name': [u'REDUCER_SLEEP_TIME'], u'form-0-value': [u'1'],
|
|
|
- u'form-TOTAL_FORMS': [u'1']}
|
|
|
- assert_equal('sample', wf.owner.username)
|
|
|
-
|
|
|
- response = self.c.post(reverse('oozie:submit_workflow', args=[wf.id]), data=post_data, follow=True)
|
|
|
- job = OozieServerProvider.wait_until_completion(response.context['oozie_workflow'].id)
|
|
|
- assert_equal('SUCCEEDED', job.status)
|
|
|
- assert_equal(100, job.get_progress())
|
|
|
-
|
|
|
- raise SkipTest
|
|
|
-
|
|
|
- # Rerun with default options
|
|
|
- post_data.update({u'rerun_form_choice': [u'skip_nodes']})
|
|
|
-
|
|
|
- response = self.c.post(reverse('oozie:rerun_oozie_job', kwargs={'job_id': job.id, 'app_path': job.appPath}), data=post_data, follow=True)
|
|
|
- job = OozieServerProvider.wait_until_completion(response.context['oozie_workflow'].id)
|
|
|
- assert_equal('SUCCEEDED', job.status)
|
|
|
- assert_equal(100, job.get_progress())
|
|
|
-
|
|
|
- # Rerun with skip OK actions skipped
|
|
|
- post_data.update({u'rerun_form_choice': [u'skip_nodes'], u'skip_nodes': [u'Sleep']})
|
|
|
+ def test_submit_hiveserver2_action(self):
|
|
|
+ #raise SkipTest # Need to point to a real hs2
|
|
|
|
|
|
- response = self.c.post(reverse('oozie:rerun_oozie_job', kwargs={'job_id': job.id, 'app_path': job.appPath}), data=post_data, follow=True)
|
|
|
- job = OozieServerProvider.wait_until_completion(response.context['oozie_workflow'].id)
|
|
|
- assert_equal('SUCCEEDED', job.status)
|
|
|
- assert_equal(100, job.get_progress())
|
|
|
-
|
|
|
- # Rerun with failed nodes too
|
|
|
- post_data.update({u'rerun_form_choice': [u'failed_nodes']})
|
|
|
-
|
|
|
- response = self.c.post(reverse('oozie:rerun_oozie_job', kwargs={'job_id': job.id, 'app_path': job.appPath}), data=post_data, follow=True)
|
|
|
- job = OozieServerProvider.wait_until_completion(response.context['oozie_workflow'].id)
|
|
|
-
|
|
|
-
|
|
|
- def test_submit_java_action(self):
|
|
|
- wf = Document.objects.get_docs(self.user, Workflow).get(name='TeraSort', owner__username='sample', extra='').content_object
|
|
|
- wf.owner = User.objects.get(username='sample')
|
|
|
+ wf_uuid = "c1c3cba9-edec-fb6f-a526-9f80b66fe993"
|
|
|
+ wf = Document2.objects.get(uuid=wf_uuid)
|
|
|
+ wf.data.replace('hive2://localhost:10000/default', _get_hiveserver2_url())
|
|
|
wf.save()
|
|
|
|
|
|
- response = self.c.post(reverse('oozie:submit_workflow', args=[wf.id]),
|
|
|
- data={u'form-MAX_NUM_FORMS': [u''],
|
|
|
- u'form-0-name': [u'records'], u'form-0-value': [u'10'],
|
|
|
- u'form-1-name': [u' output_dir '], u'form-1-value': [u'${nameNode}/user/test/out/terasort'],
|
|
|
- u'form-2-name': [u'terasort_reducers'], u'form-2-value': [u'3'],
|
|
|
- u'form-INITIAL_FORMS': [u'3'], u'form-TOTAL_FORMS': [u'3']},
|
|
|
+ response = self.c.post(reverse('oozie:editor_submit_workflow', kwargs={'doc_id': wf.id}),
|
|
|
+ data={
|
|
|
+ u'form-0-name': [u'oozie.use.system.libpath'],
|
|
|
+ u'form-MAX_NUM_FORMS': [u'1000'],
|
|
|
+ u'form-TOTAL_FORMS': [u'1'],
|
|
|
+ u'form-INITIAL_FORMS': [u'1'],
|
|
|
+ u'form-0-value': [u'True']
|
|
|
+ },
|
|
|
follow=True)
|
|
|
job = OozieServerProvider.wait_until_completion(response.context['oozie_workflow'].id)
|
|
|
assert_equal('SUCCEEDED', job.status)
|
|
|
|
|
|
|
|
|
- def test_submit_distcp_action(self):
|
|
|
- wf = Document.objects.get_docs(self.user, Workflow).get(name='DistCp', owner__username='sample', extra='').content_object
|
|
|
- wf.owner = User.objects.get(username='sample')
|
|
|
- wf.save()
|
|
|
+ def test_submit_spark_action(self):
|
|
|
+ #raise SkipTest # Spark "hangs"
|
|
|
+
|
|
|
+ wf_uuid = "2d667ab2-70f9-c2bf-0726-abe84fa7130d"
|
|
|
+ wf = Document2.objects.get(uuid=wf_uuid)
|
|
|
|
|
|
- response = self.c.post(reverse('oozie:submit_workflow', args=[wf.id]),
|
|
|
+ response = self.c.post(reverse('oozie:editor_submit_workflow', kwargs={'doc_id': wf.id}),
|
|
|
data={
|
|
|
- u'form-MAX_NUM_FORMS': [u''], u'form-TOTAL_FORMS': [u'3'], u'form-INITIAL_FORMS': [u'3'],
|
|
|
- u'form-0-name': [u'oozie.use.system.libpath'], u'form-0-value': [u'true'],
|
|
|
- u'form-1-name': [u'OUTPUT'], u'form-1-value': [u'${nameNode}/user/test/out/distcp'],
|
|
|
- u'form-2-name': [u'MAP_NUMBER'], u'form-2-value': [u'5'],
|
|
|
+ u'form-0-name': [u'oozie.use.system.libpath'],
|
|
|
+ u'form-MAX_NUM_FORMS': [u'1000'],
|
|
|
+ u'form-1-name': [u'input'],
|
|
|
+ u'form-TOTAL_FORMS': [u'3'],
|
|
|
+ u'form-1-value': [u'/user/hue/oozie/workspaces/data/sonnets.txt'],
|
|
|
+ u'form-2-name': [u'output'],
|
|
|
+ u'form-INITIAL_FORMS': [u'3'],
|
|
|
+ u'form-2-value': [u'here'],
|
|
|
+ u'form-0-value': [u'True']
|
|
|
},
|
|
|
follow=True)
|
|
|
job = OozieServerProvider.wait_until_completion(response.context['oozie_workflow'].id)
|