https://kedro.org/ logo
#questions
Title
# questions
r

Riley Brady

09/14/2022, 8:16 PM
(
0.18.1
) It seems that
kedro run --tag some_tag1,some_tag2
will run any nodes with
some_tag1
OR
some_tag2
. Is there any functionality to use AND instead of OR? My workaround right now is to create a custom tag of
some_tag1-some_tag2
and then calling that directly. It would be nice if I could list out a few tags and only run nodes that have all of them. But I understand why OR is the default.
d

David Hasson

09/14/2022, 9:28 PM
Hi Riley, an alternative would be to define a new pipeline using the & operator, as in this link below
only nodes with tags and
```raw_nodes = pipeline.only_nodes_with_tags('raw')
car_nodes = pipeline.only_nodes_with_tags('cars')
raw_car_nodes = raw_nodes & car_nodes```
https://stackoverflow.com/a/59132772
๐Ÿ‘ 1
a

Antony Milne

09/15/2022, 8:41 AM
This is a very good question. Just to add to the above, since itโ€™s quite an old answer and things have changed a bit since then: in your
pipeline_registry.py
file you can register the pipeline
pipeline.filter(tags={"tag1"}).filter(tags={"tags2"})
and then run it using
kedro run -p
flag. If this is a pattern that you need to do a lot for different sets of tags then there are other ways that would make it a more generic solution so that you donโ€™t need to manually register a whole new correctly filtered
pipeline
object. But if you just need to do it as a one off then this is the easiest way ๐Ÿ™‚
๐Ÿ™Œ 1
r

Riley Brady

09/15/2022, 4:53 PM
Thanks so much! Yes, this is mostly for local testing and simple testing of pipelines through github actions. I am thus looking for a quick CLI solution. It seems like either option could work here since I know the few nodes I am targeting
๐Ÿ‘ 1
2 Views