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

feat: continue trial from WebUI for multi-trial experiment #9589

Merged
merged 8 commits into from
Jul 9, 2024

Conversation

gt2345
Copy link
Contributor

@gt2345 gt2345 commented Jun 27, 2024

Ticket

MD-437

Description

Allow user to continue multi-trial experiments if applicable.
Multi-trial experiments that are able to continue must satisfy the following criteria:

  • The searcher type is random or grid
  • The state is cancelled or errored

Test Plan

Navigate the the experiment details page of a multi trial experiment, if the experiment is not able to continue, then the Continue Experiment button should not be available.
Find a multi-trial experiment with Continue Experiment button, clicking on the button will continue the experiment.

0627.mp4

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

@gt2345 gt2345 requested a review from a team as a code owner June 27, 2024 20:47
@gt2345 gt2345 requested a review from hkang1 June 27, 2024 20:47
@cla-bot cla-bot bot added the cla-signed label Jun 27, 2024
Copy link

netlify bot commented Jun 27, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit 2082ce5
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/668d8835afda170009a2c9e8
😎 Deploy Preview https://deploy-preview-9589--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 58.69565% with 19 lines in your changes missing coverage. Please review.

Project coverage is 45.21%. Comparing base (c40b861) to head (2082ce5).
Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9589      +/-   ##
==========================================
- Coverage   49.82%   45.21%   -4.61%     
==========================================
  Files        1247      923     -324     
  Lines      162287   121992   -40295     
  Branches     2888     2893       +5     
==========================================
- Hits        80855    55160   -25695     
+ Misses      81260    66660   -14600     
  Partials      172      172              
Flag Coverage Δ
harness ?
web 46.16% <58.69%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
webui/react/src/types.ts 99.68% <100.00%> (+<0.01%) ⬆️
webui/react/src/utils/experiment.ts 83.88% <92.30%> (+0.08%) ⬆️
...ages/ExperimentDetails/ExperimentDetailsHeader.tsx 73.62% <35.71%> (-1.35%) ⬇️

... and 324 files with indirect coverage changes

@gt2345 gt2345 requested a review from keita-determined June 27, 2024 20:48
Copy link
Contributor

@keita-determined keita-determined left a comment

Choose a reason for hiding this comment

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

i think its working correctly, but let me try to understand it more.
looks like this experiment (before this change) doesnt show continue button even though its a multi experiment with ASHA and cancelled.
do you have an example how it works right now?

experiment?.numTrials === 1 ||
(experiment.state !== RunState.Completed &&
experiment.numTrials > 1 &&
['random', 'grid'].includes(experiment.config?.searcher.name || ''))) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe ['random', 'grid'] can be moved out to the component with a good variable name, then export it for both components?
and this can be set instead of array
i'll defer the decision to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, added a new variable named ContinuableNonSingleSearcherName

});
const newPath = paths.experimentDetails(experiment.id);
routeToReactUrl(paths.reload(newPath));
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

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

no catch clause?

Copy link
Contributor

Choose a reason for hiding this comment

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

probably worth notifying the user if the API fails to continue the experiment

@@ -263,6 +265,19 @@ const ExperimentDetailsHeader: React.FC<Props> = ({
setIsRunningDelete(experiment.state === RunState.Deleting);
}, [experiment.state]);

const onClickContinueMultiTrialExp = useCallback(async () => {
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

its not formatted? indentation doesnt look aligned

(!!trial || experiment?.numTrials === 1) &&
(!!trial ||
experiment?.numTrials === 1 ||
(experiment.state !== RunState.Completed &&
Copy link
Contributor

Choose a reason for hiding this comment

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

experiment.state !== RunState.Completed is it needed?
we have terminalRunStates.has(experiment.state)

Copy link
Contributor

Choose a reason for hiding this comment

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

to add to this part, terminalRunStates include:

RunState.Canceled,
RunState.Completed,
RunState.Error,
RunState.DeleteFailed,
RunState.Deleted,

It seems like if it's Completed or Deleted it probably can not continue the trials. Might be worth defining a new curated list called continuableRunStates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Continue on multi trial experiment is only available for Error and Cancel state, so I ended up using the existing erroredRunStates

Copy link
Contributor

@hkang1 hkang1 left a comment

Choose a reason for hiding this comment

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

Most of it looks great, just a few of questions and suggestions

(!!trial || experiment?.numTrials === 1) &&
(!!trial ||
experiment?.numTrials === 1 ||
(experiment.state !== RunState.Completed &&
Copy link
Contributor

Choose a reason for hiding this comment

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

to add to this part, terminalRunStates include:

RunState.Canceled,
RunState.Completed,
RunState.Error,
RunState.DeleteFailed,
RunState.Deleted,

It seems like if it's Completed or Deleted it probably can not continue the trials. Might be worth defining a new curated list called continuableRunStates?

key: 'continue-trial',
label: experiment.unmanaged ? (
<Tooltip content={UNMANAGED_MESSAGE}>Continue Trial</Tooltip>
) : (
'Continue Trial'
),
onClick: ContinueTrialModal.open,
onClick: ['random', 'grid'].includes(experiment?.config.searcher.name) ? onClickContinueMultiTrialExp : ContinueTrialModal.open,
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: looks like ['random', 'grid'].includes(experiment?.config.searcher.name) is done more than once, could have a memoized variable isSearcherContinuable or something that does this operation. Or even a more general one that also checks the RunState called isContinuable

});
const newPath = paths.experimentDetails(experiment.id);
routeToReactUrl(paths.reload(newPath));
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

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

probably worth notifying the user if the API fails to continue the experiment

@gt2345
Copy link
Contributor Author

gt2345 commented Jun 28, 2024

i think its working correctly, but let me try to understand it more. looks like this experiment (before this change) doesnt show continue button even though its a multi experiment with ASHA and cancelled. do you have an example how it works right now?

Hi @keita-determined not sure I completely understand your concerns, but multi experiments are only able to continue if the searcher is grid or random, so for ASHA experiments this feature won't be available

@gt2345 gt2345 requested a review from keita-determined June 28, 2024 20:55
Copy link
Contributor

@keita-determined keita-determined left a comment

Choose a reason for hiding this comment

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

\o/

@gt2345 gt2345 merged commit 58fbf68 into main Jul 9, 2024
84 of 97 checks passed
@gt2345 gt2345 deleted the gt/437-continue-trial branch July 9, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants