Cancel builds when cli is interrupted
v3 cover Cancel builds when cli is interrupted
If a bitbake build is running on the command line and is interrupted (e.g. by Ctrl-c), capture the interrupt and shut down the bitbake server. Also set the outcome to CANCELLED so the build displays correctly in the Toaster UI.
The following changes since commit c8ea873d9883f8cdabb6ccadd31bd9967a0f0111:
toaster: tweaks to recipe file downloads (2016-04-29 14:21:32 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib elliot/toaster/8515-interrupted_cli_builds
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/8515-interrupted_cli_builds
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8515
Elliot Smith (3):
buildinfohelper: add method to set current build as CANCELLED
toasterui: capture keyboard interrupts the same way as knotty
toaster: don't show "Rebuild" button for cancelled cli builds
bitbake/lib/bb/ui/buildinfohelper.py | 10 +++++++++ bitbake/lib/bb/ui/toasterui.py | 17 ++++++++++++++- .../toaster/toastergui/templates/mrb_section.html | 25 ++++++++++++---------- 3 files changed, 40 insertions(+), 12 deletions(-)
--
1.9.3
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH v3 1/3 buildinfohelper: add method to set current build as CANCELLED
This will be used from toasterui to cancel the current command-line build when a keyboard interrupt is captured.
[YOCTO #8515]
--- bitbake/lib/bb/ui/buildinfohelper.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
bitbake/lib/bb/ui/buildinfohelper.py +10 -0
@@ -1251,6 +1251,16 @@ class BuildInfoHelper(object): + def cancel_cli_build(self): + """ + If a build is currently underway, set its state to CANCELLED; + note that this only gets called for command line builds which are + interrupted, so it doesn't touch any BuildRequest objects + """ + build = self.internal_state['build'] + if build: + build.outcome = Build.CANCELLED + build.save() def store_dependency_information(self, event): assert '_depgraph' in vars(event)
Signature · 12 lines
1.9.3 --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH v3 2/3 toasterui: capture keyboard interrupts the same way as knotty
In reply to Elliot Smithknotty captures two levels of keyboard interrupt: a single interrupt or two interrupts in a row. These then trigger stateShutdown and stateForceShutdown respectively.
toasterui doesn't have an equivalent way of capturing interrupts and using them to shut down bitbake. Now that we are no longer using knotty + XMLRPCServer for our command line builds (since switching to per-project build directories), we see some odd side effects of this, such as builds continuing after they have been interrupted on the command line.
Bring toasterui in line with knotty (copy-paste most of the code in knotty.py which deals with interrupts) so that a keyboard interrupt actually shuts down the bitbake server (if not in observe only mode).
Additionally use the cancel_cli_build() method to set the Build status to CANCELLED in Toaster's db when we get keyboard interrupts. This means that builds interrupted on the command line show as cancelled (same as if they'd been cancelled from the Toaster UI), as specified in the UI designs.
[YOCTO #8515]
--- bitbake/lib/bb/ui/toasterui.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/toasterui.py +16 -1
@@ -441,7 +441,22 @@ def main(server, eventHandler, params): if ioerror.args[0] == 4: pass except KeyboardInterrupt: - main.shutdown = 1 + if params.observe_only: + print("\nKeyboard Interrupt, exiting observer...") + main.shutdown = 2 + if not params.observe_only and main.shutdown == 1: + print("\nSecond Keyboard Interrupt, stopping...\n") + _, error = server.runCommand(["stateForceShutdown"]) + if error: + logger.error("Unable to cleanly stop: %s" % error) + if not params.observe_only and main.shutdown == 0: + print("\nKeyboard Interrupt, closing down...\n") + interrupted = True + _, error = server.runCommand(["stateShutdown"]) + if error: + logger.error("Unable to cleanly shutdown: %s" % error) + buildinfohelper.cancel_cli_build() + main.shutdown = main.shutdown + 1 except Exception as e: # print errors to log import traceback
Signature · 12 lines
1.9.3 --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH v3 3/3 toaster: don't show "Rebuild" button for cancelled cli builds
In reply to Elliot Smith[YOCTO #8515]
--- .../toaster/toastergui/templates/mrb_section.html | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-)
bitbake/lib/toaster/toastergui/templates/mrb_section.html +14 -11
@@ -125,8 +125,6 @@ pull-right" data-request-url="{% url 'xhr_buildrequest' build.project.pk %}" data-target='{{build.target_set.all|get_tasks|json}}'> - - Rebuild </button> {% endif %}
@@ -144,7 +142,7 @@ <div class="lead span3 progress-info"><span id="build-pc-done-{{build.pk}}">{{build.completeper}}</span>% of tasks complete</div> {# No build cancel for command line builds project #} {% if build.project.is_default %} - <i class="icon-question-sign get-help get-help-blue pull-right" title="" data-original-title="Builds in this project cannot be cancelled from Toaster: they can only be cancalled from the command line"></i> + <i class="icon-question-sign get-help get-help-blue pull-right" title="" data-original-title="Builds in this project cannot be cancelled from Toaster: they can only be cancelled from the command line"></i> {% else %} <div class="lead pull-right progress-info"> <button class="cancel-build-btn btn btn-info pull-right"
@@ -158,15 +156,20 @@ {%endif%} {# end if in progress #} {% if build.outcome == build.CANCELLED %} - <div class="span4"> - <p class="lead">Build cancelled</p> - </div> - <button class="btn btn-info pull-right run-again-btn" - data-request-url="{% url 'xhr_buildrequest' build.project.pk %}" - data-target='{{build.target_set.all|get_tasks|json}}'> - Rebuild + <div class="span4"> + <p class="lead">Build cancelled</p> + </div> - </button> + {% if build.project.is_default %} + <i class="icon-question-sign get-help get-help-blue pull-right" title="" + data-original-title="Builds in this project cannot be rebuilt from Toaster: they can only be rebuilt from the command line"></i> + {% else %} + <button class="btn btn-info pull-right run-again-btn" + data-request-url="{% url 'xhr_buildrequest' build.project.pk %}" + data-target='{{build.target_set.all|get_tasks|json}}'> + Rebuild + </button> + {% endif %} {% endif %} </div> </div>
Signature · 12 lines
1.9.3 --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 11 lines · On 06/05/2016 12:53, "[email protected] on behalf of Elliot…
If a bitbake build is running on the command line and is interrupted (e.g. by
Ctrl-c), capture the interrupt and shut down the bitbake server. Also set the outcome to CANCELLED so the build displays correctly in the Toaster UI.The following changes since commit
c8ea873d9883f8cdabb6ccadd31bd9967a0f0111:toaster: tweaks to recipe file downloads (2016-04-29 14:21:32 +0100)
Quoted 7 lines
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib
elliot/toaster/8515-interrupted_cli_buildshttp://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/85
15-interrupted_cli_builds
This works for me. Thanks!
Belén
Quoted 33 lines
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8515
Elliot Smith (3):
buildinfohelper: add method to set current build as CANCELLED
toasterui: capture keyboard interrupts the same way as knotty
toaster: don't show "Rebuild" button for cancelled cli buildsbitbake/lib/bb/ui/buildinfohelper.py | 10 +++++++++ bitbake/lib/bb/ui/toasterui.py | 17 ++++++++++++++- .../toaster/toastergui/templates/mrb_section.html | 25 ++++++++++++---------- 3 files changed, 40 insertions(+), 12 deletions(-)--
1.9.3---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Signature · 4 lines
_______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
Sent upstream and push to toaster-next
Thanks,
Michael
Quoted 59 lines · Belen
Quoted 11 lines · On 06/05/2016 12:53, "[email protected] on behalf of Elliot…
If a bitbake build is running on the command line and is interrupted (e.g. by
Ctrl-c), capture the interrupt and shut down the bitbake server. Also set the outcome to CANCELLED so the build displays correctly in the Toaster UI.The following changes since commit
c8ea873d9883f8cdabb6ccadd31bd9967a0f0111:toaster: tweaks to recipe file downloads (2016-04-29 14:21:32 +0100)
Quoted 7 lines
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib
elliot/toaster/8515-interrupted_cli_buildshttp://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/85
15-interrupted_cli_buildsThis works for me. Thanks!
Belén
Quoted 32 lines
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8515
Elliot Smith (3):
buildinfohelper: add method to set current build as CANCELLED
toasterui: capture keyboard interrupts the same way as knotty
toaster: don't show "Rebuild" button for cancelled cli buildsbitbake/lib/bb/ui/buildinfohelper.py | 10 +++++++++ bitbake/lib/bb/ui/toasterui.py | 17 ++++++++++++++- .../toaster/toastergui/templates/mrb_section.html | 25 ++++++++++++---------- 3 files changed, 40 insertions(+), 12 deletions(-)--
1.9.3---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Signature · 4 lines
_______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster