Multi dataset input role for custom plugin in

Options
tNbre
tNbre Registered Posts: 10 ✭✭✭✭

Hello,

i'm currently writting a plugin based on a python recipe. The plugin aims is to calculate quantiles for each columns of the input dataset.

Is there a way to have a dynamic number of input ? I'm trying to avoid to replicate the use of the pluggin but i can't be sure about the number of dataset to take in account. My plugin works when i'm setting myself the number of input role but i would love to be flexible.

Today it can be 2 input tomorrow it can be 10. I'm trying to replicate the Add button of dataiku's existing recipe.

Regards,


Operating system used: linux

Tagged:

Best Answer

  • Zach
    Zach Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 153 Dataiker
    Answer ✓
    Options

    Hi @tNbre
    ,

    You can do this by setting the arity of the dataset input role to NARY. This will allow you to set any number of datasets as the input.

    Here's an example input role in recipe.json:

    "inputRoles": [{"name": "input_datasets","label": "input datasets","description": "Select multiple input datasets","arity": "NARY","required": true,"acceptsDataset": true}],

    Here's a screenshot of what it looks like:

    image.png

    You can access the datasets within your plugin code as follows:

    import dataikufrom dataiku.customrecipe import *input_dataset_names = get_input_names_for_role('input_datasets')for dataset_name in input_dataset_names:dataset = dataiku.Dataset(dataset_name)# Do stuff with each dataset hereprint('Dataset:', dataset.name)

    Thanks,

    Zach

Answers

Setup Info
    Tags
      Help me…