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

dbt retry command #3556

Merged
merged 9 commits into from
Jun 26, 2023
Merged

dbt retry command #3556

merged 9 commits into from
Jun 26, 2023

Conversation

matthewshaver
Copy link
Contributor

@matthewshaver matthewshaver commented Jun 16, 2023

resolves #3422

What are you changing in this pull request and why?

Documenting the dbt retry command new in v1.6

Checklist

Uncomment if you're publishing docs for a prerelease version of dbt (delete if not applicable):

  • Add versioning components, as described in Versioning Docs

  • Add a note to the prerelease version Migration Guide

  • Review the Content style guide and About versioning so my content adheres to these guidelines.

  • Add a checklist item for anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch."

Adding new pages (delete if not applicable):

  • Add page to website/sidebars.js
  • Provide a unique filename for the new page

@matthewshaver matthewshaver requested a review from a team as a code owner June 16, 2023 18:30
@netlify
Copy link

netlify bot commented Jun 16, 2023

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit 414bbe2
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/6499fb338969ae00082cb64b
😎 Deploy Preview https://deploy-preview-3556--docs-getdbt-com.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.

@matthewshaver matthewshaver mentioned this pull request Jun 16, 2023
6 tasks
@github-actions github-actions bot added content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address labels Jun 16, 2023
Copy link
Collaborator

@runleonarun runleonarun left a comment

Choose a reason for hiding this comment

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

Hey @matthewshaver just a few questions/suggestions!

id: "retry"
---

`dbt retry` re-executes the last `dbt` command from the node point of failure. If the previously executed `dbt` command was successful, `retry` will finish as a no op.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is a "no op?" If it stands for something we might want to write it out. Or ink to docs about 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.

I spelled it out since it wasn't apparent to me, either.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, no-op is no-operation (i.e., do nothing).

https://en.wikipedia.org/wiki/NOP_(code)

- [`run`](/reference/commands/run)
- [`run-operation`](/reference/commands/run-operation)

`dbt retry` will execute from the node failures recorded in the run_results.json. Executing `dbt retry` without correcting the previous failures will garner idempotent results.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be a good place to add a glossary entry for idempotent. https://docs.getdbt.com/terms/idempotent which I think would be:
<Term id="idempotent" />

Copy link
Collaborator

Choose a reason for hiding this comment

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

dbt retry will execute from the node failures recorded in the run_results.json

What is the advice here? Are we asking people to make sure they check run_resuts.json and fix any failures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're not expected to do anything with the file itself, we just wanted to give a behind the curtains look at how the feature works. It references that json to determine where to start the retry. Does adding the parenthesis help?

Copy link
Member

Choose a reason for hiding this comment

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

@runleonarun Users should not edit run_results.json themselves, but its output is used by retry.

@aranke aranke self-requested a review June 21, 2023 16:23
Copy link
Collaborator

@runleonarun runleonarun left a comment

Choose a reason for hiding this comment

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

@matthewshaver This is definitely more helpful! I have a couple non-blocking questions that came up when I was reading this page. Please don't let these hold you up if you need to ship, but they might be helpful to customers.

id: "retry"
---

`dbt retry` re-executes the last `dbt` command from the node point of failure. If the previously executed `dbt` command was successful, `retry` will finish as `no operation`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean if you run a dbt retry when the previous dbt command succeeded, then nothing happens?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, correct.
It'll show a message like “no nodes selected”.

- [`run`](/reference/commands/run)
- [`run-operation`](/reference/commands/run-operation)

`dbt retry` references **run_results.json** to determine where to start. Executing `dbt retry` without correcting the previous failures will garner <Term id="idempotent" /> results.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is much clearer, thank you!


`dbt retry` references **run_results.json** to determine where to start. Executing `dbt retry` without correcting the previous failures will garner <Term id="idempotent" /> results.

`dbt retry` reuses the selectors from the previously executed command.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we link to the Methods page or YAML selectors page to provide more info in case they need it?

Copy link
Member

@aranke aranke left a comment

Choose a reason for hiding this comment

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

Can we add an example to the docs? Something like:

$ dbt build
...
ERROR node_a

$ dbt retry
ERROR node_a

# Fix node_a

$ dbt retry
PASS node_a

$ dbt retry
Nothing to do.

id: "retry"
---

`dbt retry` re-executes the last `dbt` command from the node point of failure. If the previously executed `dbt` command was successful, `retry` will finish as `no operation`.
Copy link
Member

Choose a reason for hiding this comment

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

Yes, correct.
It'll show a message like “no nodes selected”.

- [`run`](/reference/commands/run)
- [`run-operation`](/reference/commands/run-operation)

`dbt retry` references **run_results.json** to determine where to start. Executing `dbt retry` without correcting the previous failures will garner <Term id="idempotent" /> results.
Copy link
Member

Choose a reason for hiding this comment

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

Probably worth mentioning here that it looks in the target/ directory by default, but a different directory can be passed in with the --state flag.

@matthewshaver matthewshaver requested a review from aranke June 26, 2023 19:57
Copy link
Collaborator

@runleonarun runleonarun left a comment

Choose a reason for hiding this comment

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

This looks great! Let's follow up later with a more detailed example from @aranke as suggested here.

@matthewshaver matthewshaver merged commit 574cd3d into current Jun 26, 2023
@matthewshaver matthewshaver deleted the dbt-retry branch June 26, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New command: dbt retry
3 participants