Using the example snippet off of the Dagster docs ...
# ask-community
t
Using the example snippet off of the Dagster docs for AWS SecretsManager and am getting the following error..
Copy code
dagster._core.errors.DagsterInvalidDefinitionError: "context" is not a valid name in Dagster. It conflicts with a Dagster or python reserved keyword.
The code snippet is as follow..
Copy code
@op(required_resource_keys={'secrets'})
def secretsmanager_secrets_tableau_user(context):
    return context.resources.secrets.get("username")
Is there something I need to change to get past that error? Documentation is a little sparse..
d
Hi Timothy - do you have a full stack trace for the error?
That op looks fine to me so i'm wondering if something else is going on
t
Copy code
dagster._core.errors.DagsterInvalidDefinitionError: "context" is not a valid name in Dagster. It conflicts with a Dagster or python reserved keyword.
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_grpc/server.py", line 266, in __init__
    self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_grpc/server.py", line 115, in __init__
    loadable_targets = get_loadable_targets(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_grpc/utils.py", line 57, in get_loadable_targets
    else loadable_targets_from_python_package(package_name, working_directory)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/workspace/autodiscovery.py", line 49, in loadable_targets_from_python_package
    module = load_python_module(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/code_pointer.py", line 135, in load_python_module
    return importlib.import_module(module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/dagster/FTS_Data_Science/dagster-jobs/dagster_jobs/__init__.py", line 3, in <module>
    from .dynamic_graph import dynamic_graph
  File "/opt/dagster/FTS_Data_Science/dagster-jobs/dagster_jobs/dynamic_graph.py", line 74, in <module>
    def extract_tableau(orgs, context):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line 249, in op
    return _Op()(compute_fn)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line 120, in __call__
    op_def = OpDefinition(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/op_definition.py", line 135, in __init__
    resolved_input_defs: Sequence[InputDefinition] = resolve_checked_solid_fn_inputs(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line 437, in resolve_checked_solid_fn_inputs
    inferred_input_defs = [
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line 438, in <listcomp>
    InputDefinition.create_from_inferred(inferred)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/input.py", line 283, in create_from_inferred
    return InputDefinition(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/input.py", line 122, in __init__
    self._name = check_valid_name(name, allow_list=["config"])
  File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/definitions/utils.py", line 59, in check_valid_name
    raise DagsterInvalidDefinitionError(
d
that looks like its coming from elsewhere:
Copy code
def extract_tableau(orgs, context):
t
That might point me in the direction I need. They were porting their jobs from Airflow over to Dagster so that might need to be cleaned up a bit..