Comparing two recipes to determine if one is different?

info-rchitect
info-rchitect Registered Posts: 198 ✭✭✭✭✭✭

Hi,

We create Dataiku project templates which give the user known-good recipes and flow zones to accomplish a certain task. The project has variables we use in the recipes to parameterize the usage such that it can be run using different settings. My question is if there is a way I could loop through the recipes in the users' project and get a boolean result if a recipe has been edited in any way.

Perhaps, there is some recipe text definition I could create a hash ID I could use to do the boolean diff?

thx


Operating system used: Windows 10

Best Answer

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,722 Neuron
    edited July 2024 Answer ✓

    The power of the Dataiku API! Here you go:

    import dataiku
    
    client_handle = dataiku.api_client()
    project_handle = client_handle.get_project('some project key')
    # Or you use client_handle.list_project_keys() 
    # to get all project keys
    
    python_recipes = [i for i in project_handle.list_recipes() if i['type'] in ['python']]
    
    for python_recipe in python_recipes:
        recipe_name = python_recipe['name']
        recipe_handle = project_handle.get_recipe(recipe_name)
        recipe_script = recipe_handle.get_settings().get_payload()
        # Do something with it

Answers

  • info-rchitect
    info-rchitect Registered Posts: 198 ✭✭✭✭✭✭

    @Turribeach
    What do you think of a native recipe boolean comparison function between two recipes?

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,722 Neuron

    Too niche to be a built-in feature. But you have the API so you leverage that. You can also use the recipe modified date compared to the creation date to see if the recipe was changed.

Setup Info
    Tags
      Help me…