Macro run with api

Options
benbeckerfr
benbeckerfr Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 4

Hello,

I am using Dataiku 9.0 version.

I develop a plugin to run a macro. This macro gets a folder from a managed_folder param that we indicate manually when we launch (with 'MANAGED_FOLDER' param in the Runnable.json).

I am trying to launch it from the pythonapi, and do not know how to fill the param dict in DSSMacro.run(params={}) to precise the managed folder needed for the param.

Does anyone had this issue for params in macro.run ?

Thanks for your help.


Operating system used: linux

Tagged:

Best Answer

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

    Hi @benbeckerfr
    ,

    The "params" kwarg is a dict of parameters that will be passed to the macro. For MANAGED_FOLDER parameters, the value should be set to the ID of the managed folder.

    Here's an example:

    run_id = my_macro.run(
        params={"my_folder": "9UQMRQ9O"}
    )

    Thanks,

    Zach

Answers

  • Raj7974
    Raj7974 Registered Posts: 8 ✭✭✭
    Options

    an you please guide how to pass value to select parameters of macro to run macro using python api

    Lable of parameter is Project Key

    Name is prj_key

  • Zach
    Zach Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 153 Dataiker
    edited July 17
    Options

    Hi @Raj7974
    ,

    To pass a SELECT parameter, you would set the parameter to the value of the choice.

    For example, with the following SELECT parameter:

    {
        "name": "prj_key",
        "label": "Project Key",
        "type": "SELECT",
        "selectChoices": [
            {
                "value": "foo",
                "label": "Label for foo"
            },
            {
                "value": "bar",
                "label": "Label for bar"
            }
        ]
    }

    You would run it by setting the value to "foo" or "bar":

    run_id = my_macro.run(
        params={"prj_key": "foo"}
    )

  • Raj7974
    Raj7974 Registered Posts: 8 ✭✭✭
    Options

    Can you please share steps to create plugin so that it will be visible in action of flows.

    I know how to create macros but I want it in Action just like we have options of duplicate, export and delete

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

    You can configure a macro to appear in the action menu by adding a macro role. Documentation is available here: https://doc.dataiku.com/dss/latest/plugins/reference/macros.html#macro-roles

    For example, the Excel sheet importer plugin adds a macro with the MANAGED_FOLDER role, which is visible under "Other actions" as shown below:

    5907171F-ABD1-47D1-90C6-773C4A662485_1_201_a.jpeg

Setup Info
    Tags
      Help me…