Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on June 4, 2024 12:32PM
Likes: 0
Replies: 3
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
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)
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