From ff7aba28f7071a787ed3c0b230139512bf05f86a Mon Sep 17 00:00:00 2001 From: Marlon Rodriguez Garcia Date: Thu, 14 Dec 2023 14:44:09 -0500 Subject: bitbake: toaster: Added validation to stop import if there is a build in progress Added validation to prevent simultaneous imports from running because the database fails at runtime. The option to create a queue was taken into consideration. However, it will require the use of Celery https://pypi.org/project/celery/ or Background Task https://pypi.org/project/django-background-tasks/ which require the use of external services and multiple dependencies. If required we could explore the alternative in the future. (Bitbake rev: eb417e27be5717a259f27e98dbd73255b1a42fc9) Signed-off-by: Marlon Rodriguez Garcia Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/views.py') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 3b5b9f5bd9..40aed265dc 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2018,6 +2018,14 @@ class CommandLineBuilds(TemplateView): logs_dir = request.POST.get('dir') all_files = request.POST.get('all') + # check if a build is already in progress + if Build.objects.filter(outcome=Build.IN_PROGRESS): + messages.add_message( + self.request, + messages.ERROR, + "A build is already in progress. Please wait for it to complete before starting a new build." + ) + return JsonResponse({'response': 'building'}) imported_files = EventLogsImports.objects.all() try: if all_files == 'true': -- cgit v1.2.3-54-g00ecf