Skip to content

Commit

Permalink
Merge pull request #2966 from kbase/fix-appcell-jm-loading
Browse files Browse the repository at this point in the history
Fix appCellWidget not processing status calls
  • Loading branch information
briehl authored May 11, 2022
2 parents 45e0b2f + 68e10bb commit c57f696
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 10 deletions.
18 changes: 9 additions & 9 deletions nbextensions/appCell2/widgets/appCellWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -1734,15 +1734,6 @@ define(
// this will not change, so we can just render it here.
PR.prettyPrint(null, container);

const currentFsmState = fsm.getCurrentState().state;

// if we start out in 'new' state, we need to promote it to
// one of the 'editing' states
if (currentFsmState.mode === 'new') {
evaluateAppState();
return;
}

jobManager.addEventHandler('modelUpdate', {
execMessage: () => {
// Update the execMessage panel with details of the active job
Expand Down Expand Up @@ -1776,6 +1767,15 @@ define(
},
});

const currentFsmState = fsm.getCurrentState().state;

// if we start out in 'new' state, we need to promote it to
// one of the 'editing' states
if (currentFsmState.mode === 'new') {
evaluateAppState();
return;
}

/*
* Check the job state and init the job manager if appropriate
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,55 @@ define([
);
});

it('responds to job launch', function () {
it('responds to job launch and proceeding job status updates', function () {
const runStatusArgs = {
event: 'launched_job',
cell_id: this.cell_id,
job_id: TEST_JOB,
};
expect(this.kbaseNode.querySelector(selectors.execMessage).textContent).toEqual(
stateMessages.EXECUTE_REQUESTED
);
return new Promise((resolve) => {
spyOn(Narrative, 'saveNotebook').and.callFake(() => {
resolve();
});
spyOn(this.bus, 'emit');
TestUtil.send_RUN_STATUS({
bus: this.bus,
runStatusArgs,
});
})
.then(() => {
// FSM state to { mode: 'processing', stage: 'launched' }
expect(
this.appCellWidgetInstance.__fsm().getCurrentState().state
).toEqual(fsmState.PROCESSING_LAUNCHED);
return TestUtil.waitForElementChange(
this.kbaseNode.querySelector(selectors.execMessage),
() => {
TestUtil.send_STATUS({
bus: this.bus,
jobState: {
job_id: TEST_JOB,
queued: 1234567,
status: 'queued',
updated: 1234567,
created: 1234566,
},
});
}
);
})
.then(() => {
// FSM state to { mode: 'processing', stage: 'queued' }
expect(
this.appCellWidgetInstance.__fsm().getCurrentState().state
).toEqual(fsmState.PROCESSING_QUEUED);
});
});

it('responds to job launch ', function () {
const runStatusArgs = {
event: 'launched_job',
cell_id: this.cell_id,
Expand Down

0 comments on commit c57f696

Please sign in to comment.