From 2367ad638102957620af36b004daa4ef7239287d Mon Sep 17 00:00:00 2001 From: Josef Skladanka Date: Apr 09 2015 12:21:09 +0000 Subject: Add parameter which disables returning data from update_job As discussed in T456 and T452, we need to (as a short term workaround at least) be able to not return data from update_job, as it makes multiple selects on the Results table, which take too long. It is now ON by default, so the update_job() call returns just the status code and empty data. Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D333 --- diff --git a/resultsdb/controllers/api_v1.py b/resultsdb/controllers/api_v1.py index 31f1e3c..e2f6b22 100644 --- a/resultsdb/controllers/api_v1.py +++ b/resultsdb/controllers/api_v1.py @@ -258,6 +258,7 @@ RP['create_job'].add_argument('uuid', type = str, default = None, location = 'js RP['update_job'] = reqparse.RequestParser() RP['update_job'].add_argument('status', type = str, required = True, location = 'json') +RP['update_job'].add_argument('return_data', default = False, type = bool, location = 'args') @api.route('/v1.0/jobs', methods = ['GET']) @@ -359,7 +360,11 @@ def update_job(job_id): db.session.add(job) db.session.commit() - return jsonify(SERIALIZE(job)), 200 + data = {} + if args['return_data']: + data = job + + return jsonify(SERIALIZE(data)), 200 # =============================================================================