dkutils.datakitchen_api.recipe module

exception dkutils.datakitchen_api.recipe.NodeNotFoundError[source]

Bases: FileNotFoundError

class dkutils.datakitchen_api.recipe.Recipe(client: DataKitchenClient, name: str)[source]

Bases: object

Recipe object for performing recipe related API requests.

Parameters
  • client (DataKitchenClient) – Client for making requests .

  • name (str) – Name of existing recipe.

__init__(client: DataKitchenClient, name: str) None[source]

Recipe object for performing recipe related API requests.

Parameters
  • client (DataKitchenClient) – Client for making requests .

  • name (str) – Name of existing recipe.

static create(client: DataKitchenClient, recipe_name: str, description: str = None) Recipe[source]

Create a new recipe in the kitchen set on the provided client and return a Recipe object

Parameters
  • client (DataKitchenClient) – Client for making requests.

  • recipe_name (str) – New recipe name

  • description (str) – New recipe description

Returns

Recipe object

Return type

Recipe

Raises
  • HTTPError – If the request fails.

  • ValueError – If recipe_name is empty or None If recipe_name already exists in the provided kitchen

delete(kitchen_name: str) requests.models.Response[source]

Delete this recipe from the provided kitchen.

Parameters

kitchen_name (str) – Kitchen from which the recipe will be deleted.

Returns

Response object

Return type

requests.Response

Raises

HTTPError – If the request fails.

delete_recipe_files(kitchen_name: str, filepaths: list) requests.models.Response[source]

Delete the provided files from this recipe in the provided kitchen.

Parameters
  • kitchen_name (str) – Kitchen from which the recipe files will be deleted.

  • filepaths (list) – List of file paths to delete.

Returns

Response object

Return type

requests.Response

Raises

HTTPError – If the request fails.

get_node_files(kitchen_name: str, nodes: list) dict[source]

Retrieve all the files associated with the provided list of nodes.

Parameters
  • kitchen_name (str) – Kitchen from which the recipe node files will be retrieved.

  • nodes (list) – List of node names

Raises
  • HTTPError – If the request fails.

  • NodeNotFoundError – If any of the provided nodes do not exist in this recipe.

Returns

Dictionary keyed by file path and valued by file contents.

Return type

dict

get_recipe_files(kitchen_name: str) dict[source]

Retrieve all the files for this recipe in the provided kitchen.

Parameters

kitchen_name (str) – Kitchen from which the recipe files will be retrieved.

Returns

Dictionary keyed by file path and valued by file contents string.

Return type

dict

Raises
  • HTTPError – If the request fails.

  • Exception – If a filetype is unrecognized.

update_recipe_files(kitchen_name: str, filepaths: dict) requests.models.Response[source]

Update the files for this recipe in the provided kitchen.

Parameters
  • kitchen_name (str) – Kitchen for which the recipe files will be updated.

  • filepaths (dict) – Dictionary keyed by file path and valued by new/updated file contents.

Returns

Response object

Return type

requests.Response

Raises

HTTPError – If the request fails.

property name