-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: allow passing config for dagster asset materialize cli #26069
base: master
Are you sure you want to change the base?
Conversation
with instance_for_test() as instance: | ||
runner = CliRunner() | ||
|
||
result = runner.invoke(asset_materialize_command, ["--select", "asset_with_config", "--cli-config-json", "{\"some_prop\": \"foo\"}"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command line argument in the test should be --config-json
to match the option defined in asset.py
. The test is currently using --cli-config-json
, which will cause the test to fail.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jimmyshah !! Overall looks good, two small comments, otherwise this is basically good to go
@@ -3,9 +3,11 @@ | |||
import click | |||
|
|||
import dagster._check as check | |||
from dagster._cli.job import get_config_from_args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one should be moved into dagster._cli.workspace.cli_target
, I believe
#assert "some_prop:foo" in result.output | ||
#assert instance.get_latest_materialization_event(AssetKey("asset_with_config")) is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the thing that's important to test here is that the config actually made its way into the asset (this can be accomplished by asserting the config value within the body of asset_with_config
:
@asset
def asset_with_config(context: AssetExecutionContext, config: MyConfig):
assert config.some_prop == "foo"
context.log.info(f"some_prop:{config.some_prop}"
Summary & Motivation
I was browsing the repo for good first issues as a new contributor, and found #16802 interesting. It looks like @sam-goodwin's PR #20979 is nearly complete, except for a change needed for one of the imports. I used that PR's solution, but also resolved the import issue.
How I Tested These Changes
I am currently running
python -m pytest python_modules/dagster/dagster_tests
to run the tests locally, though it is taking some time to complete. The tests appear to be passing so far!