You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently updated Dagster to version 1.5 and found an following error while importing Meltano resource
2023-10-24 18:26:38 +0700 - dagster.code_server - ERROR - Error while importing code
Traceback (mostrecentcalllast):
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_grpc/server.py", line295, in__init__self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_grpc/server.py", line139, in__init__loadable_targets = get_loadable_targets(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_grpc/utils.py", line50, inget_loadable_targetselse loadable_targets_from_python_module(module_name, working_directory)
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line35, inloadable_targets_from_python_modulemodule = load_python_module(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line135, inload_python_modulereturnimportlib.import_module(module_name)
File"/usr/lib/python3.10/importlib/__init__.py", line126, inimport_modulereturn_bootstrap._gcd_import(name[level:], package, level)
File"<frozen importlib._bootstrap>", line1050, in_gcd_importFile"<frozen importlib._bootstrap>", line1027, in_find_and_loadFile"<frozen importlib._bootstrap>", line1006, in_find_and_load_unlockedFile"<frozen importlib._bootstrap>", line688, in_load_unlockedFile"<frozen importlib._bootstrap_external>", line883, inexec_moduleFile"<frozen importlib._bootstrap>", line241, in_call_with_frames_removedFile"/home/projects/my-projects/dagster-project/dagster_project/__init__.py", line3, in <module>
from.assets import dbt, dbt_assets, meltano_assets
File"/home/projects/my-projects/dagster-project/dagster_project/assets.py", line10, in <module>
fromdagster_meltanoimportmeltano_resourceFile"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/__init__.py", line3, in <module>
fromdagster_meltano.generation import (
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/generation.py", line8, in <module>
fromdagster_meltano.meltano_resource import MeltanoResource
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/meltano_resource.py", line12, in <module>
fromdagster_meltano.job import Job
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/job.py", line18, in <module>
fromdagster_meltano.ops import meltano_run_op as meltano_run_op_factory
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/ops.py", line131, in <module>
def meltano_install_op(context: OpExecutionContext):
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line125, in__call__op_def = OpDefinition.dagster_internal_init(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/op_definition.py", line205, indagster_internal_initreturnOpDefinition(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/decorator_utils.py", line195, inwrapped_with_pre_call_fnreturn fn(*args, **kwargs)
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/op_definition.py", line151, in__init___validate_context_type_hint(self._compute_fn.decorated_fn)
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/op_definition.py", line576, in_validate_context_type_hintraiseDagsterInvalidDefinitionError(
dagster._core.errors.DagsterInvalidDefinitionError: Cannot annotate `context` parameter with type OpExecutionContext. `context` must be annotated with AssetExecutionContext, OpExecutionContext, or left blank.
/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/workspace/context.py:616: UserWarning: Error loading repository location dagster_project:dagster._core.errors.DagsterInvalidDefinitionError: Cannot annotate `context` parameter with type OpExecutionContext. `context` must be annotated with AssetExecutionContext, OpExecutionContext, or left blank.
StackTrace:
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_grpc/server.py", line295, in__init__self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_grpc/server.py", line139, in__init__loadable_targets = get_loadable_targets(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_grpc/utils.py", line50, inget_loadable_targetselse loadable_targets_from_python_module(module_name, working_directory)
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line35, inloadable_targets_from_python_modulemodule = load_python_module(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line135, inload_python_modulereturnimportlib.import_module(module_name)
File"/usr/lib/python3.10/importlib/__init__.py", line126, inimport_modulereturn_bootstrap._gcd_import(name[level:], package, level)
File"<frozen importlib._bootstrap>", line1050, in_gcd_importFile"<frozen importlib._bootstrap>", line1027, in_find_and_loadFile"<frozen importlib._bootstrap>", line1006, in_find_and_load_unlockedFile"<frozen importlib._bootstrap>", line688, in_load_unlockedFile"<frozen importlib._bootstrap_external>", line883, inexec_moduleFile"<frozen importlib._bootstrap>", line241, in_call_with_frames_removedFile"/home/projects/my-projects/dagster-project/dagster_project/__init__.py", line3, in <module>
from.assets import dbt, dbt_assets, meltano_assets
File"/home/projects/my-projects/dagster-project/dagster_project/assets.py", line10, in <module>
fromdagster_meltanoimportmeltano_resourceFile"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/__init__.py", line3, in <module>
fromdagster_meltano.generation import (
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/generation.py", line8, in <module>
fromdagster_meltano.meltano_resource import MeltanoResource
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/meltano_resource.py", line12, in <module>
fromdagster_meltano.job import Job
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/job.py", line18, in <module>
fromdagster_meltano.ops import meltano_run_op as meltano_run_op_factory
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster_meltano/ops.py", line131, in <module>
def meltano_install_op(context: OpExecutionContext):
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/decorators/op_decorator.py", line125, in__call__op_def = OpDefinition.dagster_internal_init(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/op_definition.py", line205, indagster_internal_initreturnOpDefinition(
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/decorator_utils.py", line195, inwrapped_with_pre_call_fnreturn fn(*args, **kwargs)
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/op_definition.py", line151, in__init___validate_context_type_hint(self._compute_fn.decorated_fn)
File"/home/projects/my-projects/.venv/lib/python3.10/site-packages/dagster/_core/definitions/op_definition.py", line576, in_validate_context_type_hintraiseDagsterInvalidDefinitionError(
warnings.warn(f"Error loading repository location {location_name}:{error.to_string()}")
Based on a Dagster Slack discussion it seems that Dagster version 1.5 added a type checking which results into this error. The Op manages to solve this error by removing following line from the code.
from __future__ import annotations
The text was updated successfully, but these errors were encountered:
Hi,
We recently updated Dagster to version 1.5 and found an following error while importing Meltano resource
Based on a Dagster Slack discussion it seems that Dagster version 1.5 added a type checking which results into this error. The Op manages to solve this error by removing following line from the code.
The text was updated successfully, but these errors were encountered: