Skip to main content

Recipes Guide

Recipes are predefined workflows that combine multiple analysis steps. This guide covers how to discover, run, and monitor recipe executions.

What are Recipes?

Recipes are automated workflows that:
  • Combine multiple analysis steps
  • Standardize analysis processes
  • Enable batch processing
  • Produce consistent results

Types of Recipes

  • Scan Recipes - Processing workflows for scan data
  • Analysis Recipes - Analysis workflows (porosity, wall thickness, etc.)

Listing Available Recipes

Organization Recipe Versions

  • Python
from api_client import LumafieldAPIClient

client = LumafieldAPIClient(api_url, email, password)

# List recipe versions for an organization
organization_id = "your-org-uuid"
recipes = client.list_organization_recipe_versions(organization_id)

for recipe in recipes['results']:
    print(f"Recipe: {recipe['name']}")
    print(f"Version: {recipe['version']}")

Scan Recipe Revisions

  • Python
# List scan recipe revisions
scan_recipes = client.list_organization_scan_recipe_revisions(organization_id)

for recipe in scan_recipes['results']:
    print(f"Scan Recipe: {recipe['name']}")

Running Recipes

Run Recipe on Project

  • Python
project_id = "your-project-uuid"
recipe_pk = "recipe-uuid"

# Run recipe
invocation = client.run_project_recipe(project_id, recipe_pk)
print(f"Recipe invocation started: {invocation['id']}")

Monitoring Recipe Execution

Get Recipe Invocations

  • Python
# Get all recipe invocations for a project
invocations = client.get_project_recipe_invocations(project_id)

for invocation in invocations['results']:
    print(f"Recipe: {invocation['recipe']['name']}")
    print(f"State: {invocation['state']}")
    print(f"Created: {invocation['created_at']}")

Check Invocation Status

  • Python
invocation_id = "invocation-uuid"

# Get invocation details
invocation = client.get_recipe_invocation(invocation_id)

print(f"State: {invocation['state']}")
print(f"Progress: {invocation.get('progress', 'N/A')}")

Getting Recipe Results

Download Recipe Results

  • Python
# Get recipe results
results = client.get_recipe_invocation_results(invocation_id)

# Results include downloadable files
if results.get('downloadableResults'):
    download_url = results['downloadableResults']
    # Download the results archive

Recipe Result Formats

Recipe results typically include:
  • CSV files - Tabular analysis data
  • JSON files - Structured metadata
  • PLY files - 3D visualization meshes
  • ZIP archives - Pre-packaged result sets

Best Practices

1. Check Recipe Availability

Verify recipes are available before running:
recipes = client.list_organization_recipe_versions(org_id)
recipe_names = [r['name'] for r in recipes['results']]

if 'Porosity Analysis' not in recipe_names:
    print("Porosity Analysis recipe not available")

2. Monitor Execution

Implement proper polling:
def wait_for_recipe(invocation_id, max_wait=3600):
    start = time.time()
    while time.time() - start < max_wait:
        invocation = client.get_recipe_invocation(invocation_id)
        if invocation['state'] == 'done':
            return invocation
        elif invocation['state'] == 'failed':
            raise Exception("Recipe execution failed")
        time.sleep(30)
    raise TimeoutError("Recipe timeout")

3. Handle Results

Download and process results efficiently:
results = client.get_recipe_invocation_results(invocation_id)

# Check available files
for result in results.get('results', []):
    files = result.get('dataObjectFileNames', [])
    for filename in files:
        # Download individual files
        download_info = client.get_export(
            id=result['dataObjectId'],
            file_name=filename
        )

Next Steps