https://dagster.io/ logo
s

Sasha Gorelikov

04/02/2021, 8:42 AM
Hi! Can you, please, advise me, how to run solid by name in some conditions… For more clear explanation, I will try to explain by some pseudo-code.
Copy code
@solid
def s1(context):
               pass
@solid
def s2(context):
               pass
 
If _var==1:
    _run_solid_by_string_name('s1')
else:     
	_run_solid_by_string_name('s2')
Thank you
d

daniel

04/02/2021, 2:20 PM
Hi Sasha - you can follow this example here to accomplish this: https://docs.dagster.io/concepts/solids-pipelines/pipelines#conditional-branching
s

Sasha Gorelikov

04/02/2021, 3:50 PM
Unfortunately this examples does not help me understend how can I ran solid by string name. All examples use determined solid name, In my case – I want to build pipeline dynamically without list of solids in code. I want "scan" all possible solids and change pipeline within this list of solids during execution. It's mean I want add _run_solid_by_string_name('s1') I some cases. In other cases - I want add to pipeline two another solids. I hope my point of view is clear.
Copy code
Thanks.
j

johann

04/02/2021, 4:02 PM
Hi Sasha, we don’t support conditionally changing solids at run time. Without much insight into what your needs are- If you need something beyond the fixed conditional branching that we offer, you could consider doing the branching within a solid
s

Sasha Gorelikov

04/02/2021, 6:12 PM
Thank you for answering!
2 Views