🚀 New! Kestra raises $3 million to grow Learn more

This flow will install the pip package, and use the Python Kestra library to generate outputs and metrics.

yaml
id: python-pip
namespace: io.kestra.demo

description:
  This flow will install the pip package, and use the Python Kestra library to generate outputs and metrics.

tasks:
  - id: "python"
    type: "io.kestra.core.tasks.scripts.Python"
    inputFiles:
      main.py: |
        from kestra import Kestra
        import requests
        import time

        start = time.perf_counter()
        response = requests.get('https://google.com')
        end = time.perf_counter()

        Kestra.outputs({'status': response.status_code, 'text': response.text})
        Kestra.timer('duration', end - start)
    requirements:
      - requests
    dockerOptions:
      image: python
    runner: DOCKER