This message was deleted.
# ask-anything
s
This message was deleted.
v
I donโ€™t think you need two .yaml files. As you describe it, such a pipeline is already supported. Perhaps share your .yaml file or describe your pipeline in more detail, and explain where you think ploomber falls short here?
๐Ÿ‘ 2
i
Just to clarify, you want something similar to this: https://docs.ploomber.io/en/latest/api/cli.html#build-pipeline-partially Where itโ€™s pointing to a different end?
?
In that case you can still use the partial build and run on D and E
e
great question, my personal preference is that conditionals inside a pipeline get a bit hard to maintain. however, there are a few alternatives I'd suggest: 1. partial builds can allow you to select the final node to execute, so you could so
ploomber build -p random-forest
or
ploomber build -p another
2. alternatively, you may parametrize a task and have that parameter determine the logic to execute inside the task. example:
Copy code
tasks:
  source: script.py
  products: ...
  params:
    model: random-forest
then in your script.py:
Copy code
if model == 'random-forest':
  # do something
else:
  # do another thing
3. Finally, if the logic is too different, you can create the common parts in a separate file and then use the
import_tasks_from
directive https://docs.ploomber.io/en/latest/api/spec.html#import-tasks-from thoughts @Raffaele Olmeda?
r
Yes that was exactly what I meant, thank you guys!
๐Ÿ™Œ 1
e
happy to help! meerkat
r

follow-up question: โ–พ

what if in his piacture, I have a task F which is common to both branches (after D and E)
Can I still choose one path over the other?
e
you could create two tasks that have
source: F.py
, just add a
name: some-name
to each one
does that help?
if you go that route, then one task will have D as upstream and the other one E as upstream, in that case, you need to disable extract_upstream and declare upstream dependencies in pipeline.yaml:
Copy code
meta:
  extract_upstream: false

tasks:
  - source F.py
    name: f-one
    upstream: [D]

  - source F.py
    name: f-two
    upstream: [E]
r
Annnn ok so it works also in this case, thats great!
๐Ÿ‘ 2
i
Feel free to ask more it helps us improve the product and docs ๐Ÿ™‚