https://dagster.io/ logo
#announcements
Title
# announcements
b

Basil V

03/17/2020, 9:35 PM
For example, I'd like to be able to do this:
Copy code
some_alias = some_solid.alias('some_alias')
execute_solid(some_alias)
a

alex

03/17/2020, 9:48 PM
why do you want to test the aliased version?
b

Basil V

03/17/2020, 9:50 PM
So that I can test it with the same config (passed in via environment dict) that I use when testing execute_pipeline or running in dagit, but without having to change the config name or duplicating config code. Does that make sense? I can provide example if not
Since execute_pipeline and dagit I use the aliased name
a

alex

03/17/2020, 9:52 PM
this makes sense - i forgot how we set up
enviroment_dict
for
execute_solid
b

Basil V

03/17/2020, 9:53 PM
Copy code
MODE = 'development'
    
    mode_defs = {
        'development': dev(),
        'staging': staging(),
        'production': prod(),
    }

    environment_dict = merge_yamls([
        file_relative_path(__file__, '../environments/solids.yaml'),
        file_relative_path(__file__, f'../../../utils/environments/{MODE}.yaml'),
    ])

    aliased_solid = solid.alias('aliased_solid')

    result = execute_solid(
        aliased_solid,
        mode_def=mode_defs[MODE],
        environment_dict=environment_dict,
        run_config=RunConfig(mode=MODE),
    )

    assert result.success
a

alex

03/17/2020, 9:54 PM
well -
execute_solid
is just a thin wrapper around
execute_pipeline
so I think your best bet may just be to use
execute_pipeline
with a small
Copy code
@pipeline
def test():
  aliased_solid()
b

Basil V

03/17/2020, 9:54 PM
This basically what I am doing to test at the solid level, in order to maintain config consistency
Ok let me see if that will work
a

alex

03/17/2020, 9:56 PM
or - depending on how exactly you want things to work - you could just use
execute_pipeline
on your “real” pipeline definition and just use
step_keys_to_execute
on
RunConfig
to execute a single step
b

Basil V

03/17/2020, 9:59 PM
Ok cool thanks. I think one of these solutions should work will give it a shot
Hey so I tried the
step_keys_to_execute
param but getting:
Copy code
dagster.core.errors.DagsterExecutionStepNotFoundError: Execution plan does not contain step: ...
Do I need to do anything else to specify step key names in the pipeline, or is there a way to list available step keys for a pipeline?
I listed the name as a string, so if my solid was called
some_solid()
I specified the step key as 'some_solid' (or the alias name)
Nevermind I think I got it—seems I need
'solid_name.compute'
Thanks!
a

alex

03/18/2020, 2:51 PM
ya its a little confusing, glad you were able to figure it out!
2 Views