|
|
@@ -74,70 +74,26 @@ class DataEngClusterApi(Api):
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
def app(self, appid):
|
|
|
- oozie_api = get_oozie(self.user)
|
|
|
- workflow = oozie_api.get_job(jobid=appid)
|
|
|
-
|
|
|
- common = {
|
|
|
- 'id': workflow.id,
|
|
|
- 'name': workflow.appName,
|
|
|
- 'status': workflow.status,
|
|
|
- 'apiStatus': self._api_status(workflow.status),
|
|
|
- 'progress': workflow.get_progress(),
|
|
|
- 'type': 'workflow',
|
|
|
- }
|
|
|
-
|
|
|
- request = MockDjangoRequest(self.user)
|
|
|
- response = list_oozie_workflow(request, job_id=appid)
|
|
|
- common['properties'] = json.loads(response.content)
|
|
|
- common['properties']['xml'] = ''
|
|
|
- common['properties']['properties'] = ''
|
|
|
- common['properties']['coordinator_id'] = workflow.get_parent_job_id()
|
|
|
- common['properties']['bundle_id'] = workflow.conf_dict.get('oozie.bundle.id')
|
|
|
-
|
|
|
- return common
|
|
|
+ return {}
|
|
|
|
|
|
|
|
|
def action(self, appid, action):
|
|
|
- if action == 'change' or action == 'ignore' or ',' not in appid:
|
|
|
- request = MockDjangoRequest(self.user)
|
|
|
- response = manage_oozie_jobs(request, appid, action['action'])
|
|
|
- else:
|
|
|
- request = MockDjangoRequest(self.user, post={'job_ids': appid, 'action': action['action']})
|
|
|
- response = bulk_manage_oozie_jobs(request)
|
|
|
-
|
|
|
- return json.loads(response.content)
|
|
|
+ return {}
|
|
|
|
|
|
|
|
|
def logs(self, appid, app_type, log_name=None):
|
|
|
- request = MockDjangoRequest(self.user)
|
|
|
- data = get_oozie_job_log(request, job_id=appid)
|
|
|
-
|
|
|
- return {'logs': json.loads(data.content)['log']}
|
|
|
+ return {'logs': ''}
|
|
|
|
|
|
|
|
|
def profile(self, appid, app_type, app_property):
|
|
|
- if app_property == 'xml':
|
|
|
- oozie_api = get_oozie(self.user)
|
|
|
- workflow = oozie_api.get_job(jobid=appid)
|
|
|
- return {
|
|
|
- 'xml': workflow.definition,
|
|
|
- }
|
|
|
- elif app_property == 'properties':
|
|
|
- oozie_api = get_oozie(self.user)
|
|
|
- workflow = oozie_api.get_job(jobid=appid)
|
|
|
- return {
|
|
|
- 'properties': workflow.conf_dict,
|
|
|
- }
|
|
|
-
|
|
|
return {}
|
|
|
|
|
|
def _api_status(self, status):
|
|
|
if status in ['CREATING', 'CREATED', 'TERMINATING']:
|
|
|
return 'RUNNING'
|
|
|
- elif status in ['ARCHIVING']:
|
|
|
- return 'SUCCEEDED'
|
|
|
+ elif status in ['ARCHIVING', 'COMPLETED']:
|
|
|
+ return 'SUCCEEDED'
|
|
|
else:
|
|
|
return 'FAILED' # KILLED and FAILED
|
|
|
|
|
|
@@ -196,13 +152,6 @@ class DataEngJobApi(Api):
|
|
|
|
|
|
job = handle['jobs'][0]
|
|
|
|
|
|
-# {u'jobs': [{u'status': u'FAILED', u'submitterCrn': u'crn:altus:iam:us-west-1:12a0079b-1591-4ca0-b721-a446bda74e67:user:/csGD5p16ZWkUateZrvVk9zm10gXQAkjqKvsIPVkQ5U=/d122f235-3a45-46a0-b3a6-e572c76a711c',
|
|
|
-# u'jobId': u'9c697bc9-175d-4260-8d84-56fffc148810', u'clusterCrn': u'crn:altus:dataeng:us-west-1:12a0079b-1591-4ca0-b721-a446bda74e67:cluster:praveen-hive-on-mr/2bb313d7-ffbf-42bd-a9d9-5e4f827ea799',
|
|
|
-# u'creationDate': u'2017-04-06T00:32:51.673000+00:00', u'crn': u'crn:altus:dataeng:us-west-1:12a0079b-1591-4ca0-b721-a446bda74e67:job:9c697bc9-175d-4260-8d84-56fffc148810',
|
|
|
-# u'hiveJobDetails': {u'params': [], u'script': u'file:///Users/praveen/Code/Cloudera/scripts/queries/simple.hql'},
|
|
|
-# u'jobType': u'HIVE', u'failureAction': u'INTERRUPT_JOB_QUEUE'}]}
|
|
|
-
|
|
|
-
|
|
|
common = {
|
|
|
'id': job['jobId'],
|
|
|
'name': job['jobId'],
|
|
|
@@ -213,7 +162,7 @@ class DataEngJobApi(Api):
|
|
|
'submitted': job['creationDate'],
|
|
|
'type': 'dataeng-job-%s' % job['jobType'],
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
common['properties'] = {
|
|
|
'properties': job
|
|
|
}
|
|
|
@@ -222,14 +171,7 @@ class DataEngJobApi(Api):
|
|
|
|
|
|
|
|
|
def action(self, appid, action):
|
|
|
- if action == 'change' or action == 'ignore' or ',' not in appid:
|
|
|
- request = MockDjangoRequest(self.user)
|
|
|
- response = manage_oozie_jobs(request, appid, action['action'])
|
|
|
- else:
|
|
|
- request = MockDjangoRequest(self.user, post={'job_ids': appid, 'action': action['action']})
|
|
|
- response = bulk_manage_oozie_jobs(request)
|
|
|
-
|
|
|
- return json.loads(response.content)
|
|
|
+ return {}
|
|
|
|
|
|
|
|
|
def logs(self, appid, app_type, log_name=None):
|
|
|
@@ -237,19 +179,6 @@ class DataEngJobApi(Api):
|
|
|
|
|
|
|
|
|
def profile(self, appid, app_type, app_property):
|
|
|
- if app_property == 'xml':
|
|
|
- oozie_api = get_oozie(self.user)
|
|
|
- workflow = oozie_api.get_job(jobid=appid)
|
|
|
- return {
|
|
|
- 'xml': workflow.definition,
|
|
|
- }
|
|
|
- elif app_property == 'properties':
|
|
|
- oozie_api = get_oozie(self.user)
|
|
|
- workflow = oozie_api.get_job(jobid=appid)
|
|
|
- return {
|
|
|
- 'properties': workflow.conf_dict,
|
|
|
- }
|
|
|
-
|
|
|
return {}
|
|
|
|
|
|
def _api_status(self, status):
|
|
|
@@ -258,5 +187,5 @@ class DataEngJobApi(Api):
|
|
|
elif status in ['COMPLETED']:
|
|
|
return 'SUCCEEDED'
|
|
|
else:
|
|
|
- return 'FAILED' # INTERRUPTED , KILLED and FAILED
|
|
|
+ return 'FAILED' # INTERRUPTED , KILLED, TERMINATED and FAILED
|
|
|
|