def templates_list(): try: return api_u.render( node_templates=[nt.dict for nt in api.get_node_templates()]) except Exception, e: return api_u.internal_error(500, "Exception while listing NodeTemplates", e)
def clusters_list(): tenant_id = request.headers['X-Tenant-Id'] try: return api_u.render( clusters=[c.dict for c in api.get_clusters(tenant_id=tenant_id)]) except Exception, e: return api_u.internal_error(500, 'Exception while listing Clusters', e)
def version_list(): context.set_ctx(None) return api_utils.render({ "versions": [ {"id": "v1.0", "status": "CURRENT"} ] })
def job_execute(job_id, data): input = data['input_id'] output = data['output_id'] cluster = data['cluster_id'] configs = data.get('job_configs', {}) return u.render(job_execution=api.execute_job(job_id, input, output, cluster, configs).to_dict())
def make_json_error(ex): status_code = (ex.code if isinstance(ex, HTTPException) else 500) description = (ex.description if isinstance(ex, HTTPException) else str(ex)) return render({'error': status_code, 'error_message': description}, status=status_code)
def job_executions_status(job_execution_id): job_execution = api.get_job_execution_status(job_execution_id) return u.render(job_execution.to_wrapped_dict())
def cluster_templates_list(): return u.render( cluster_templates=[t.to_dict() for t in api.get_cluster_templates()])
def job_create(data): return u.render(api.create_job(data).to_wrapped_dict())
def job_executions_list(): job_executions = [je.to_dict() for je in api.job_execution_list()] return u.render(job_executions=job_executions)
def job_origin_get(job_origin_id): return u.render(api.get_job_origin(job_origin_id).to_wrapped_dict())
def job_binary_internal_list(): return u.render(binaries=[j.to_dict() for j in api.get_job_binary_internals()])
def data_source_register(data): return u.render(api.register_data_source(data).to_wrapped_dict())
def job_origin_delete(job_origin_id): api.delete_job_origin(job_origin_id) return u.render()
def jobs_list(): return u.render(jobs=[j.to_dict() for j in api.get_jobs()])
def job_origin_get(job_origin_id): return u.render(api.get_job_origin(job_origin_id).wrapped_dict)
def job_executions_delete(job_execution_id): api.delete_job_execution(job_execution_id) return u.render()
def job_executions_cancel(job_execution_id): job_execution = api.cancel_job_execution(job_execution_id) return u.render(job_execution.to_wrapped_dict())
def cluster_templates_get(cluster_template_id): return u.render( api.get_cluster_template(cluster_template_id).to_wrapped_dict())
def job_get(job_id): return u.render(api.get_job(job_id).to_wrapped_dict())
def job_delete(job_id): api.delete_job(job_id) return u.render()
def data_source_delete(data_source_id): api.delete_data_source(data_source_id) return u.render()
def job_execute(job_id, input_id, output_id): return u.render(jobs=api.execute_job(job_id, input_id, output_id))
def job_binary_delete(job_binary_id): api.delete_job_binary(job_binary_id) return u.render()
def data_sources_list(): return u.render( data_sources=[ds.to_dict() for ds in api.get_data_sources()])
def job_binary_internal_delete(job_binary_internal_id): api.delete_job_binary_internal(job_binary_internal_id) return u.render()
def data_source_get(data_source_id): return u.render(api.get_data_source(data_source_id).to_wrapped_dict())
def clusters_delete(cluster_id): api.terminate_cluster(cluster_id) return u.render()
def job_origin_list(): return u.render(job_origins=[j.dict for j in api.get_job_origins()])
def cluster_templates_create(data): return u.render(api.create_cluster_template(data).to_wrapped_dict())
def job_origin_create(data): return u.render(api.create_job_origin(data))
def cluster_templates_delete(cluster_template_id): api.terminate_cluster_template(cluster_template_id) return u.render()
def node_group_templates_list(): return u.render( node_group_templates=[t.to_dict() for t in api.get_node_group_templates()])
def node_group_templates_create(data): return u.render(api.create_node_group_template(data).to_wrapped_dict())
def node_group_templates_get(node_group_template_id): return u.render( api.get_node_group_template(node_group_template_id).to_wrapped_dict())
def job_origin_list(): return u.render(job_origins=[j.to_dict() for j in api.get_job_origins()])
def node_group_templates_delete(node_group_template_id): api.terminate_node_group_template(node_group_template_id) return u.render()
def plugins_list(): return u.render(plugins=[p.dict for p in api.get_plugins()])
def job_binary_internal_create(**values): return u.render(api.create_job_binary_internal(values).to_wrapped_dict())
def plugins_get(plugin_name): return u.render(api.get_plugin(plugin_name).wrapped_dict)
def job_binary_internal_get(job_binary_internal_id): return u.render(api.get_job_binary_internal(job_binary_internal_id ).to_wrapped_dict())
def plugins_get_version(plugin_name, version): return u.render(api.get_plugin(plugin_name, version).wrapped_dict)
def jobs_list(): return u.render( jobs=[j.to_dict() for j in api.get_jobs()])
def plugins_convert_to_cluster_template(plugin_name, version, name, data): return u.render(api.convert_to_cluster_template(plugin_name, version, name, data).to_wrapped_dict())
def job_config_hints_get(job_type): return u.render(api.get_job_config_hints(job_type))
def job_binary_data(job_binary_id): data = api.get_job_binary_data(job_binary_id) if type(data) == dict: data = u.render(data) return data
def images_get(image_id): return u.render(api.get_image(id=image_id).wrapped_dict)
def images_set(image_id, data): return u.render(api.register_image(image_id, **data).wrapped_dict)
def images_list(): tags = u.get_request_args().getlist('tags') return u.render(images=[i.dict for i in api.get_images(tags)])