How to set recipe container through dataikuapi

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 2024 Answer ✓

    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

  • HarizoR
    HarizoR Dataiker, Alpha Tester, Registered Posts: 138 Dataiker

    Hi Filippo,

    Do you mean to programmatically change the "container configuration" settings for a given recipe ?

    Best,

    Harizo

  • fmonari
    fmonari Registered Posts: 18 ✭✭✭✭

    Exactly. How can I do that? What methods in the DSSRecipe or DSSRecipeSettings classes should I use?

    Thanks!

  • Torben
    Torben Registered Posts: 3 ✭✭✭

    How can the number of concurrent jobs be specified? E.g. if a compute resource is set to a 'large configuration' how can it be limited to, say, 10 concurrent jobs, while for a standard compute be reset to the default?

Setup Info
    Tags
      Help me…