DataKitchen DataOps Documention

Cook Orders

Required Parameters

Required Parameter
Description

Token

A valid session token generated by username/password authentication.

Kitchen

The Kitchen where you want to cook the Order.

Recipe

The Recipe for the Order.

Variation

The Variation for the Order.

Runtime Overrides

Overrides for recipe and kitchen variables passed at the time of order execution.

Runtime Override Type
Description

Order Schedule

The start, recurrence, frequency, and expiration of an order. See mesos-setting in variations.json.

Infrastructure

The specific infrastructure used during running of an order run. For example, an s3 bucket, database schema, or container image tag.

Date of Source Data

Used for backfilling use cases when the newest code should be run against old data. Distinct from the start date of an order run.

Alert Destination

Where order run alerts should be sent.

Examples

Bash

This example shows how to cook an Order and pass an optional runtime override.

#!/bin/bash

BASE_URL="https://cloud.datakitchen.io"
FORM_HEADER="Content-type: application/x-www-form-urlencoded"
JSON_HEADER"Content-type: application/json"

USERNAME="<USERNAME>"
PASSWORD="<PASSWORD>"

# Collect Token with curl command
TOKEN=`curl -f -s -X POST -d "username=$USERNAME&password=$PASSWORD" -H "$FORM_HEADER" "$BASE_URL/v2/login"`

# Status message
if [ "$?" != "0" ]
then
    echo "Unable to login"
else
    echo "Token received: ${TOKEN}"
fi

# Define Header with Token and Required Parameters
AUTH_HEADER="Authorization: Bearer $TOKEN"
KITCHEN="<KITCHEN_NAME>"
RECIPE="<RECIPE_NAME>"
VARIATION="<VARIATION_NAME>"

# Define optional Runtime Overrides
PARAMS='{"parameters":{"testvar":"override_value"}}'

# Curl command to Cook the Order
curl -f -s -X PUT -H "$JSON_HEADER" -H "$AUTH_HEADER" -d $PARAMS "$BASE_URL/v2/order/create/$KITCHEN/$RECIPE/$VARIATION"

# Status message
if [ "$?" != "0" ]
then
	echo "Unable to create order run"
else
	echo "Order run created successfully"
fi

Python

import requests
import os
import codecs
import json

# Gather Token
payload = {'username': os.environ['username'], 'password': os.environ['password'], 'message': ['message'], 'file': updatefile.read().encode('utf-8'), 'filepath': ['filepath']}
r = requests.post('https://cloud.datakitchen.io/v2/login', data = json.dumps(payload))
token=r.text

# Define required parameters
kitchen="your_kitchen"
recipe="your_recipe"
variation="your_variation"

# Define optional Runtime Overrides
overrides = {"variable1": override1, "value2": override2}
parameters = json.dumps({'parameters': overrides})

# Define put request pieces
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token }
url = 'https://cloud.datakitchen.io/v2/order/create/%s/%s/%s' % (kitchen, recipe, variation)

# Cook Order
r2 = requests.put(url, headers = headers, data=parameters)
print 'r2'
print r2.json()

Updated 8 days ago


Cook Orders


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.