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

feature/favor-state-node #5859

Merged
merged 6 commits into from
Nov 9, 2022
Merged

Conversation

josephberni
Copy link
Contributor

@josephberni josephberni commented Sep 16, 2022

resolves #5016

Description

Add --favor-state option which enables --defer to favor using --state node even if node exists in current target.

This optionally removes the below second --defer criterion when using the --favor-state flag.

This branch has been created and rebased against an older branch so that the owner of the branch has signed the CLA.

Checklist

@josephberni josephberni requested a review from a team September 16, 2022 13:25
@josephberni josephberni requested review from a team as code owners September 16, 2022 13:25
@cla-bot cla-bot bot added the cla:yes label Sep 16, 2022
@josephberni josephberni mentioned this pull request Sep 16, 2022
4 tasks
Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

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

Thanks for going through the trouble of a rebase / new branch @josephberni !

def _add_favor_state_argument(*subparsers):
for sub in subparsers:
sub.add_optional_argument_inverse(
"--favor-state",
Copy link
Contributor

Choose a reason for hiding this comment

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

@iknox-fa Do you have a sense of how we want to handle new flag additions, while we're migrating from old to new CLI? Since the new CLI is checked into main, we could ask folks to add it here — but we'll probably also need to check for parity again before formally cutting over in a few months

Copy link
Contributor

@iknox-fa iknox-fa Sep 27, 2022

Choose a reason for hiding this comment

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

Sorry I missed this the other day @jtcohen6. I don't have a strong feeling about this-- if we add this flag to the new CLI in this PR I'd be thrilled, but ultimately the "last stop" for this would be when we implement the Click version of the run task (#5551).

.changes/unreleased/Features-20220408-165459.yaml Outdated Show resolved Hide resolved
@jtcohen6 jtcohen6 added Team:Execution ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering labels Sep 16, 2022
@josephberni
Copy link
Contributor Author

Will squash all commits once all comments have been resolved :)

@jtcohen6 jtcohen6 added the cli label Sep 20, 2022
@gshank
Copy link
Contributor

gshank commented Sep 23, 2022

Why are you overriding '_get_deferred_manifest' and 'defer_to_manifest' in dbt.task.run? Those methods were in the compile task because the selectors apply to a lot of commands besides run.

@josephberni josephberni force-pushed the feature/favor-state-node branch from 7b95d99 to 5785a81 Compare September 30, 2022 09:26
@josephberni josephberni force-pushed the feature/favor-state-node branch from 5785a81 to a3726d5 Compare September 30, 2022 09:27
@josephberni
Copy link
Contributor Author

Why are you overriding '_get_deferred_manifest' and 'defer_to_manifest' in dbt.task.run? Those methods were in the compile task because the selectors apply to a lot of commands besides run.

I've removed these functions from the dbt.task.run file as they exist in the compile file. Thanks for the spot.

@josephberni
Copy link
Contributor Author

Do I need to do anything on this @jtcohen6, appreciate Coalesce likely has you all tied up but want to make sure you are not waiting on me?

Copy link
Contributor

@stu-k stu-k left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@stu-k
Copy link
Contributor

stu-k commented Nov 3, 2022

Closing and re-opening to trigger github actions which seem to have stalled.

@stu-k stu-k closed this Nov 3, 2022
@stu-k stu-k reopened this Nov 3, 2022
core/dbt/contracts/graph/manifest.py Outdated Show resolved Hide resolved
Co-authored-by: Stu Kilgore <stuart.kilgore@gmail.com>
Copy link
Contributor

@stu-k stu-k left a comment

Choose a reason for hiding this comment

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

Ah, I didn't catch these. Since introducing python models the compiled_sql attribute on nodes has been renamed to compiled_code!

josephberni and others added 3 commits November 7, 2022 15:28
Co-authored-by: Stu Kilgore <stuart.kilgore@gmail.com>
Co-authored-by: Stu Kilgore <stuart.kilgore@gmail.com>
Co-authored-by: Stu Kilgore <stuart.kilgore@gmail.com>
@josephberni
Copy link
Contributor Author

Thanks @stu-k ! Once the tests pass I will squash the commits

@stu-k
Copy link
Contributor

stu-k commented Nov 7, 2022

@josephberni no problem, thank you for taking this on!

assert len(results) == 2

# because the seed exists in other schema, we should defer it
assert self.other_schema not in results[0].node.compiled_code
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is the line causing the tests to fail 🤔

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 was creating the seed in the other_schema and checking it wasn't there, resolved this. If all OK will squash commits.

Copy link
Contributor

@stu-k stu-k left a comment

Choose a reason for hiding this comment

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

Great work! Thank you for putting this together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes cli ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-470] [Feature] Add option for --defer to favor using --state node even if node exists in current target
5 participants