https://dagster.io/ logo
#ask-community
Title
# ask-community
n

Nicolas Huray

03/07/2023, 7:17 PM
My issue is related to the
context
I’m passing in those
@graph_asset
. It looks it’s something we can’t do but it works with
@asset
. Here is the error I got:
Copy code
dagster._core.errors.DagsterInvalidDefinitionError: "context" is not a valid name in Dagster. It conflicts with a Dagster or python reserved keyword.
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_grpc/server.py", line 267, in __init__
    self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_grpc/server.py", line 116, in __init__
    loadable_targets = get_loadable_targets(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_grpc/utils.py", line 47, in get_loadable_targets
    else loadable_targets_from_python_module(module_name, working_directory)
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line 36, in loadable_targets_from_python_module
    module = load_python_module(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 138, in load_python_module
    return importlib.import_module(module_name)
  File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/nicolas/Workspace/data-engineering/packages/cdi-pipelines/src/cdi/__init__.py", line 4, in <module>
    from .jobs import jobs, assets
  File "/Users/nicolas/Workspace/data-engineering/packages/cdi-pipelines/src/cdi/jobs/__init__.py", line 1, in <module>
    from .bnc import jobs as bnc_jobs, assets as bnc_assets
  File "/Users/nicolas/Workspace/data-engineering/packages/cdi-pipelines/src/cdi/jobs/bnc/__init__.py", line 5, in <module>
    bnc_cases = load_assets_from_package_module(package_module=assets, group_name="bnc_cases")
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/load_assets_from_modules.py", line 237, in load_assets_from_package_module
    ) = assets_from_package_module(package_module)
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/load_assets_from_modules.py", line 197, in assets_from_package_module
    return assets_from_modules(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/load_assets_from_modules.py", line 58, in assets_from_modules
    for module in modules:
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/load_assets_from_modules.py", line 288, in _find_modules_in_package
    submodule = import_module(f"{package_module.__name__}.{modname}")
  File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/nicolas/Workspace/data-engineering/packages/cdi-pipelines/src/cdi/jobs/bnc/assets/cases.py", line 52, in <module>
    def bnc_valid_cases(context, bnc_cases):
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/asset_decorator.py", line 690, in graph_asset
    return _GraphBackedAsset()(compose_fn)
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/asset_decorator.py", line 742, in __call__
    op_graph = graph(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/graph_decorator.py", line 79, in __call__
    ) = do_composition(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/composition.py", line 1069, in do_composition
    actual_input_defs = resolve_checked_solid_fn_inputs(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line 439, in resolve_checked_solid_fn_inputs
    inferred_input_defs = [
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line 440, in <listcomp>
    InputDefinition.create_from_inferred(inferred)
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/input.py", line 284, in create_from_inferred
    return InputDefinition(
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/input.py", line 123, in __init__
    self._name = check_valid_name(name, allow_list=["config"])
  File "/Users/nicolas/Workspace/data-engineering/.venv/lib/python3.10/site-packages/dagster/_core/definitions/utils.py", line 60, in check_valid_name
    raise DagsterInvalidDefinitionError(
43 Views