Python Recipe - Get name of current recipe, inputs, and outputs (DSS 8)

Solved!
sylvyr3
Level 3
Python Recipe - Get name of current recipe, inputs, and outputs (DSS 8)

I'm trying to write a python recipe that that calls a function from an internal module but I need to be able to pass the name of the input and output table for that recipe.  Since the user can specify any name for the output table I need to be able to grab it programmatically. 

It seems like it's fairly easy in DSS 9 - https://community.dataiku.com/t5/Using-Dataiku-DSS/Python-recipe-iterate-through-inputs/td-p/17071

In DSS 8 it looks like I might need to pass the name of the current recipe to (https://doc.dataiku.com/dss/latest/python-api/recipes.html#listing-recipes)

project.get_recipe("myrecipe")

retrieve the names of the inputs and outputs.  But it seems like the default recipe naming convention is "compute_"+output_dataset_name.  So I'm back to the problem of not knowing what the recipe name is without an api call of some sort.

0 Kudos
1 Solution
fchataigner2
Dataiker

Hi,

if your recipe is not partitioned, then you can get its name by taking the activity id and removing the _NP end

from dataiku.core.flow import FLOW
current_recipe_name = FLOW["currentActivityId"][:-3]

View solution in original post

0 Kudos
1 Reply
fchataigner2
Dataiker

Hi,

if your recipe is not partitioned, then you can get its name by taking the activity id and removing the _NP end

from dataiku.core.flow import FLOW
current_recipe_name = FLOW["currentActivityId"][:-3]

0 Kudos