How to set recipe container through dataikuapi

Options
fmonari
fmonari Registered Posts: 18 ✭✭✭✭

Hi,

I would like to change dynamically the container for the execution of a recipe through the dataikuapi-external-client. I could not find any referenece in the documentation.

How can I achieve that (if possible)?

Regards,

Filippo

Best Answer

  • HarizoR
    HarizoR Dataiker, Alpha Tester, Registered Posts: 138 Dataiker
    edited July 17 Answer ✓
    Options

    Hi again,

    In that case you will need to use the get_settings() method of the Recipe API, retrieve the existing parameters for container configuration, modify the dictionary in-place and finally call the save() method on the recipe settings handle. Here is a simplified example:

    import dataikuapi
    client = dataikuapi.DSSClient(host=HOST, api_key=API_KEY)
    project = client.get_project(PROJECT_KEY)
    recipe_settings = project.get_recipe(RECIPE_ID).get_settings()
    recipe_advanced_params = recipe_settings.raw_params
    recipe_advanced_params["containerSelection"]["containerMode"] = "EXPLICIT_CONTAINER"
    recipe_advanced_params["containerSelection"]["containerConf"] = YOUR_CONTAINER_CONF_NAME

    Of course this assumes that you already have an existing functioning containerized execution configuration in your instance's administration settings.

    Best,

    Harizo

Answers

Setup Info
    Tags
      Help me…