-
Notifications
You must be signed in to change notification settings - Fork 48
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b9ef0a5
Show the executions per second calculated from the last execution time.
flaviomartins 61a9240
Improve description using a more precise wording.
flaviomartins cd6d9a3
Now shows the number of cell outputs per second.
flaviomartins 69303e7
Shorten the message displaying outputs/s
flaviomartins cca94f0
Further improve outputs per second message
flaviomartins 6b5bb0a
small fix to outputPerSecond option description
flaviomartins 771f5ac
add timing_outputs_outcomes.spec.ts for ui-tests
flaviomartins cb935d0
Do not test execution started again, remove unused import and cells
krassowski 009e7f9
Add changelog entry
krassowski d553ca0
Adjust cell index after removing unused cells
krassowski 3927b85
fix comparison of millis with seconds
flaviomartins 5d84534
clarify in the description that showOutputsPerSecond option displays the
flaviomartins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ export interface IExecuteTimeSettings { | |
showDate: boolean; | ||
historyCount: number; | ||
dateFormat: string; | ||
showExecutionsPerSecond: 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,9 @@ export default class ExecuteTimeWidget extends Widget { | |
msg += ` at ${getTimeString(endTime, this._settings.dateFormat)}`; | ||
} | ||
msg += ` in ${executionTime}`; | ||
if (this._settings.showExecutionsPerSecond) { | ||
msg += ` (${executionsPerSecond.toFixed(2)} executions/s)`; | ||
} | ||
} | ||
} else if (startTime) { | ||
if (this._settings.showLiveExecutionTime) { | ||
|
@@ -429,6 +435,10 @@ export default class ExecuteTimeWidget extends Widget { | |
); | ||
} | ||
|
||
this._settings.showExecutionsPerSecond = settings.get( | ||
'showExecutionsPerSecond' | ||
).composite as boolean; | ||
|
||
const cells = this._panel.context.model.cells; | ||
if (this._settings.enabled) { | ||
cells.changed.connect(this.updateConnectedCell); | ||
|
@@ -513,5 +523,6 @@ export default class ExecuteTimeWidget extends Widget { | |
showDate: true, | ||
historyCount: 5, | ||
dateFormat: 'yyy-MM-dd HH:mm:ss', | ||
showExecutionsPerSecond: false, | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think this should be explicit that number of executions is always one.
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.
I have changed this to explicitly say Cell Executions Per Second, but I understand it might not resolve the issue completely.
I'm in favour of outputs/time or updates/time (keeping it language-agnostic).
@krassowski can it be done?
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.
@krassowski do tou know if there is a listener/hook exposed to jupyterlab extensions I can use? (for each write to stdout/output)
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.
There is a
outputLengthChanged
signal in output area which you should be able to access viacell.outputArea.outputLengthChanged
.