Kestra

Workflow engine

  • Reserve k8s resources in yml for base services: kestra, …
  • kestra: capture logging to send back on failure.
  • kestra: read report and tasks from file
  • kestra: Use variables / secrets in flow.
    • Have to purchase enterprise?
  • Notes
    • Pebble templating
    • Kestra not in standalone mod takes about 8G of memory
    • Adjust the multipart.threshold and multipart.chunksize in the Kestra configuration to optimize the upload process.
  • Using API
    echo -n "username:password" | base64 | pbcopy # in x-flux
    
    export BASE='https://kestra.k1.int.x.com'
    export AUTH='Authorization: Basic xxx'
    
    curl -X POST \
    'https://localhost:8080/api/v1/executions/company.team/myflow?wait=true' \
    -H 'Authorization: Basic <encoded-string>'
    
    curl -X GET \
    "$BASE/api/v1/executions/?namespace=rufas&flowId=rufasflow" \
    -H $AUTH -H "Content-Type: application/json"
    
    curl -X DELETE \
    "$BASE/api/v1/executions/by-query?namespace=dev&flowId=test" \
    -H $AUTH -H "Content-Type: application/json"
    
# render expression
>{{outputs}}<

"kestra.api.url": "https://api.kestra.io/api/v1",
"kestra.schema.match-path": ""
  • Kestra Deploy to Prod
    • ONLY one at a time
    • Add cron
      */5 * * * * cd $HOME/deploy && ./bin/exec-console.sh x:rufas:sync > ./log/cron/rufas-sync.log 2>&1
      
      {{ jq outputs.counts.results '. | select(. != null) | .[]' }}
    • deploy backend, eval-app, forms
    • Todo
      • Add herdNum limit to kestra flow
      • Fail if herdNum > x
      • kestra: add herdNum limit to stop large runs
        • See logic from William
        • Terraform the batch envs for the diff sizes
        • Look at python script to manage aws batch in a kestra step
    • Kestra to 128G instance $1300/mo
      • Changed to 64G on 9/27
    We ask them to scale down next week. 
    Even if it’s 4000 cows, run 400, and just scale 
    the milk, calf and energy inputs associated.
    • Flow result back to users
      • what is the size for input,output,logs.
      • Generate S3 urls for those
      • rufas: Need to send status to Slack