How to read managed folders in a dev plugin

Solved!
theoplatt
Level 2
How to read managed folders in a dev plugin

I'm using a managed folder to hold a list of unstructured files a dev plugin needs to read in as input




path <- dkuManagedFolderPath("PATHWAYANALYSIS.Genesets")


When I use this dev plugin within the "PATHWAYANALYSIS" project, all is good. When I try and use it within another project I get messages like - 




[2018/07/13-00:25:44.420] [null-out-37] [INFO] [dku.utils] - > path <- dkuManagedFolderPath("PATHWAYANALYSIS.Genesets")
[2018/07/13-00:25:44.442] [null-err-38] [INFO] [dku.utils] - Error in dku__check_api_error(resp, "Failed to get Box path") :
[2018/07/13-00:25:44.443] [null-err-38] [INFO] [dku.utils] - Failed to get Box path (HTTP code 500): Managed folder name not found: Genesets in PATHWAYANALYSIS


Can anyone think of a creative way to allow a plugin to read files from one project and run in another project?



 



Many thanks



 



Theo

0 Kudos
1 Solution
theoplatt
Level 2
Author

Solved my own problem. 



The way to do it is to add another input to your plugin that accepts managed folders ("acceptsManagedFolder": true) https://doc.dataiku.com/dss/latest/plugins/reference/recipes.html



Then read this input in your plugin and use it to get the path for the managed folders




"inputRoles" : [
{
...
},
{
"name": "genesets_input",
"label": "Managed folder of genesets",
"description": "The list of genesets to use in this analysis",
"arity": "UNARY",
"required": true,
"acceptsDataset": false,
"acceptsManagedFolder": true
}
],


and then in your R recipe code




genesets_input = dkuCustomRecipeInputNamesForRole("genesets_input")
path <- dkuManagedFolderPath(genesets_input[1])


Then share the managed folder with the project that needs it to run the plugin. As a bonus you see the managed folder being included in your flow graph.

View solution in original post

1 Reply
theoplatt
Level 2
Author

Solved my own problem. 



The way to do it is to add another input to your plugin that accepts managed folders ("acceptsManagedFolder": true) https://doc.dataiku.com/dss/latest/plugins/reference/recipes.html



Then read this input in your plugin and use it to get the path for the managed folders




"inputRoles" : [
{
...
},
{
"name": "genesets_input",
"label": "Managed folder of genesets",
"description": "The list of genesets to use in this analysis",
"arity": "UNARY",
"required": true,
"acceptsDataset": false,
"acceptsManagedFolder": true
}
],


and then in your R recipe code




genesets_input = dkuCustomRecipeInputNamesForRole("genesets_input")
path <- dkuManagedFolderPath(genesets_input[1])


Then share the managed folder with the project that needs it to run the plugin. As a bonus you see the managed folder being included in your flow graph.

Labels

?
Labels (2)
A banner prompting to get Dataiku