Blueprints

Generate an output file using Python script

Source

yaml
id: python-generate-output-file
namespace: company.team

tasks:
  - id: generate_output_file
    type: io.kestra.plugin.scripts.python.Script
    script: |
      f = open("my_file.txt", "w")
      f.write("This file is created using Python script in Kestra.")
      f.close()
    outputFiles:
      - my_file.txt

  - id: log_file_contents
    type: io.kestra.plugin.core.log.Log
    message: "{{ read(outputs.generate_output_file.outputFiles['my_file.txt']) }}"

About this blueprint

Python Outputs

This flow generates an output file using Python script, and then reads the same. The flow has two tasks: 1. Generate an output file using Python script 2. Read the generated output file and log its contents

Script

Log

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra