Stephen Bailey
08/23/2022, 10:19 AMcontext.op_config
within an asset context -- the dictionary comes back as None, even when a default has been set. For example, taking this from the docs and adding a default value:
import json
from dagster import asset, Field
@asset(config_schema={"person_name": Field(str, default_value="stephen")})
def asset_using_config(context):
# Note how asset config is also accessed with context.op_config
<http://context.log.info|context.log.info>(f'hello {context.op_config["person_name"]}')
return True
returns an error when I click "materialize" in the UI, because the object is empty. (logs in thread). Am I missing something, or is this a bug?Stephen Bailey
08/23/2022, 10:19 AMdagster._core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "asset_using_config"::
TypeError: 'NoneType' object is not subscriptable
Stack Trace:
File "/Users/stkbailey/Documents/github/dagster-workflows-core/.venv/lib/python3.9/site-packages/dagster/_core/execution/plan/utils.py", line 47, in solid_execution_error_boundary
yield
File "/Users/stkbailey/Documents/github/dagster-workflows-core/.venv/lib/python3.9/site-packages/dagster/_utils/__init__.py", line 431, in iterate_with_context
next_output = next(iterator)
File "/Users/stkbailey/Documents/github/dagster-workflows-core/.venv/lib/python3.9/site-packages/dagster/_core/execution/plan/compute_generator.py", line 73, in _coerce_solid_compute_fn_to_iterator
result = fn(context, **kwargs) if context_arg_provided else fn(**kwargs)
File "dev.py", line 9, in asset_using_config
<http://context.log.info|context.log.info>(f'hello {context.op_config["person_name"]}')
Sanidhya Singh
08/23/2022, 11:13 AMsandy
08/23/2022, 2:44 PMsean
08/25/2022, 5:56 PM