https://dagster.io/ logo
m

Michael T

02/11/2021, 9:34 PM
Hi - once I have decorated a function with @solid, the only way to call it is with a @pipeline or @composite_solid()? That is - I can’t “just call” the function?
s

sandy

02/11/2021, 9:48 PM
You can invoke
result = execute_solid(solid, input_values={...})
🤔 1
s

Simon Späti

02/12/2021, 4:07 PM
@sandy Is there a way to inherit the resources my solid when I use that
execute_solid
? Instead of defining
mode_def
again, as I have access to the resources in my solid? What I have - the
load_delta_table_to_df
needs the pyspark and s3 resource:
Copy code
def load_delta_table_to_df_factory(
    name,
    output_data_frame,
    input_defs=None,
 
):
 
    @solid(
        name=name,
        description=description,
        required_resource_keys={"pyspark", "s3"},
        input_defs=input_defs,
        output_defs=[
            OutputDefinition(
                output_data_frames[output_data_frame],
                description=output_description,
            )
        ]
    )
    def _x_solid(context, **input_defs):
        df = execute_solid(
            load_delta_table_to_df,
            input_values={
                "delta_coordinate": input_defs["delta_coordinate"],
                "where_conditions": input_defs["where_conditions"],
            },
            # mode_def=[ModeDefinition("s3"), ModeDefinition("pyspark")]
        )

        yield Output(value=df, output_name="data_frame")

    return _x_solid