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

feat: allow passing config for dagster asset materialize cli #26069

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jimmyshah
Copy link

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!

@jimmyshah jimmyshah changed the title feat allow passing config for dagster asset materialize cli feat: allow passing config for dagster asset materialize cli Nov 21, 2024
with instance_for_test() as instance:
runner = CliRunner()

result = runner.invoke(asset_materialize_command, ["--select", "asset_with_config", "--cli-config-json", "{\"some_prop\": \"foo\"}"])
Copy link

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.

Copy link
Contributor

@OwenKephart OwenKephart left a 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
Copy link
Contributor

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

Comment on lines +190 to +191
#assert "some_prop:foo" in result.output
#assert instance.get_latest_materialization_event(AssetKey("asset_with_config")) is not None
Copy link
Contributor

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}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants