Skip to content

Commit

Permalink
update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Nov 20, 2023
1 parent 88fb407 commit a558bdc
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@
from .system import StepExecutionContext, TypeCheckContext


def _property_msg(prop_name: str, method_name: str) -> str:
return (
f"The {prop_name} {method_name} is not set on the context when an op is directly invoked."
)
def _property_msg(prop_name: str, method_name: str, step_type: str) -> str:
return f"The {prop_name} {method_name} is not set on the context when an {step_type} is directly invoked."


class DirectInvocationOpExecutionContext(OpExecutionContext):
Expand Down Expand Up @@ -153,7 +151,7 @@ def __del__(self):

def _check_bound(self, fn_name: str, fn_type: str):
if not self._bound:
raise DagsterInvalidPropertyError(_property_msg(fn_name, fn_type))
raise DagsterInvalidPropertyError(_property_msg(fn_name, fn_type, "op"))

def bind(
self,
Expand Down Expand Up @@ -286,7 +284,7 @@ def resources(self) -> Resources:

@property
def dagster_run(self) -> DagsterRun:
raise DagsterInvalidPropertyError(_property_msg("dagster_run", "property"))
raise DagsterInvalidPropertyError(_property_msg("dagster_run", "property", "op"))

@property
def instance(self) -> DagsterInstance:
Expand All @@ -311,7 +309,7 @@ def debug_solid(context):

@property
def step_launcher(self) -> Optional[StepLauncher]:
raise DagsterInvalidPropertyError(_property_msg("step_launcher", "property"))
raise DagsterInvalidPropertyError(_property_msg("step_launcher", "property", "op"))

@property
def run_id(self) -> str:
Expand All @@ -330,11 +328,11 @@ def run_config(self) -> dict:

@property
def job_def(self) -> JobDefinition:
raise DagsterInvalidPropertyError(_property_msg("job_def", "property"))
raise DagsterInvalidPropertyError(_property_msg("job_def", "property", "op"))

@property
def job_name(self) -> str:
raise DagsterInvalidPropertyError(_property_msg("job_name", "property"))
raise DagsterInvalidPropertyError(_property_msg("job_name", "property", "op"))

@property
def log(self) -> DagsterLogManager:
Expand All @@ -343,15 +341,15 @@ def log(self) -> DagsterLogManager:

@property
def node_handle(self) -> NodeHandle:
raise DagsterInvalidPropertyError(_property_msg("node_handle", "property"))
raise DagsterInvalidPropertyError(_property_msg("node_handle", "property", "op"))

@property
def op(self) -> Node:
raise DagsterInvalidPropertyError(_property_msg("op", "property"))
raise DagsterInvalidPropertyError(_property_msg("op", "property", "op"))

@property
def solid(self) -> Node:
raise DagsterInvalidPropertyError(_property_msg("solid", "property"))
raise DagsterInvalidPropertyError(_property_msg("solid", "property", "op"))

@property
def op_def(self) -> OpDefinition:
Expand Down Expand Up @@ -414,7 +412,9 @@ def alias(self) -> str:
return cast(str, self._alias)

def get_step_execution_context(self) -> StepExecutionContext:
raise DagsterInvalidPropertyError(_property_msg("get_step_execution_context", "method"))
raise DagsterInvalidPropertyError(
_property_msg("get_step_execution_context", "method", "op")
)

def get_events(self) -> Sequence[UserEvent]:
"""Retrieve the list of user-generated events that were logged via the context.
Expand Down Expand Up @@ -655,7 +655,7 @@ def __init__(self, op_execution_context: DirectInvocationOpExecutionContext):

def _check_bound(self, fn_name: str, fn_type: str):
if not self._bound:
raise DagsterInvalidPropertyError(_property_msg(fn_name, fn_type))
raise DagsterInvalidPropertyError(_property_msg(fn_name, fn_type, "asset"))

def bind(
self,
Expand Down

0 comments on commit a558bdc

Please sign in to comment.