Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster/core/definitions/reconstructable.py
Show First 20 Lines • Show All 418 Lines • ▼ Show 20 Lines | |||||
def load_def_in_python_file(python_file, attribute, working_directory): | def load_def_in_python_file(python_file, attribute, working_directory): | ||||
return def_from_pointer(CodePointer.from_python_file(python_file, attribute, working_directory)) | return def_from_pointer(CodePointer.from_python_file(python_file, attribute, working_directory)) | ||||
def def_from_pointer(pointer): | def def_from_pointer(pointer): | ||||
target = pointer.load_target() | target = pointer.load_target() | ||||
if not callable(target): | from .pipeline import PipelineDefinition | ||||
from .repository import RepositoryDefinition | |||||
if isinstance(target, (PipelineDefinition, RepositoryDefinition)) or not callable(target): | |||||
return _check_is_loadable(target) | return _check_is_loadable(target) | ||||
# if its a function invoke it - otherwise we are pointing to a | # if its a function invoke it - otherwise we are pointing to a | ||||
# artifact in module scope, likely decorator output | # artifact in module scope, likely decorator output | ||||
if seven.get_args(target): | if seven.get_args(target): | ||||
raise DagsterInvariantViolationError( | raise DagsterInvariantViolationError( | ||||
"Error invoking function at {target} with no arguments. " | "Error invoking function at {target} with no arguments. " | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |