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

add run-operation + snapshot to the RPC server (#1875) #1878

Merged
merged 3 commits into from
Nov 1, 2019

Conversation

beckjake
Copy link
Contributor

@beckjake beckjake commented Oct 30, 2019

Fixes #1875

snapshot + run-operation support.

run-operation:
In addition to the defaults of 'task_tags' and 'timeout' there are 2 parameters:
- macro: str (required)
- args: Dict[str, Any] (optional)

As in the CLI version, run operations return a success boolean that indicates whether the macro raised an exception or not. They will only return an error object if the request itself is somehow wrong. The result returned by the macro is discarded.

snapshot:
This has the same arguments as compile and run. It executes the dbt snapshot task.

Both methods work via cli_args.

@cla-bot cla-bot bot added the cla:yes label Oct 30, 2019
@beckjake
Copy link
Contributor Author

One thing to think about here: Should the method name be run_operation, instead, for parity with the fact that all arguments in the RPC server use underscores?

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

One comment here about the argument to snapshot, but otherwise this looks and works super well!

Should the method name be run_operation

I think there's merit to each approach -- I don't feel super strongly either way! Parity with the CLI seems like a stronger argument than parity with other RPC tasks IMO

METHOD_NAME = 'snapshot'

def set_args(self, params: RPCCompileParameters) -> None:
self.args.models = self._listify(params.models)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the input to snapshot on the CLI is -s --select, not --models - can we update this accordingly?

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

This LGTM! Ship it

@beckjake beckjake merged commit f985902 into dev/louisa-may-alcott Nov 1, 2019
@beckjake beckjake deleted the feature/run-operation-snapshot-rpc branch November 1, 2019 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support run-operation and snapshot methods in rpc server
2 participants