Skip to content
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

Prevent queued experiment from being selected as most recent #3846

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion extension/src/experiments/model/status/collect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,16 @@ describe('collectFinishedRunningExperiments', () => {
expect(finishedRunning).toStrictEqual({})
})

it('should return the most recently created and unseen (without a status) experiment if there is no longer an experiment running in the workspace', () => {
it('should return the most recently created and unseen and unqueued (without a status) experiment if there is no longer an experiment running in the workspace', () => {
const latestCreatedId = 'exp-123'
const finishedRunning = collectFinishedRunningExperiments(
{},
[
{
Created: '2023-12-01T10:48:24',
id: 'exp-queued',
status: ExperimentStatus.QUEUED
},
{ Created: '2022-12-02T10:48:24', id: 'exp-456' },
{ Created: '2022-10-02T07:48:24', id: 'exp-789' },
{ Created: '2022-12-02T07:48:25', id: latestCreatedId },
Expand Down
4 changes: 3 additions & 1 deletion extension/src/experiments/model/status/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ const getMostRecentExperiment = (
coloredStatus: ColoredStatus
): Experiment | undefined =>
experiments
.filter(({ id }) => coloredStatus[id] === undefined)
.filter(
({ id, status }) => coloredStatus[id] === undefined && !isQueued(status)
)
.sort(({ Created: aCreated }, { Created: bCreated }) => {
if (!aCreated) {
return 1
Expand Down