Beispiel #1
0
    def apps(self, filters):
        api = DataEng(self.user)

        jobs = api.list_clusters()

        return {
            'apps': [{
                'id':
                app['clusterName'],
                'name':
                '%(workersGroupSize)s %(instanceType)s %(cdhVersion)s' % app,
                'status':
                app['status'],
                'apiStatus':
                self._api_status(app['status']),
                'type':
                app['serviceType'],
                'user':
                app['clusterName'].split('-', 1)[0],
                'progress':
                100,
                'queue':
                'group',
                'duration':
                10 * 3600,
                'submitted':
                app['creationDate']
            } for app in jobs['clusters']],
            'total':
            None
        }
Beispiel #2
0
    def apps(self, filters):
        kwargs = {}

        if 'time' in filters:
            if filters['time']['time_unit'] == 'minutes':
                delta = timedelta(minutes=int(filters['time']['time_value']))
            elif filters['time']['time_unit'] == 'hours':
                delta = timedelta(hours=int(filters['time']['time_value']))
            else:
                delta = timedelta(days=int(filters['time']['time_value']))
            kwargs['creation_date_after'] = (datetime.today() -
                                             delta).strftime(DATE_FORMAT)

        api = DataEng(self.user)

        jobs = api.list_jobs(**kwargs)

        return {
            'apps': [{
                'id': app['jobId'],
                'name': app['creationDate'],
                'status': app['status'],
                'apiStatus': self._api_status(app['status']),
                'type': app['jobType'],
                'user': '',
                'progress': 100,
                'duration': 10 * 3600,
                'submitted': app['creationDate']
            } for app in jobs['jobs']],
            'total':
            None
        }
Beispiel #3
0
    def app(self, appid):
        handle = DataEng(self.user).describe_jobs(job_ids=[appid])

        job = handle['jobs'][0]

        common = {
            'id': job['jobId'],
            'name': job['jobId'],
            'status': job['status'],
            'apiStatus': self._api_status(job['status']),
            'progress': 50,
            'duration': 10 * 3600,
            'submitted': job['creationDate'],
            'type': 'dataeng-job-%s' % job['jobType'],
        }

        common['properties'] = {'properties': job}

        return common