def GET(self, scope, name): """ get locks for a given scope, name. HTTP Success: 200 OK HTTP Error: 404 Not Found 406 Not Acceptable 500 InternalError :returns: JSON dict containing informations about the requested user. """ header('Content-Type', 'application/x-json-stream') did_type = None if ctx.query: params = parse_qs(ctx.query[1:]) if 'did_type' in params: did_type = params['did_type'][0] try: if did_type == 'dataset': for lock in get_dataset_locks(scope, name, vo=ctx.env.get('vo')): yield render_json(**lock) + '\n' else: raise InternalError('Wrong did_type specified') except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error)
def GET(self, scope, name): """ get locks for a given scope, name. :param scope: The DID scope. :param name: The DID name. :query did_type: The type used to filter, e.g., DATASET, CONTAINER. :resheader Content-Type: application/x-json-stream :status 200: OK. :status 401: Invalid Auth Token. :status 406: Not Acceptable. :status 500: Internal Error. :returns: Line separated list of dictionary with lock information. """ did_type = request.args.get('did_type', None) try: if did_type == 'dataset': data = "" for lock in get_dataset_locks(scope, name): data += render_json(**lock) + '\n' return Response(data, content_type="application/x-json-stream") else: return 'Wrong did_type specified', 500 except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: return error, 500
def GET(self, scope, name): """ get locks for a given scope, name. HTTP Success: 200 OK HTTP Error: 404 Not Found 500 InternalError :returns: JSON dict containing informations about the requested user. """ header('Content-Type', 'application/x-json-stream') did_type = None if ctx.query: params = parse_qs(ctx.query[1:]) if 'did_type' in params: did_type = params['did_type'][0] try: if did_type == 'dataset': for lock in get_dataset_locks(scope, name): yield render_json(**lock) + '\n' else: raise InternalError('Wrong did_type specified') except RucioException, e: raise generate_http_error(500, e.__class__.__name__, e.args[0])
def generate(vo): for lock in get_dataset_locks(scope, name, vo=vo): yield render_json(**lock) + '\n'