Skip to content

Commit

Permalink
doc: refine getting started start command for script tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-geller committed Nov 13, 2023
1 parent 7d5531f commit c04323e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/docs/01.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Start Kestra using Docker-Compose and create your first flow.

## Start Kestra

Make sure that Docker is running. Then, you can start Kestra in a single command using Docker.
Make sure that Docker is running. Then, you can start Kestra in a single command using Docker (*if you run it on Windows, make sure to use [WSL](https://docs.docker.com/desktop/wsl/)*):

```bash
docker run --rm -it -p 8080:8080 kestra/kestra:develop-full server local
docker run --pull=always --rm -it -p 8080:8080 --user=root -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp kestra/kestra:develop-full server local
```

Open [http://localhost:8080](http://localhost:8080) in your browser to launch the UI and start building your first flows.
Expand Down
43 changes: 43 additions & 0 deletions content/docs/02.tutorial/03.outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,49 @@ This example flow passed data between tasks using outputs. The `inputFiles` argu

To sum up, our flow extracts data from an API, uses that data in a Python script, executes a SQL query and generates a downloadable artifact.

::alert{type="info"}
If you encounter any issues while executing the above flow, this might be a Docker-related issue (e.g. Docker-in-Docker setup, which might be difficult to configure on Windows). Set the runner property to `PROCESS` to run the Python script task in the same process as the flow rather than in a Docker container, as shown in the example below. This will avoid any Docker-related issues.
::

```yaml
id: getting_started
namespace: dev
inputs:
- name: api_url
type: STRING
defaults: https://dummyjson.com/products
tasks:
- id: api
type: io.kestra.plugin.fs.http.Request
uri: "{{ inputs.api_url }}"
- id: python
type: io.kestra.plugin.scripts.python.Script
runner: PROCESS
beforeCommands:
- pip install polars
warningOnStdErr: false
script: |
import polars as pl
data = {{outputs.api.body | jq('.products') | first}}
df = pl.from_dicts(data)
df.glimpse()
df.select(["brand", "price"]).write_csv("{{outputDir}}/products.csv")
- id: sqlQuery
type: io.kestra.plugin.jdbc.duckdb.Query
inputFiles:
in.csv: "{{ outputs.python.outputFiles['products.csv'] }}"
sql: |
SELECT brand, round(avg(price), 2) as avg_price
FROM read_csv_auto('{{workingDir}}/in.csv', header=True)
GROUP BY brand
ORDER BY avg_price DESC;
store: true
```


::next-link
[Next, let's cover `triggers` to schedule the flow.](./04.triggers.md)
Expand Down

0 comments on commit c04323e

Please sign in to comment.