|
@@ -31,25 +31,26 @@ from liboozie import oozie_api
|
|
|
from liboozie.types import WorkflowList, Workflow as OozieWorkflow, Coordinator as OozieCoordinator,\
|
|
from liboozie.types import WorkflowList, Workflow as OozieWorkflow, Coordinator as OozieCoordinator,\
|
|
|
CoordinatorList, WorkflowAction
|
|
CoordinatorList, WorkflowAction
|
|
|
|
|
|
|
|
-from oozie.models import Workflow, Node, Job, Coordinator, Fork
|
|
|
|
|
|
|
+from oozie.models import Workflow, Node, Job, Coordinator, Fork, History
|
|
|
from oozie.conf import SHARE_JOBS, REMOTE_DEPLOYMENT_DIR
|
|
from oozie.conf import SHARE_JOBS, REMOTE_DEPLOYMENT_DIR
|
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
class MockOozieApi:
|
|
class MockOozieApi:
|
|
|
JSON_WORKFLOW_LIST = [{u'status': u'RUNNING', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:35:48 GMT', u'appName': u'WordCount1', u'lastModTime': u'Mon, 30 Jul 2012 22:37:00 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000012-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:35:48 GMT', u'toString': u'Workflow id[0000012-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:37:00 GMT', u'id': u'0000012-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'},
|
|
JSON_WORKFLOW_LIST = [{u'status': u'RUNNING', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:35:48 GMT', u'appName': u'WordCount1', u'lastModTime': u'Mon, 30 Jul 2012 22:37:00 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000012-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:35:48 GMT', u'toString': u'Workflow id[0000012-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:37:00 GMT', u'id': u'0000012-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'},
|
|
|
{u'status': u'KILLED', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:31:08 GMT', u'appName': u'WordCount2', u'lastModTime': u'Mon, 30 Jul 2012 22:32:20 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000011-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:31:08 GMT', u'toString': u'Workflow id[0000011-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:32:20 GMT', u'id': u'0000011-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'},
|
|
{u'status': u'KILLED', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:31:08 GMT', u'appName': u'WordCount2', u'lastModTime': u'Mon, 30 Jul 2012 22:32:20 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000011-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:31:08 GMT', u'toString': u'Workflow id[0000011-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:32:20 GMT', u'id': u'0000011-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'},
|
|
|
{u'status': u'SUCCEEDED', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:20:48 GMT', u'appName': u'WordCount3', u'lastModTime': u'Mon, 30 Jul 2012 22:22:00 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000009-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:20:48 GMT', u'toString': u'Workflow id[0000009-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:22:00 GMT', u'id': u'0000009-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'},
|
|
{u'status': u'SUCCEEDED', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:20:48 GMT', u'appName': u'WordCount3', u'lastModTime': u'Mon, 30 Jul 2012 22:22:00 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000009-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:20:48 GMT', u'toString': u'Workflow id[0000009-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:22:00 GMT', u'id': u'0000009-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'},
|
|
|
{u'status': u'SUCCEEDED', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:16:58 GMT', u'appName': u'WordCount4', u'lastModTime': u'Mon, 30 Jul 2012 22:18:10 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000008-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:16:58 GMT', u'toString': u'Workflow id[0000008-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:18:10 GMT', u'id': u'0000008-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'}]
|
|
{u'status': u'SUCCEEDED', u'run': 0, u'startTime': u'Mon, 30 Jul 2012 22:16:58 GMT', u'appName': u'WordCount4', u'lastModTime': u'Mon, 30 Jul 2012 22:18:10 GMT', u'actions': [], u'acl': None, u'appPath': None, u'externalId': None, u'consoleUrl': u'http://runreal:11000/oozie?job=0000008-120725142744176-oozie-oozi-W', u'conf': None, u'parentId': None, u'createdTime': u'Mon, 30 Jul 2012 22:16:58 GMT', u'toString': u'Workflow id[0000008-120725142744176-oozie-oozi-W] status[SUCCEEDED]', u'endTime': u'Mon, 30 Jul 2012 22:18:10 GMT', u'id': u'0000008-120725142744176-oozie-oozi-W', u'group': None, u'user': u'romain'}]
|
|
|
WORKFLOW_IDS = [wf['id'] for wf in JSON_WORKFLOW_LIST]
|
|
WORKFLOW_IDS = [wf['id'] for wf in JSON_WORKFLOW_LIST]
|
|
|
|
|
+ WORKFLOW_DICT = dict([(wf['id'], wf) for wf in JSON_WORKFLOW_LIST])
|
|
|
|
|
|
|
|
JSON_COORDINATOR_LIST = [{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000041-120717205528122-oozie-oozi-C] status[RUNNING]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'RUNNING', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/romain/demo2', u'timeUnit': u'DAY', u'coordJobId': u'0000041-120717205528122-oozie-oozi-C', u'coordJobName': u'DailyWordCount1', u'nextMaterializedTime': u'Wed, 04 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Wed, 04 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 00:00:00 GMT'},
|
|
JSON_COORDINATOR_LIST = [{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000041-120717205528122-oozie-oozi-C] status[RUNNING]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'RUNNING', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/romain/demo2', u'timeUnit': u'DAY', u'coordJobId': u'0000041-120717205528122-oozie-oozi-C', u'coordJobName': u'DailyWordCount1', u'nextMaterializedTime': u'Wed, 04 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Wed, 04 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 00:00:00 GMT'},
|
|
|
{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000011-120706144403213-oozie-oozi-C] status[DONEWITHERROR]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'DONEWITHERROR', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/hue/jobsub/_romain_-design-2', u'timeUnit': u'DAY', u'coordJobId': u'0000011-120706144403213-oozie-oozi-C', u'coordJobName': u'DailyWordCount2', u'nextMaterializedTime': u'Thu, 05 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Thu, 05 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 18:54:00 GMT'},
|
|
{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000011-120706144403213-oozie-oozi-C] status[DONEWITHERROR]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'DONEWITHERROR', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/hue/jobsub/_romain_-design-2', u'timeUnit': u'DAY', u'coordJobId': u'0000011-120706144403213-oozie-oozi-C', u'coordJobName': u'DailyWordCount2', u'nextMaterializedTime': u'Thu, 05 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Thu, 05 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 18:54:00 GMT'},
|
|
|
{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000010-120706144403213-oozie-oozi-C] status[DONEWITHERROR]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'DONEWITHERROR', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/hue/jobsub/_romain_-design-2', u'timeUnit': u'DAY', u'coordJobId': u'0000010-120706144403213-oozie-oozi-C', u'coordJobName': u'DailyWordCount3', u'nextMaterializedTime': u'Thu, 05 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Thu, 05 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 18:54:00 GMT'},
|
|
{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000010-120706144403213-oozie-oozi-C] status[DONEWITHERROR]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'DONEWITHERROR', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/hue/jobsub/_romain_-design-2', u'timeUnit': u'DAY', u'coordJobId': u'0000010-120706144403213-oozie-oozi-C', u'coordJobName': u'DailyWordCount3', u'nextMaterializedTime': u'Thu, 05 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Thu, 05 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 18:54:00 GMT'},
|
|
|
{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000009-120706144403213-oozie-oozi-C] status[DONEWITHERROR]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'DONEWITHERROR', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/hue/jobsub/_romain_-design-2', u'timeUnit': u'DAY', u'coordJobId': u'0000009-120706144403213-oozie-oozi-C', u'coordJobName': u'DailyWordCount4', u'nextMaterializedTime': u'Thu, 05 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Thu, 05 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 18:54:00 GMT'}]
|
|
{u'startTime': u'Sun, 01 Jul 2012 00:00:00 GMT', u'actions': [], u'frequency': 1, u'concurrency': 1, u'pauseTime': None, u'group': None, u'toString': u'Coornidator application id[0000009-120706144403213-oozie-oozi-C] status[DONEWITHERROR]', u'consoleUrl': None, u'mat_throttling': 0, u'status': u'DONEWITHERROR', u'conf': None, u'user': u'romain', u'timeOut': 120, u'coordJobPath': u'hdfs://localhost:8020/user/hue/jobsub/_romain_-design-2', u'timeUnit': u'DAY', u'coordJobId': u'0000009-120706144403213-oozie-oozi-C', u'coordJobName': u'DailyWordCount4', u'nextMaterializedTime': u'Thu, 05 Jul 2012 00:00:00 GMT', u'coordExternalId': None, u'acl': None, u'lastAction': u'Thu, 05 Jul 2012 00:00:00 GMT', u'executionPolicy': u'FIFO', u'timeZone': u'America/Los_Angeles', u'endTime': u'Wed, 04 Jul 2012 18:54:00 GMT'}]
|
|
|
COORDINATOR_IDS = [coord['coordJobId'] for coord in JSON_COORDINATOR_LIST]
|
|
COORDINATOR_IDS = [coord['coordJobId'] for coord in JSON_COORDINATOR_LIST]
|
|
|
|
|
+ COORDINATOR_DICT = dict([(coord['coordJobId'], coord) for coord in JSON_COORDINATOR_LIST])
|
|
|
|
|
|
|
|
WORKFLOW_ACTION = {u'status': u'OK', u'retries': 0, u'transition': u'end', u'stats': None, u'startTime': u'Fri, 10 Aug 2012 05:24:21 GMT', u'toString': u'Action name[WordCount] status[OK]', u'cred': u'null', u'errorMessage': None, u'errorCode': None, u'consoleUrl': u'http://localhost:50030/jobdetails.jsp?jobid=job_201208072118_0044', u'externalId': u'job_201208072118_0044', u'externalStatus': u'SUCCEEDED', u'conf': u'<map-reduce xmlns="uri:oozie:workflow:0.2">\r\n <job-tracker>localhost:8021</job-tracker>\r\n <name-node>hdfs://localhost:8020</name-node>\r\n <configuration>\r\n <property>\r\n <name>mapred.mapper.regex</name>\r\n <value>dream</value>\r\n </property>\r\n <property>\r\n <name>mapred.input.dir</name>\r\n <value>/user/romain/words/20120702</value>\r\n </property>\r\n <property>\r\n <name>mapred.output.dir</name>\r\n <value>/user/romain/out/rrwords/20120702</value>\r\n </property>\r\n <property>\r\n <name>mapred.mapper.class</name>\r\n <value>org.apache.hadoop.mapred.lib.RegexMapper</value>\r\n </property>\r\n <property>\r\n <name>mapred.combiner.class</name>\r\n <value>org.apache.hadoop.mapred.lib.LongSumReducer</value>\r\n </property>\r\n <property>\r\n <name>mapred.reducer.class</name>\r\n <value>org.apache.hadoop.mapred.lib.LongSumReducer</value>\r\n </property>\r\n <property>\r\n <name>mapred.output.key.class</name>\r\n <value>org.apache.hadoop.io.Text</value>\r\n </property>\r\n <property>\r\n <name>mapred.output.value.class</name>\r\n <value>org.apache.hadoop.io.LongWritable</value>\r\n </property>\r\n </configuration>\r\n</map-reduce>', u'type': u'map-reduce', u'trackerUri': u'localhost:8021', u'externalChildIDs': None, u'endTime': u'Fri, 10 Aug 2012 05:24:38 GMT', u'data': None, u'id': u'0000021-120807211836060-oozie-oozi-W@WordCount', u'name': u'WordCount'}
|
|
WORKFLOW_ACTION = {u'status': u'OK', u'retries': 0, u'transition': u'end', u'stats': None, u'startTime': u'Fri, 10 Aug 2012 05:24:21 GMT', u'toString': u'Action name[WordCount] status[OK]', u'cred': u'null', u'errorMessage': None, u'errorCode': None, u'consoleUrl': u'http://localhost:50030/jobdetails.jsp?jobid=job_201208072118_0044', u'externalId': u'job_201208072118_0044', u'externalStatus': u'SUCCEEDED', u'conf': u'<map-reduce xmlns="uri:oozie:workflow:0.2">\r\n <job-tracker>localhost:8021</job-tracker>\r\n <name-node>hdfs://localhost:8020</name-node>\r\n <configuration>\r\n <property>\r\n <name>mapred.mapper.regex</name>\r\n <value>dream</value>\r\n </property>\r\n <property>\r\n <name>mapred.input.dir</name>\r\n <value>/user/romain/words/20120702</value>\r\n </property>\r\n <property>\r\n <name>mapred.output.dir</name>\r\n <value>/user/romain/out/rrwords/20120702</value>\r\n </property>\r\n <property>\r\n <name>mapred.mapper.class</name>\r\n <value>org.apache.hadoop.mapred.lib.RegexMapper</value>\r\n </property>\r\n <property>\r\n <name>mapred.combiner.class</name>\r\n <value>org.apache.hadoop.mapred.lib.LongSumReducer</value>\r\n </property>\r\n <property>\r\n <name>mapred.reducer.class</name>\r\n <value>org.apache.hadoop.mapred.lib.LongSumReducer</value>\r\n </property>\r\n <property>\r\n <name>mapred.output.key.class</name>\r\n <value>org.apache.hadoop.io.Text</value>\r\n </property>\r\n <property>\r\n <name>mapred.output.value.class</name>\r\n <value>org.apache.hadoop.io.LongWritable</value>\r\n </property>\r\n </configuration>\r\n</map-reduce>', u'type': u'map-reduce', u'trackerUri': u'localhost:8021', u'externalChildIDs': None, u'endTime': u'Fri, 10 Aug 2012 05:24:38 GMT', u'data': None, u'id': u'0000021-120807211836060-oozie-oozi-W@WordCount', u'name': u'WordCount'}
|
|
|
|
|
|
|
@@ -60,7 +61,7 @@ class MockOozieApi:
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
def submit_job(self, properties):
|
|
def submit_job(self, properties):
|
|
|
- return 'ONE-OOZIE-ID'
|
|
|
|
|
|
|
+ return 'ONE-OOZIE-ID-W'
|
|
|
|
|
|
|
|
def get_workflows(self, **kwargs):
|
|
def get_workflows(self, **kwargs):
|
|
|
return WorkflowList(self, {'offset': 0, 'total': 4, 'workflows': MockOozieApi.JSON_WORKFLOW_LIST})
|
|
return WorkflowList(self, {'offset': 0, 'total': 4, 'workflows': MockOozieApi.JSON_WORKFLOW_LIST})
|
|
@@ -69,10 +70,16 @@ class MockOozieApi:
|
|
|
return CoordinatorList(self, {'offset': 0, 'total': 5, 'coordinatorjobs': MockOozieApi.JSON_COORDINATOR_LIST})
|
|
return CoordinatorList(self, {'offset': 0, 'total': 5, 'coordinatorjobs': MockOozieApi.JSON_COORDINATOR_LIST})
|
|
|
|
|
|
|
|
def get_job(self, job_id):
|
|
def get_job(self, job_id):
|
|
|
- return OozieWorkflow(self, MockOozieApi.JSON_WORKFLOW_LIST[0])
|
|
|
|
|
|
|
+ if job_id in MockOozieApi.WORKFLOW_DICT:
|
|
|
|
|
+ return OozieWorkflow(self, MockOozieApi.WORKFLOW_DICT[job_id])
|
|
|
|
|
+ else:
|
|
|
|
|
+ return OozieWorkflow(self, {'id': job_id, 'actions': []})
|
|
|
|
|
|
|
|
def get_coordinator(self, job_id):
|
|
def get_coordinator(self, job_id):
|
|
|
- return OozieCoordinator(self, MockOozieApi.JSON_COORDINATOR_LIST[0])
|
|
|
|
|
|
|
+ if job_id in MockOozieApi.COORDINATOR_DICT:
|
|
|
|
|
+ return OozieCoordinator(self, MockOozieApi.COORDINATOR_DICT[job_id])
|
|
|
|
|
+ else:
|
|
|
|
|
+ return OozieCoordinator(self, {'id': job_id, 'actions': []})
|
|
|
|
|
|
|
|
def get_action(self, action_id):
|
|
def get_action(self, action_id):
|
|
|
return WorkflowAction(MockOozieApi.WORKFLOW_ACTION)
|
|
return WorkflowAction(MockOozieApi.WORKFLOW_ACTION)
|
|
@@ -87,11 +94,14 @@ class MockOozieApi:
|
|
|
return '<xml></xml>'
|
|
return '<xml></xml>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+class MockOozieCoordinatorApi(MockOozieApi):
|
|
|
|
|
+ def submit_job(self, properties):
|
|
|
|
|
+ return 'ONE-OOZIE-ID-C'
|
|
|
|
|
+
|
|
|
# Monkey patch Lib Oozie with Mock API
|
|
# Monkey patch Lib Oozie with Mock API
|
|
|
oozie_api.OozieApi = MockOozieApi
|
|
oozie_api.OozieApi = MockOozieApi
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
class TestEditor:
|
|
class TestEditor:
|
|
|
|
|
|
|
|
def setUp(self):
|
|
def setUp(self):
|
|
@@ -315,6 +325,10 @@ class TestEditor:
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_workflow_permissions(self):
|
|
def test_workflow_permissions(self):
|
|
|
|
|
+ # Monkey patch Lib Oozie with Mock API
|
|
|
|
|
+ oozie_api.OozieApi = MockOozieApi
|
|
|
|
|
+ oozie_api._api_cache = None
|
|
|
|
|
+
|
|
|
response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
|
|
response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
|
|
|
assert_true('Editor' in response.content, response.content)
|
|
assert_true('Editor' in response.content, response.content)
|
|
|
assert_true('Workflow wf-name-1' in response.content, response.content)
|
|
assert_true('Workflow wf-name-1' in response.content, response.content)
|
|
@@ -406,6 +420,26 @@ class TestEditor:
|
|
|
finish()
|
|
finish()
|
|
|
finish_deployement()
|
|
finish_deployement()
|
|
|
|
|
|
|
|
|
|
+ # Resubmit
|
|
|
|
|
+ finish = SHARE_JOBS.set_for_testing(False)
|
|
|
|
|
+ finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
|
|
|
|
|
+ try:
|
|
|
|
|
+ job_id = History.objects.get(job=self.wf).oozie_job_id
|
|
|
|
|
+ response = client_not_me.post(reverse('oozie:resubmit_workflow', args=[job_id]))
|
|
|
|
|
+ assert_true('Permission denied' in response.content, response.content)
|
|
|
|
|
+ finally:
|
|
|
|
|
+ finish()
|
|
|
|
|
+ finish_deployement()
|
|
|
|
|
+ finish = SHARE_JOBS.set_for_testing(True)
|
|
|
|
|
+ finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
|
|
|
|
|
+ try:
|
|
|
|
|
+ job_id = History.objects.get(job=self.wf).oozie_job_id
|
|
|
|
|
+ response = client_not_me.post(reverse('oozie:resubmit_workflow', args=[job_id]))
|
|
|
|
|
+ assert_false('Permission denied' in response.content, response.content)
|
|
|
|
|
+ finally:
|
|
|
|
|
+ finish()
|
|
|
|
|
+ finish_deployement()
|
|
|
|
|
+
|
|
|
# Delete
|
|
# Delete
|
|
|
finish = SHARE_JOBS.set_for_testing(False)
|
|
finish = SHARE_JOBS.set_for_testing(False)
|
|
|
try:
|
|
try:
|
|
@@ -512,6 +546,9 @@ class TestEditor:
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_coordinator_permissions(self):
|
|
def test_coordinator_permissions(self):
|
|
|
|
|
+ oozie_api.OozieApi = MockOozieCoordinatorApi
|
|
|
|
|
+ oozie_api._api_cache = None
|
|
|
|
|
+
|
|
|
coord = create_coordinator(self.wf)
|
|
coord = create_coordinator(self.wf)
|
|
|
|
|
|
|
|
response = self.c.get(reverse('oozie:edit_coordinator', args=[coord.id]))
|
|
response = self.c.get(reverse('oozie:edit_coordinator', args=[coord.id]))
|
|
@@ -615,6 +652,27 @@ class TestEditor:
|
|
|
finish()
|
|
finish()
|
|
|
finish_deployement()
|
|
finish_deployement()
|
|
|
|
|
|
|
|
|
|
+ # Resubmit
|
|
|
|
|
+ # Monkey patch Lib Oozie with Mock API
|
|
|
|
|
+ finish = SHARE_JOBS.set_for_testing(False)
|
|
|
|
|
+ finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
|
|
|
|
|
+ try:
|
|
|
|
|
+ oozie_job_id = History.objects.get(job=coord).oozie_job_id
|
|
|
|
|
+ response = client_not_me.post(reverse('oozie:resubmit_coordinator', args=[oozie_job_id]))
|
|
|
|
|
+ assert_true('Permission denied' in response.content, response.content)
|
|
|
|
|
+ finally:
|
|
|
|
|
+ finish()
|
|
|
|
|
+ finish_deployement()
|
|
|
|
|
+ finish = SHARE_JOBS.set_for_testing(True)
|
|
|
|
|
+ finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
|
|
|
|
|
+ try:
|
|
|
|
|
+ oozie_job_id = History.objects.get(job=coord).oozie_job_id
|
|
|
|
|
+ response = client_not_me.post(reverse('oozie:resubmit_coordinator', args=[oozie_job_id]))
|
|
|
|
|
+ assert_false('Permission denied' in response.content, response.content)
|
|
|
|
|
+ finally:
|
|
|
|
|
+ finish()
|
|
|
|
|
+ finish_deployement()
|
|
|
|
|
+
|
|
|
# Delete
|
|
# Delete
|
|
|
finish = SHARE_JOBS.set_for_testing(False)
|
|
finish = SHARE_JOBS.set_for_testing(False)
|
|
|
try:
|
|
try:
|
|
@@ -768,18 +826,24 @@ class TestDashboard:
|
|
|
# Kill button in response
|
|
# Kill button in response
|
|
|
response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]), {}, follow=True)
|
|
response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]), {}, follow=True)
|
|
|
assert_true(('%s/kill' % MockOozieApi.WORKFLOW_IDS[0]) in response.content, response.content)
|
|
assert_true(('%s/kill' % MockOozieApi.WORKFLOW_IDS[0]) in response.content, response.content)
|
|
|
|
|
+ assert_false('Resubmit' in response.content, response.content)
|
|
|
|
|
|
|
|
|
|
+ # Resubmit button in response
|
|
|
response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[1]]), {}, follow=True)
|
|
response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[1]]), {}, follow=True)
|
|
|
assert_false(('%s/kill' % MockOozieApi.WORKFLOW_IDS[1]) in response.content, response.content)
|
|
assert_false(('%s/kill' % MockOozieApi.WORKFLOW_IDS[1]) in response.content, response.content)
|
|
|
|
|
+ assert_true('Resubmit' in response.content, response.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_manage_coordinator_dashboard(self):
|
|
def test_manage_coordinator_dashboard(self):
|
|
|
# Kill button in response
|
|
# Kill button in response
|
|
|
response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[0]]), {}, follow=True)
|
|
response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[0]]), {}, follow=True)
|
|
|
assert_true(('%s/kill' % MockOozieApi.COORDINATOR_IDS[0]) in response.content, response.content)
|
|
assert_true(('%s/kill' % MockOozieApi.COORDINATOR_IDS[0]) in response.content, response.content)
|
|
|
|
|
+ assert_false('Resubmit' in response.content, response.content)
|
|
|
|
|
|
|
|
|
|
+ # Resubmit button in response
|
|
|
response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[1]]), {}, follow=True)
|
|
response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[1]]), {}, follow=True)
|
|
|
assert_false(('%s/kill' % MockOozieApi.COORDINATOR_IDS[1]) in response.content, response.content)
|
|
assert_false(('%s/kill' % MockOozieApi.COORDINATOR_IDS[1]) in response.content, response.content)
|
|
|
|
|
+ assert_true('Resubmit' in response.content, response.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_list_workflows(self):
|
|
def test_list_workflows(self):
|