FInding flow zones by tag name?

Options
info-rchitect
info-rchitect Registered Posts: 169 ✭✭✭✭✭✭

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

Tagged:

Best Answer

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,712 Neuron
    Answer ✓
    Options

    This should give you enough to find out what you want:

    import dataikuclient = 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
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,712 Neuron
    Options

    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.

  • info-rchitect
    info-rchitect Registered Posts: 169 ✭✭✭✭✭✭
    Options

    @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
Setup Info
    Tags
      Help me…