diff options
author | Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com> | 2023-12-14 14:44:09 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-16 13:06:11 +0000 |
commit | ff7aba28f7071a787ed3c0b230139512bf05f86a (patch) | |
tree | 4aece43df72fbb4e4d4372f72cfa09d7a2b24d79 /bitbake | |
parent | 53d45455a22490bb5d29f62d43b4afa865e141d2 (diff) | |
download | poky-ff7aba28f7071a787ed3c0b230139512bf05f86a.tar.gz |
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 <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/command_line_builds.html | 6 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/views.py | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/command_line_builds.html b/bitbake/lib/toaster/toastergui/templates/command_line_builds.html index fcbe80d8d1..05db6727e7 100644 --- a/bitbake/lib/toaster/toastergui/templates/command_line_builds.html +++ b/bitbake/lib/toaster/toastergui/templates/command_line_builds.html | |||
@@ -152,7 +152,11 @@ function _ajax_update(file, all, dir){ | |||
152 | type: "POST", | 152 | type: "POST", |
153 | data: {file: file, all: all, dir: dir}, | 153 | data: {file: file, all: all, dir: dir}, |
154 | success:function(data){ | 154 | success:function(data){ |
155 | window.location = '/toastergui/builds/' | 155 | if (data['response']=='building'){ |
156 | location.reload() | ||
157 | } else { | ||
158 | window.location = '/toastergui/builds/' | ||
159 | } | ||
156 | }, | 160 | }, |
157 | complete:function(data){ | 161 | complete:function(data){ |
158 | }, | 162 | }, |
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): | |||
2018 | logs_dir = request.POST.get('dir') | 2018 | logs_dir = request.POST.get('dir') |
2019 | all_files = request.POST.get('all') | 2019 | all_files = request.POST.get('all') |
2020 | 2020 | ||
2021 | # check if a build is already in progress | ||
2022 | if Build.objects.filter(outcome=Build.IN_PROGRESS): | ||
2023 | messages.add_message( | ||
2024 | self.request, | ||
2025 | messages.ERROR, | ||
2026 | "A build is already in progress. Please wait for it to complete before starting a new build." | ||
2027 | ) | ||
2028 | return JsonResponse({'response': 'building'}) | ||
2021 | imported_files = EventLogsImports.objects.all() | 2029 | imported_files = EventLogsImports.objects.all() |
2022 | try: | 2030 | try: |
2023 | if all_files == 'true': | 2031 | if all_files == 'true': |