Differential D8684 Diff 40955 examples/docs_snippets/docs_snippets/concepts/solids_pipelines/solids.py
Changeset View
Changeset View
Standalone View
Standalone View
examples/docs_snippets/docs_snippets/concepts/solids_pipelines/solids.py
# pylint: disable=unused-argument | # pylint: disable=unused-argument | ||||
import requests | import requests | ||||
from dagster import DagsterType, InputDefinition, Nothing, Output, OutputDefinition, solid | from dagster import ( | ||||
DagsterType, | |||||
InputDefinition, | |||||
Nothing, | |||||
Output, | |||||
OutputDefinition, | |||||
solid, | |||||
) | |||||
class MockResponse: | class MockResponse: | ||||
def json(self): | def json(self): | ||||
return {} | return {} | ||||
class MockRequest: | class MockRequest: | ||||
Show All 32 Lines | def my_input_solid(abc, xyz): | ||||
pass | pass | ||||
# end_input_solid_marker | # end_input_solid_marker | ||||
# start_typed_input_solid_marker | # start_typed_input_solid_marker | ||||
MyDagsterType = DagsterType(type_check_fn=lambda _, value: value % 2 == 0, name="MyDagsterType") | MyDagsterType = DagsterType( | ||||
type_check_fn=lambda _, value: value % 2 == 0, name="MyDagsterType" | |||||
) | |||||
@solid(input_defs=[InputDefinition(name="abc", dagster_type=MyDagsterType)]) | @solid(input_defs=[InputDefinition(name="abc", dagster_type=MyDagsterType)]) | ||||
def my_typed_input_solid(abc): | def my_typed_input_solid(abc): | ||||
pass | pass | ||||
# end_typed_input_solid_marker | # end_typed_input_solid_marker | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | Args: | ||||
args (any): One or more arguments used to generate the nwe solid | args (any): One or more arguments used to generate the nwe solid | ||||
name (str): The name of the new solid. | name (str): The name of the new solid. | ||||
input_defs (list[InputDefinition]): Any input definitions for the new solid. Default: None. | input_defs (list[InputDefinition]): Any input definitions for the new solid. Default: None. | ||||
Returns: | Returns: | ||||
function: The new solid. | function: The new solid. | ||||
""" | """ | ||||
@solid(name=name, input_defs=input_defs or [InputDefinition("start", Nothing)], **kwargs) | @solid( | ||||
name=name, | |||||
input_defs=input_defs or [InputDefinition("start", Nothing)], | |||||
**kwargs, | |||||
) | |||||
def _x_solid(context): | def _x_solid(context): | ||||
# Solid logic here | # Solid logic here | ||||
pass | pass | ||||
return _x_solid | return _x_solid | ||||
# end_solid_factory_pattern_marker | # end_solid_factory_pattern_marker |