FInding flow zones by tag name?

Tags
Registered Posts: 198 ✭✭✭✭✭✭

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

  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,399 Neuron
    edited July 2024 Answer ✓

    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

  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,399 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.

  • Registered Posts: 198 ✭✭✭✭✭✭
    edited July 2024

    @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

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.