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

Remove check for stages in plot wizard #4904

Merged
merged 5 commits into from
Oct 27, 2023

Conversation

julieg18
Copy link
Contributor

@julieg18 julieg18 commented Oct 25, 2023

  • updates the plot wizard to just create a missing dvc.yaml instead of having the user setup a stage first

Demo

Screen.Recording.2023-10-26.at.8.01.02.AM.mov

@julieg18 julieg18 added the product PR that affects product label Oct 25, 2023
@julieg18 julieg18 self-assigned this Oct 25, 2023
@@ -276,8 +277,9 @@ export const addPlotToDvcYamlFile = (cwd: string, plotObj: PlotConfigData) => {
if (!plots?.range) {
const plotYaml = getPlotsYaml(plotObj, dvcYamlLines)
dvcYamlLines.push(...plotYaml)
writeFileSync(dvcYamlFile, dvcYamlLines.join('\n'))
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This "no plots found" route is actually missing the openFileInEditor line. I've added it and updated the tests to check for this function being called.

return

void openFileInEditor(dvcYamlFile)
return writeFileSync(dvcYamlFile, dvcYamlLines.join('\n'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an empty line on top of the dvc.yaml in the case of there being an empty file:


plots:
  - step vs acc:
      template: confusion
      x: step
      y:
        training/plots/metrics/train/acc.json: acc

If we wanted to get rid of the top line, we could need to add an extra if check. I decided to just keep it to avoid extra complexity.

if (!cwd) {
return
}
const cwd = (await this.findPipelineCwd()) || this.dvcRoot
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now default to this.dvcRoot if a cwd isn't found.

@julieg18 julieg18 marked this pull request as ready for review October 26, 2023 13:09
}

const pipelines = this.model.getPipelines()
if (!pipelines?.size) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of scope, but since we have a lint rule to test zero length explicitly (something.length === 0 instead of !something.length). Should we have a similar rule for size as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me. I can look into a eslint rule for it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the lint rule we have (explicit-link-check) works for both arrays and size. This is allowed though since we have an undefined check there as well.

@codeclimate
Copy link

codeclimate bot commented Oct 27, 2023

Code Climate has analyzed commit ecbfd98 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 93.7% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.1% (0.0% change).

View more on Code Climate.

[...pipelines],
'Select a Pipeline to Run Command Against'
)
return this.findPipelineCwd()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to mention it here since it was discussed asynchronously with Matt, but it would simplify things to just have the Plot Wizard automatically create a dvc.yaml in the root vs looking for one elsewhere.

While this means that it wouldn't work for people with workspaces or nested dvc.yamls, users who do those are most likely advanced DVC users who don't have a need for the plot wizard.

I chose to keep it like it is for now but I'm happy to update if preferred.

@julieg18 julieg18 enabled auto-merge (squash) October 27, 2023 12:58
@julieg18 julieg18 merged commit 4a14be4 into main Oct 27, 2023
8 checks passed
@julieg18 julieg18 deleted the remove-stage-check-in-plot-wizard branch October 27, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants