aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/orm
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-07-11 14:47:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-11 00:08:17 +0100
commitf33d51d46d70e73e04e325807c1bc4eb68462f7b (patch)
tree9c7788bd1153eac1d4c7bc924d5291171916835f /lib/toaster/orm
parentc868ea036aa34b387a72ec5116a66b2cd863995b (diff)
downloadbitbake-contrib-f33d51d46d70e73e04e325807c1bc4eb68462f7b.tar.gz
toaster: show progress of recipe parsing in recent builds area
Modify buildinfohelper and toasterui so that they record the recipe parse progress (from ParseProgress events in bitbake) on the Build object. Note that because the Build object is now created at the point when ParseStarted occurs, it is necessary to set the build name to the empty string initially (hence the migration). The build name can be set when the build properly starts, i.e. at the BuildStarted event. Then use this additional data to determine whether a Build is in a "Parsing" state, and report this in the JSON API. This enables the most recent builds area to show the recipe parse progress. Add additional logic to update the progress bar if the progress for a build object changes. [YOCTO #9631] Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Diffstat (limited to 'lib/toaster/orm')
-rw-r--r--lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py24
-rw-r--r--lib/toaster/orm/migrations/0014_allow_empty_buildname.py19
-rw-r--r--lib/toaster/orm/models.py17
3 files changed, 59 insertions, 1 deletions
diff --git a/lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py b/lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py
new file mode 100644
index 000000000..cc5c96d2d
--- /dev/null
+++ b/lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('orm', '0012_use_release_instead_of_up_branch'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='build',
+ name='recipes_parsed',
+ field=models.IntegerField(default=0),
+ ),
+ migrations.AddField(
+ model_name='build',
+ name='recipes_to_parse',
+ field=models.IntegerField(default=1),
+ ),
+ ]
diff --git a/lib/toaster/orm/migrations/0014_allow_empty_buildname.py b/lib/toaster/orm/migrations/0014_allow_empty_buildname.py
new file mode 100644
index 000000000..4749a14b2
--- /dev/null
+++ b/lib/toaster/orm/migrations/0014_allow_empty_buildname.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('orm', '0013_recipe_parse_progress_fields'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='build',
+ name='build_name',
+ field=models.CharField(default='', max_length=100),
+ ),
+ ]
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 2df6d4910..4641736ad 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -397,9 +397,15 @@ class Build(models.Model):
completed_on = models.DateTimeField()
outcome = models.IntegerField(choices=BUILD_OUTCOME, default=IN_PROGRESS)
cooker_log_path = models.CharField(max_length=500)
- build_name = models.CharField(max_length=100)
+ build_name = models.CharField(max_length=100, default='')
bitbake_version = models.CharField(max_length=50)
+ # number of recipes to parse for this build
+ recipes_to_parse = models.IntegerField(default=1)
+
+ # number of recipes parsed so far for this build
+ recipes_parsed = models.IntegerField(default=0)
+
@staticmethod
def get_recent(project=None):
"""
@@ -615,6 +621,13 @@ class Build(models.Model):
else:
return False
+ def is_parsing(self):
+ """
+ True if the build is still parsing recipes
+ """
+ return self.outcome == Build.IN_PROGRESS and \
+ self.recipes_parsed < self.recipes_to_parse
+
def get_state(self):
"""
Get the state of the build; one of 'Succeeded', 'Failed', 'In Progress',
@@ -628,6 +641,8 @@ class Build(models.Model):
return 'Cancelling';
elif self.is_queued():
return 'Queued'
+ elif self.is_parsing():
+ return 'Parsing'
else:
return self.get_outcome_text()