FInding flow zones by tag name?
info-rchitect
Registered Posts: 180 ✭✭✭✭✭✭
Hi,
Would like to be able to find flow zones by tag name using the Python DSS, such that users can select matching flow zones for execution using their own parameterized variables. Is this possible?
thx
Operating system used: Windows 10
Best Answer
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,982 Neuron
This should give you enough to find out what you want:
import dataiku client = dataiku.api_client() project = client.get_project('some_project_key') flow = project.get_flow() zones = flow.list_zones() for zone in zones: zone_handle = flow.get_zone(zone.id) print("Zone id=%s Zone name=%s" % (zone.id, zone.name)) zone_tags = zone.get_settings().get_raw()['tags'] for zone_tag in zone_tags: print(zone_tag)
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,982 Neuron
PS: If you are going to be doing these searches over your whole projects it will highly advisable to create a cache table with all the projects/zones/tags and refresh it every hour or whatever you consider approapiate so you can perform quick tag=>zone lookups.
-
@Turribeach
I did have to add a `try-except` enhancement due to some flow zones not being accessible to me:for p in projects : project_key = p["projectKey"] project = client.get_project(project_key) flow = project.get_flow() zones = [] try: zones = flow.list_zones() except Exception as e: print(e) continue