Plugin Recipe Unique Identifier from within Recipe.py

Solved!
gblack686
Level 4
Plugin Recipe Unique Identifier from within Recipe.py

How can I access the specific recipe name from the recipe.py and set it as a variable?  Every time I run a recipe I write the the recipe config to the local variables. However, if someone creates another instance of the plugin in the same project it will overwrite this. These variables are crucial for linking webapps and metrics to the specified datasets/recipes.

Also, get_plugin_config() is a blank dictionary. What is the use of this?

0 Kudos
1 Solution
tomas
Level 5

Hi,

 I tested your case, created a plugin recipe producing dummy output. When you create more than one instance of the same plugin and you want to distinguish between them, you can use the recipe name. In my case the recipe name is automaticallly created by DSS such as compute_dummyA, compute_dummyB.

In the recipe code you can then use something like this:

print(globals()['dku_exec_env']['jobId'])

This will return compute_dummyA_NP  in one case and compute_dummyB_NP in the other.

Hope it helps

View solution in original post

3 Replies
Liev
Dataiker Alumni

Hi @gblack686 

The settings obtained under get_plugin_config() are settings at the plugin level, set by plugin administrators in the Plugins section.

There is no API call to retrieve the recipe from within the recipe at the moment. 

It's not very clear the relationship between recipes, datasets and webapps. 
having said that, you should really consider looking into our new Dataiku apps functionality released as part of DSS 8.0 as it will allow you to package projects and parametrize them.

Good luck!

tomas
Level 5

Hi,

 I tested your case, created a plugin recipe producing dummy output. When you create more than one instance of the same plugin and you want to distinguish between them, you can use the recipe name. In my case the recipe name is automaticallly created by DSS such as compute_dummyA, compute_dummyB.

In the recipe code you can then use something like this:

print(globals()['dku_exec_env']['jobId'])

This will return compute_dummyA_NP  in one case and compute_dummyB_NP in the other.

Hope it helps

gblack686
Level 4
Author

Exactly what I needed, thank you