Skip to content

Conversation

gnestor
Copy link
Contributor

@gnestor gnestor commented Mar 30, 2017

Patches #2061

Closes #2352

Copy link
Member

@rgbkrk rgbkrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does this fire? What happens when a new kernel is launched?

stop_on_error : stop_on_error});
CodeCell.msg_cells[this.last_msg_id] = this;
this.render();
this.events.trigger('execute.CodeCell', {cell: this});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgbkrk When a CodeCell is executed, 'execute.CodeCell' is triggered, but apparently no event is triggered when execution completes.

var that = this;
this.events.on('finished_iopub.Kernel', function (evt, data) {
this.events.one('finished_iopub.Kernel', function (evt, data) {
if (that.kernel.id === data.kernel.id && that.last_msg_id === data.msg_id) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 'finished_iopub.Kernel' is triggered and its data matches that of the CodeCell, then we know that execution is complete.

this.events.trigger('execute.CodeCell', {cell: this});
var that = this;
this.events.on('finished_iopub.Kernel', function (evt, data) {
this.events.one('finished_iopub.Kernel', function (evt, data) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I just realized that if another cell's execution completes in between this cell's execution starting and completing, then this event listener will be disposed before it can handle execution completion...

@gnestor gnestor added this to the 5.0 milestone Mar 31, 2017
@rgbkrk rgbkrk merged commit 5db6db7 into jupyter:master Mar 31, 2017
@rgbkrk rgbkrk deleted the issue-2352 branch March 31, 2017 18:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

finished_execute.CodeCell event triggered multiple times
2 participants