Skip to content

Commit

Permalink
fix: #4408
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-geller committed Jul 29, 2024
1 parent dbfdb67 commit e483ee9
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions core/src/main/java/io/kestra/plugin/core/runner/Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
To generate output files you can either use the `outputFiles` task's property and create a file with the same name in the task's working directory, or create any file in the output directory which can be accessed by the `{{outputDir}}` Pebble expression or the `OUTPUT_DIR` environment variables.
Note that:
- This task runner is Operating System agnostic. You can use it also on Windows without any additional configuration.
- When the Kestra Worker running this task is terminated, the process will be interrupted and re-created at worker restart."""
- This task runner is independent of any Operating System. You can use it equally on Linux, Mac or Windows without any additional configuration.
- When the Kestra Worker running this task is shut down, the process will be interrupted and re-created as soon as the worker is restarted."""
)
@Plugin(
examples = {
Expand All @@ -57,6 +58,36 @@
- echo "Hello World\"""",
full = true
),
@Example(
title = "Install custom Python packages before executing a Python script. Note how we use the `--break-system-packages` flag to avoid conflicts with the system packages. Make sure to use this flag if you see errors similar to `error: externally-managed-environment`.",
code = """
id: before_commands_example
namespace: company.team
inputs:
- id: url
type: URI
defaults: https://jsonplaceholder.typicode.com/todos/1
tasks:
- id: transform
type: io.kestra.plugin.scripts.python.Script
taskRunner:
type: io.kestra.plugin.core.runner.Process
beforeCommands:
- pip install kestra requests --break-system-packages
script: |
import requests
from kestra import Kestra
url = "{{ inputs.url }}"
response = requests.get(url)
print('Status Code:', response.status_code)
Kestra.outputs(response.json())
""",
full = true
),
@Example(
title = "Pass input files to the task, execute a Shell command, then retrieve output files.",
code = """
Expand Down

0 comments on commit e483ee9

Please sign in to comment.