-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to show the cell outputs per second #116
Changes from 3 commits
b9ef0a5
61a9240
cd6d9a3
69303e7
cca94f0
6b5bb0a
771f5ac
cb935d0
009e7f9
d553ca0
3927b85
5d84534
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ export interface IExecuteTimeSettings { | |
showDate: boolean; | ||
historyCount: number; | ||
dateFormat: string; | ||
showOutputsPerSecond: boolean; | ||
} | ||
|
||
export default class ExecuteTimeWidget extends Widget { | ||
|
@@ -290,11 +291,13 @@ export default class ExecuteTimeWidget extends Widget { | |
if (isLikelyAborted) { | ||
msg = ''; | ||
} else if (endTime) { | ||
if ( | ||
this._settings.minTime <= | ||
differenceInMilliseconds(endTime, startTime) / 1000.0 | ||
) { | ||
const executionTimeMillis = differenceInMilliseconds( | ||
endTime, | ||
startTime | ||
); | ||
if (this._settings.minTime <= executionTimeMillis) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there is a bug here - minTime is in s and now this is compared in ms There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the conversion back in a new commit. Thanks! |
||
const executionTime = getTimeDiff(endTime, startTime); | ||
const executionsPerSecond = 1000.0 / executionTimeMillis; | ||
const lastExecutionTime = executionTimeNode.getAttribute( | ||
PREV_DATA_EXECUTION_TIME_ATTR | ||
); | ||
|
@@ -324,6 +327,13 @@ export default class ExecuteTimeWidget extends Widget { | |
msg += ` at ${getTimeString(endTime, this._settings.dateFormat)}`; | ||
} | ||
msg += ` in ${executionTime}`; | ||
|
||
const numberOfOutputs = cell.model.outputs.length; | ||
if (this._settings.showOutputsPerSecond && numberOfOutputs > 0) { | ||
const outputsPerSecond = executionsPerSecond / numberOfOutputs; | ||
msg += ` and generated ${numberOfOutputs} output(s)`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @krassowski I am not familiar with ui-tests. How can we get something like last-executed.png? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be auto-generated when running the test for the first time: https://github.com/deshaw/jupyterlab-execute-time/tree/master/ui-tests#run-the-tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But in general I would just push the code and download the artifacts from CI |
||
msg += ` (${outputsPerSecond.toFixed(2)} outputs/s)`; | ||
} | ||
} | ||
} else if (startTime) { | ||
if (this._settings.showLiveExecutionTime) { | ||
|
@@ -429,6 +439,9 @@ export default class ExecuteTimeWidget extends Widget { | |
); | ||
} | ||
|
||
this._settings.showOutputsPerSecond = settings.get('showOutputsPerSecond') | ||
.composite as boolean; | ||
|
||
const cells = this._panel.context.model.cells; | ||
if (this._settings.enabled) { | ||
cells.changed.connect(this.updateConnectedCell); | ||
|
@@ -513,5 +526,6 @@ export default class ExecuteTimeWidget extends Widget { | |
showDate: true, | ||
historyCount: 5, | ||
dateFormat: 'yyy-MM-dd HH:mm:ss', | ||
showOutputsPerSecond: false, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear from the name if this is in real time. How about: "After a cell has finished running, show the outputs per second calculated from the last cell execution time and number of outputs."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Updated the description with your copy.