From 5dc67d8382dd0c0aaf5b9d74df4dd2c00585af4e Mon Sep 17 00:00:00 2001 From: Josef Skladanka Date: Jul 07 2016 13:27:47 +0000 Subject: Remove the unnecessary constraint on RUNNING job Removes the unnecessary constraint on the job.status - it no longer needs to be "running" in order to add results. This makes it into more of a group of results, than "job execution status". Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D914 --- diff --git a/resultsdb/controllers/api_v1.py b/resultsdb/controllers/api_v1.py index 8e06bed..a6d153b 100644 --- a/resultsdb/controllers/api_v1.py +++ b/resultsdb/controllers/api_v1.py @@ -561,7 +561,13 @@ def create_result(): return jsonify({'message': "Job not found" }), 404 if job.status != 'RUNNING': - return jsonify({'message': "Job not running" }), 400 + # Side-effects based on status transitions + if job.start_time is None or job.status == 'SCHEDULED': + job.start_time = datetime.datetime.utcnow() + job.status = 'RUNNING' + + if job.end_time: + job.end_time = datetime.datetime.utcnow() try: testcase = Testcase.query.filter_by(name = args['testcase_name']).one()