本文整理汇总了Python中sahara.utils.api.get_request_args函数的典型用法代码示例。如果您正苦于以下问题:Python get_request_args函数的具体用法?Python get_request_args怎么用?Python get_request_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_request_args函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handler
def handler(*args, **kwargs):
if id_prop and not get_args:
get_args['id'] = id_prop[0]
if 'marker' in id_prop:
if 'marker' not in u.get_request_args():
return func(*args, **kwargs)
kwargs['marker'] = u.get_request_args()['marker']
get_kwargs = {}
for get_arg in get_args:
get_kwargs[get_arg] = kwargs[get_args[get_arg]]
obj = None
try:
obj = get_func(**get_kwargs)
except Exception as e:
cls_name = reflection.get_class_name(e, fully_qualified=False)
if 'notfound' not in cls_name.lower():
raise e
if obj is None:
e = ex.NotFoundException(get_kwargs,
_('Object with %s not found'))
return u.not_found(e)
if 'marker' in kwargs:
del(kwargs['marker'])
return func(*args, **kwargs)
示例2: job_templates_list
def job_templates_list():
result = api.get_job_templates(**u.get_request_args().to_dict())
for jt in result:
u._replace_tenant_id_project_id(jt)
_replace_tenant_id_project_id_job_binary(jt['mains'])
_replace_tenant_id_project_id_job_binary(jt['libs'])
return u.render(res=result, name='job_templates')
示例3: get_sorting_field
def get_sorting_field():
request_args = u.get_request_args()
if 'sort_by' in request_args:
sort_by = request_args['sort_by']
if sort_by:
sort_by = sort_by[1:] if sort_by[0] == '-' else sort_by
return sort_by
return None
示例4: jobs_get
def jobs_get(job_id):
data = u.get_request_args()
refresh_status = six.text_type(
data.get('refresh_status', 'false')).lower() == 'true'
result = {'job': api.get_job_execution(job_id, refresh_status)}
result['job'].pop('oozie_job_id', force=True)
u._replace_tenant_id_project_id(result['job'])
_replace_job_id_job_template_id(result['job'])
return u.render(result)
示例5: job_types_get
def job_types_get():
# We want to use flat=False with to_dict() so that
# the value of each arg is given as a list. This supports
# filters of the form ?type=Pig&type=Java, etc.
request_args = u.get_request_args().to_dict(flat=False)
if 'plugin_version' in request_args:
request_args['hadoop_version'] = request_args['plugin_version']
del request_args['plugin_version']
return u.render(job_types=api.get_job_types(**request_args))
示例6: jobs_list
def jobs_list():
result = api.job_execution_list(**u.get_request_args().to_dict())
# APIv2: renaming oozie_job_id -> engine_job_id
# once APIv1 is deprecated this can be
# removed
for je in result:
je.pop('oozie_job_id', force=True)
u._replace_tenant_id_project_id(je)
_replace_job_id_job_template_id(je)
return u.render(res=result, name='jobs')
示例7: node_group_templates_list
def node_group_templates_list():
request_args = u.get_request_args().to_dict()
if 'plugin_version' in request_args:
request_args['hadoop_version'] = request_args['plugin_version']
del request_args['plugin_version']
result = api.get_node_group_templates(**request_args)
for ngt in result:
u._replace_hadoop_version_plugin_version(ngt)
u._replace_tenant_id_project_id(ngt)
return u.render(res=result, name="node_group_templates")
示例8: cluster_templates_list
def cluster_templates_list():
request_args = u.get_request_args().to_dict()
if 'plugin_version' in request_args:
request_args['hadoop_version'] = request_args['plugin_version']
del request_args['plugin_version']
result = api.get_cluster_templates(**request_args)
for ct in result:
u._replace_hadoop_version_plugin_version(ct)
u._replace_tenant_id_project_id(ct)
return u.render(res=result, name='cluster_templates')
示例9: clusters_get
def clusters_get(cluster_id):
data = u.get_request_args()
show_events = six.text_type(
data.get('show_progress', 'false')).lower() == 'true'
result = u.to_wrapped_dict_no_render(
api.get_cluster, cluster_id, show_events)
u._replace_hadoop_version_plugin_version(result['cluster'])
u._replace_tenant_id_project_id(result['cluster'])
_replace_tenant_id_project_id_provision_steps(result['cluster'])
return u.render(result)
示例10: validate_pagination_limit
def validate_pagination_limit():
request_args = u.get_request_args()
if 'limit' in request_args:
if types.is_int(request_args['limit']):
if not int(request_args['limit']) > 0:
raise ex.SaharaException(
_("'limit' must be positive integer"), 400)
else:
raise ex.SaharaException(
_("'limit' must be positive integer"), 400)
示例11: clusters_get
def clusters_get(cluster_id):
data = u.get_request_args()
show_events = six.text_type(
data.get('show_progress', 'false')).lower() == 'true'
return u.to_wrapped_dict(api.get_cluster, cluster_id, show_events)
示例12: clusters_list
def clusters_list():
return u.render(clusters=[c.to_dict() for c in api.get_clusters(
**u.get_request_args().to_dict())])
示例13: images_list
def images_list():
tags = u.get_request_args().getlist('tags')
return u.render(images=[i.dict for i in api.get_images(tags)])
示例14: data_sources_list
def data_sources_list():
result = api.get_data_sources(**u.get_request_args().to_dict())
return u.render(res=result, name='data_sources')
示例15: job_executions_list
def job_executions_list():
result = api.job_execution_list(
**u.get_request_args().to_dict())
return u.render(res=result, name='job_executions')