Esempio n. 1
0
    def profile(self, appid, app_type, app_property, app_filters):
        appid = appid.rsplit('-')[-1]

        if app_property == 'tasks':
            api = HiveSchedulerApi(user=self.user)

            return [{
                'status': task['state'],
                'title': task['executor_query_id'],
            } for task in api.list_executed_tasks(appid)]
        else:
            return {}
Esempio n. 2
0
    def action(self, app_ids, operation):
        api = HiveSchedulerApi(user=self.user)

        operations = []
        actual_app_ids = [app_id.rsplit('-')[-1] for app_id in app_ids]

        for app_id in actual_app_ids:
            try:
                api.action(app_id, operation['action'])
                operations.append(app_id)
            except Exception:
                LOG.exception('Could not stop job %s' % app_id)

        return {
            'kills':
            operations,
            'status':
            len(app_ids) - len(operations),
            'message':
            _('%s signal sent to %s') % (operation['action'], operations)
        }
Esempio n. 3
0
    def apps(self, filters):
        api = HiveSchedulerApi(user=self.user)

        tasks = api.list_tasks(self.user)

        return {
            'apps': [{
                'id': 'schedule-hive-%(scheduled_query_id)s' % app,
                'name': '%(schedule_name)s' % app,
                'status': self._massage_status(app),
                'apiStatus': self._api_status(self._massage_status(app)),
                'type': 'schedule-hive',
                'user': app['user'],
                'progress': 50,
                'queue': app['cluster_namespace'],
                'canWrite': self.user.username == app['user'],
                'duration': 1,
                'submitted': app['enabled']
            } for app in tasks],
            'total':
            len(tasks)
        }
Esempio n. 4
0
def get_api(request, interface):
    if interface == 'hive':
        from desktop.lib.scheduler.lib.hive import HiveSchedulerApi
        return HiveSchedulerApi(user=request.user)
    elif interface == 'beat':
        from desktop.lib.scheduler.lib.beat import CeleryBeatApi
        return CeleryBeatApi(user=request.user)
    elif interface == 'oozie':
        from desktop.lib.scheduler.lib.oozie import OozieApi
        return OozieApi(user=request.user)
    else:
        raise PopupException(
            _('Scheduler connector interface not recognized: %s') % interface)
Esempio n. 5
0
    def app(self, appid):
        appid = appid.rsplit('-')[-1]
        api = HiveSchedulerApi(user=self.user)

        app = api.list_task(appid)

        return {
            'id': 'schedule-hive-%(scheduled_query_id)s' % app,
            'name': '%(schedule_name)s' % app,
            'status': self._massage_status(app),
            'apiStatus': self._api_status(self._massage_status(app)),
            'type': 'schedule-hive',
            'user': app['user'],
            'progress': 50,
            'queue': app['cluster_namespace'],
            'duration': 1,
            'canWrite': self.user.username == app['user'],
            'submitted': app['enabled'],
            'properties': {
                'query': app['query'],
                'tasks': []
            }
        }