From 9dcb9cb2ccf52fa846ce1462e01f045253959328 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Wed, 6 Apr 2016 17:46:35 +0100 Subject: bitbake: toaster: bldcontrol models Add a cancelling state the BuildRequest To accurately reflect the state of a build request we also need a cancelling state. This is set when we've started a build and then for whatever reason cancel it, cancelling is not instantaneous so we have this state to indicate that a cancel is in progress. Also add a state transition guard. As the state of a BuildRequest can currently be modified by three processes; Toastergui, Runbuilds/bldcontrol and the buildinofhelper we cannot say for sure which process will be running at the time of cancellation so in order to avoid one of these processes making an incorrect transition only allow transitions of state to increase. e.g. CREATED -> QUEUED -> INPROGRESS And to ignore such requested changes such as INPROGRESS -> CREATED (Bitbake rev: 449598c8e6be75bd0c9d59e7bdf859d1d6f83858) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- .../migrations/0003_add_cancelling_state.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0003_add_cancelling_state.py (limited to 'bitbake/lib/toaster/bldcontrol/migrations') diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0003_add_cancelling_state.py b/bitbake/lib/toaster/bldcontrol/migrations/0003_add_cancelling_state.py new file mode 100644 index 0000000000..eec9216ca3 --- /dev/null +++ b/bitbake/lib/toaster/bldcontrol/migrations/0003_add_cancelling_state.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bldcontrol', '0002_auto_20160120_1250'), + ] + + operations = [ + migrations.AlterField( + model_name='buildrequest', + name='state', + field=models.IntegerField(default=0, choices=[(0, b'created'), (1, b'queued'), (2, b'in progress'), (3, b'completed'), (4, b'failed'), (5, b'deleted'), (6, b'cancelling'), (7, b'archive')]), + ), + ] -- cgit v1.2.3-54-g00ecf