[jb] Avoid oozie related stack trace when oozie is blacklisted
NameError: name 'OOZIE_JOBS_COUNT' is not defined
@@ -33,9 +33,11 @@ try:
from oozie.views.dashboard import get_oozie_job_log, list_oozie_workflow, manage_oozie_jobs, bulk_manage_oozie_jobs, \
has_dashboard_jobs_access, massaged_oozie_jobs_for_json, has_job_edition_permission
has_oozie_installed = True
+ OOZIE_JOBS_COUNT_LIMIT = OOZIE_JOBS_COUNT.get()
except Exception as e:
LOG.warn('Some applications are not enabled for Job Browser v2: %s' % e)
has_oozie_installed = False
+ OOZIE_JOBS_COUNT_LIMIT = 100
class WorkflowApi(Api):
@@ -43,7 +45,7 @@ class WorkflowApi(Api):
def apps(self, filters):
oozie_api = get_oozie(self.user)
- kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
+ kwargs = {'cnt': OOZIE_JOBS_COUNT_LIMIT, 'filters': []}
_filter_oozie_jobs(self.user, filters, kwargs)
wf_list = oozie_api.get_workflows(**kwargs)
@@ -221,7 +223,7 @@ def _filter_oozie_jobs(user, filters, kwargs):
if filters['pagination']:
kwargs['offset'] = filters['pagination']['offset']
- kwargs['cnt'] = min(filters['pagination']['limit'], hasattr(OOZIE_JOBS_COUNT, 'get') and OOZIE_JOBS_COUNT.get())
+ kwargs['cnt'] = min(filters['pagination']['limit'], OOZIE_JOBS_COUNT_LIMIT)
if filters.get('states'):
states_filters = {'running': ['RUNNING', 'PREP', 'SUSPENDED'], 'completed': ['SUCCEEDED'], 'failed': ['FAILED', 'KILLED'],}
