本文整理汇总了Python中oozie.conf.OOZIE_JOBS_COUNT类的典型用法代码示例。如果您正苦于以下问题:Python OOZIE_JOBS_COUNT类的具体用法?Python OOZIE_JOBS_COUNT怎么用?Python OOZIE_JOBS_COUNT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OOZIE_JOBS_COUNT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_oozie_workflows
def list_oozie_workflows(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
if not has_dashboard_jobs_access(request.user):
kwargs['filters'].append(('user', request.user.username))
oozie_api = get_oozie(request.user)
if request.GET.get('format') == 'json':
just_sla = request.GET.get('justsla') == 'true'
if request.GET.get('startcreatedtime'):
kwargs['filters'].extend([('startcreatedtime', request.GET.get('startcreatedtime'))])
if request.GET.get('offset'):
kwargs['offset'] = request.GET.get('offset')
json_jobs = []
total_jobs = 0
if request.GET.getlist('status'):
kwargs['filters'].extend([('status', status) for status in request.GET.getlist('status')])
wf_list = oozie_api.get_workflows(**kwargs)
json_jobs = wf_list.jobs
total_jobs = wf_list.total
if request.GET.get('type') == 'progress':
json_jobs = [oozie_api.get_job(job.id) for job in json_jobs]
response = massaged_oozie_jobs_for_json(json_jobs, request.user, just_sla)
response['total_jobs'] = total_jobs
return JsonResponse(response, encoder=JSONEncoderForHTML)
return render('dashboard/list_oozie_workflows.mako', request, {
'user': request.user,
'jobs': [],
'has_job_edition_permission': has_job_edition_permission,
})
示例2: list_oozie_workflows
def list_oozie_workflows(request):
kwargs = {"cnt": OOZIE_JOBS_COUNT.get(), "filters": []}
if not has_dashboard_jobs_access(request.user):
kwargs["filters"].append(("user", request.user.username))
oozie_api = get_oozie(request.user)
if request.GET.get("format") == "json":
just_sla = request.GET.get("justsla") == "true"
if request.GET.get("startcreatedtime"):
kwargs["filters"].extend([("startcreatedtime", request.GET.get("startcreatedtime"))])
if request.GET.get("offset"):
kwargs["offset"] = request.GET.get("offset")
json_jobs = []
total_jobs = 0
if request.GET.getlist("status"):
kwargs["filters"].extend([("status", status) for status in request.GET.getlist("status")])
wf_list = oozie_api.get_workflows(**kwargs)
json_jobs = wf_list.jobs
total_jobs = wf_list.total
if request.GET.get("type") == "progress":
json_jobs = [oozie_api.get_job(job.id) for job in json_jobs]
response = massaged_oozie_jobs_for_json(json_jobs, request.user, just_sla)
response["total_jobs"] = total_jobs
return JsonResponse(response, encoder=JSONEncoderForHTML)
return render(
"dashboard/list_oozie_workflows.mako",
request,
{"user": request.user, "jobs": [], "has_job_edition_permission": has_job_edition_permission},
)
示例3: apps
def apps(self, filters):
oozie_api = get_oozie(self.user)
kwargs = {'cnt': hasattr(OOZIE_JOBS_COUNT, 'get') and OOZIE_JOBS_COUNT.get(), 'filters': []}
filters.pop('time')
_filter_oozie_jobs(self.user, filters, kwargs)
jobs = oozie_api.get_coordinators(**kwargs)
return {
'apps':[{
'id': app['id'],
'name': app['appName'],
'status': app['status'],
'apiStatus': self._api_status(app['status']),
'type': 'schedule',
'user': app['user'],
'progress': app['progress'],
'queue': app['group'],
'duration': app['durationInMillis'],
'submitted': app['lastActionInMillis'] * 1000,
'canWrite': app['canEdit']
} for app in massaged_oozie_jobs_for_json(jobs.jobs, self.user)['jobs']],
'total': jobs.total
}
示例4: list_oozie_bundles
def list_oozie_bundles(request):
kwargs = {"cnt": OOZIE_JOBS_COUNT.get(), "filters": []}
if not has_dashboard_jobs_access(request.user):
kwargs["filters"].append(("user", request.user.username))
oozie_api = get_oozie(request.user)
if request.GET.get("format") == "json":
if request.GET.get("offset"):
kwargs["offset"] = request.GET.get("offset")
json_jobs = []
total_jobs = 0
if request.GET.getlist("status"):
kwargs["filters"].extend([("status", status) for status in request.GET.getlist("status")])
bundle_list = oozie_api.get_bundles(**kwargs)
json_jobs = bundle_list.jobs
total_jobs = bundle_list.total
if request.GET.get("type") == "progress":
json_jobs = [oozie_api.get_coordinator(job.id) for job in json_jobs]
response = massaged_oozie_jobs_for_json(json_jobs, request.user)
response["total_jobs"] = total_jobs
return JsonResponse(response, encoder=JSONEncoderForHTML)
return render(
"dashboard/list_oozie_bundles.mako",
request,
{"jobs": [], "has_job_edition_permission": has_job_edition_permission},
)
示例5: list_oozie_bundles
def list_oozie_bundles(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
if not has_dashboard_jobs_access(request.user):
kwargs['filters'].append(('user', request.user.username))
oozie_api = get_oozie(request.user)
if request.GET.get('format') == 'json':
if request.GET.get('offset'):
kwargs['offset'] = request.GET.get('offset')
json_jobs = []
total_jobs = 0
if request.GET.getlist('status'):
kwargs['filters'].extend([('status', status) for status in request.GET.getlist('status')])
bundle_list = oozie_api.get_bundles(**kwargs)
json_jobs = bundle_list.jobs
total_jobs = bundle_list.total
if request.GET.get('type') == 'progress':
json_jobs = [oozie_api.get_coordinator(job.id) for job in json_jobs]
response = massaged_oozie_jobs_for_json(json_jobs, request.user)
response['total_jobs'] = total_jobs
return JsonResponse(response, encoder=JSONEncoderForHTML)
return render('dashboard/list_oozie_bundles.mako', request, {
'jobs': [],
'has_job_edition_permission': has_job_edition_permission,
})
示例6: apps
def apps(self, filters):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
text_filters = _extract_query_params(filters)
if not has_dashboard_jobs_access(self.user):
kwargs['filters'].append(('user', self.user.username))
elif 'user' in text_filters:
kwargs['filters'].append(('user', text_filters['username']))
if 'time' in filters:
kwargs['filters'].extend([('startcreatedtime', '-%s%s' % (filters['time']['time_value'], filters['time']['time_unit'][:1]))])
if ENABLE_OOZIE_BACKEND_FILTERING.get() and text_filters.get('text'):
kwargs['filters'].extend([('text', text_filters.get('text'))])
if filters['pagination']:
kwargs['offset'] = filters['pagination']['offset']
kwargs['cnt'] = min(filters['pagination']['limit'], OOZIE_JOBS_COUNT.get())
if filters.get('states'):
states_filters = {'running': ['RUNNING', 'PREP', 'SUSPENDED'], 'completed': ['SUCCEEDED'], 'failed': ['FAILED', 'KILLED'],}
for _state in filters.get('states'):
for _status in states_filters[_state]:
kwargs['filters'].extend([('status', _status)])
oozie_api = get_oozie(self.user)
wf_list = oozie_api.get_workflows(**kwargs)
return {
'apps':[{
'id': app['id'],
'name': app['appName'],
'status': app['status'],
'apiStatus': self._api_status(app['status']),
'type': 'workflow',
'user': app['user'],
'progress': app['progress'],
'duration': app['durationInMillis'],
'submitted': app['startTimeInMillis']
} for app in massaged_oozie_jobs_for_json(wf_list.jobs, self.user)['jobs']],
'total': wf_list.total
}
示例7: list_oozie_coordinators
def list_oozie_coordinators(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(),}
if not request.user.is_superuser:
kwargs['user'] = request.user.username
coordinators = get_oozie().get_coordinators(**kwargs)
return render('dashboard/list_oozie_coordinators.mako', request, {
'jobs': split_oozie_jobs(coordinators.jobs),
})
示例8: list_oozie_coordinators
def list_oozie_coordinators(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(),}
if not has_dashboard_jobs_access(request.user):
kwargs['user'] = request.user.username
coordinators = get_oozie().get_coordinators(**kwargs)
return render('dashboard/list_oozie_coordinators.mako', request, {
'jobs': split_oozie_jobs(coordinators.jobs),
'has_job_edition_permission': has_job_edition_permission,
})
示例9: list_oozie_workflows
def list_oozie_workflows(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(),}
if not request.user.is_superuser:
kwargs['user'] = request.user.username
workflows = get_oozie().get_workflows(**kwargs)
return render('dashboard/list_oozie_workflows.mako', request, {
'user': request.user,
'jobs': split_oozie_jobs(workflows.jobs),
})
示例10: apps
def apps(self, filters):
oozie_api = get_oozie(self.user)
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
wf_list = oozie_api.get_bundles(**kwargs)
return [{
'id': app.id,
'name': app.appName,
'status': app.status,
'type': 'bundle',
'user': app.user,
'progress': 100,
'duration': 10 * 3600,
'submitted': 10 * 3600
} for app in wf_list.jobs]
示例11: list_oozie_workflows
def list_oozie_workflows(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(),}
if not has_dashboard_jobs_access(request.user):
kwargs['user'] = request.user.username
workflows = get_oozie().get_workflows(**kwargs)
if request.GET.get('format') == 'json':
return HttpResponse(json.dumps(massaged_oozie_jobs_for_json(workflows.jobs, request.user)), mimetype="application/json")
return render('dashboard/list_oozie_workflows.mako', request, {
'user': request.user,
'jobs': split_oozie_jobs(workflows.jobs),
'has_job_edition_permission': has_job_edition_permission,
})
示例12: apps
def apps(self, filters):
oozie_api = get_oozie(self.user)
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': filters}
wf_list = oozie_api.get_workflows(**kwargs)
return [{
'id': app.id,
'name': app.appName,
'status': app.status,
'apiStatus': self._api_status(app.status),
'type': 'workflow',
'user': app.user,
'progress': app.get_progress(),
'duration': 10 * 3600,
'submitted': 10 * 3600
} for app in wf_list.jobs]
示例13: list_oozie_bundles
def list_oozie_bundles(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(),}
if not has_dashboard_jobs_access(request.user):
kwargs['user'] = request.user.username
bundles = get_oozie().get_bundles(**kwargs)
if request.GET.get('format') == 'json':
json_jobs = bundles.jobs
if request.GET.get('type') == 'running':
json_jobs = split_oozie_jobs(bundles.jobs)['running_jobs']
if request.GET.get('type') == 'completed':
json_jobs = split_oozie_jobs(bundles.jobs)['completed_jobs']
return HttpResponse(json.dumps(massaged_oozie_jobs_for_json(json_jobs, request.user)).replace('\\\\', '\\'), mimetype="application/json")
return render('dashboard/list_oozie_bundles.mako', request, {
'jobs': split_oozie_jobs(bundles.jobs),
'has_job_edition_permission': has_job_edition_permission,
})
示例14: apps
def apps(self):
oozie_api = get_oozie(self.user)
kwargs = {"cnt": OOZIE_JOBS_COUNT.get(), "filters": []}
wf_list = oozie_api.get_workflows(**kwargs)
return [
{
"id": app.id,
"name": app.appName,
"status": app.status,
"type": "workflow",
"user": app.user,
"progress": 100,
"duration": 10 * 3600,
"submitted": 10 * 3600,
}
for app in wf_list.jobs
if app.appName.startswith(OozieApi.BATCH_JOB_PREFIX)
]
示例15: apps
def apps(self, filters):
oozie_api = get_oozie(self.user)
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
jobs = oozie_api.get_coordinators(**kwargs)
return {
'apps':[{
'id': app['id'],
'name': app['appName'],
'status': app['status'],
'apiStatus': self._api_status(app['status']),
'type': 'schedule',
'user': app['user'],
'progress': app['progress'],
'duration': app['durationInMillis'],
'submitted': app['startTimeInMillis']
} for app in massaged_oozie_jobs_for_json(jobs.jobs, self.user)['jobs']],
'total': jobs.total
}