Skip to content

Commit

Permalink
feat(examples): standardise id naming format in examples (#4619)
Browse files Browse the repository at this point in the history
Co-authored-by: Will Russell <[email protected]>
  • Loading branch information
shrutimantri and wrussell1999 authored Sep 2, 2024
1 parent 97af1b5 commit 4c1020d
Show file tree
Hide file tree
Showing 25 changed files with 88 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
title = "Send a slack notification if there is no execution for a flow for the last 24 hours.",
full = true,
code = {
"id: executions-count",
"id: executions_count",
"namespace: company.team",
"",
"tasks:",
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/kestra/plugin/core/execution/Fail.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
title = "Fail on a switch branch",
full = true,
code = {
"id: fail-on-switch\n" +
"id: fail_on_switch\n" +
"namespace: company.team\n" +
"\n" +
"inputs:\n" +
Expand Down Expand Up @@ -65,7 +65,7 @@
title = "Fail on a condition",
full = true,
code = {
"id: fail-on-condition\n" +
"id: fail_on_condition\n" +
"namespace: company.team\n" +
"\n" +
"inputs:\n" +
Expand Down
18 changes: 9 additions & 9 deletions core/src/main/java/io/kestra/plugin/core/execution/Labels.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@
title = "Add labels based on a webhook payload",
full = true,
code = {
"id: webhook-based-labels",
"id: webhook_based_labels",
"namespace: company.team",
"tasks:",
" - id: update-labels-with-map",
" - id: update_labels_with_map",
" type: io.kestra.plugin.core.execution.Labels",
" labels:",
" customerId: \"{{trigger.body.customerId}}\"",
" - id: by-list",
" customerId: \"{{ trigger.body.customerId }}\"",
" - id: by_list",
" type: io.kestra.plugin.core.execution.Labels",
" labels:",
" - key: orderId",
" value: \"{{trigger.body.orderId}}\"",
" - key: orderType",
" value: \"{{trigger.body.orderType}}\"",
" - key: order_id",
" value: \"{{ trigger.body.orderId }}\"",
" - key: order_type",
" value: \"{{ trigger.body.orderType }}\"",
"triggers:",
" - id: webhook",
" key: order-webhook",
" key: order_webhook",
" type: io.kestra.plugin.core.trigger.Webhook",
" conditions:",
" - type: io.kestra.plugin.core.condition.ExpressionCondition",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@Example(
full = true,
code = {
"id: allow-failure",
"id: allow_failure",
"namespace: company.team",
"",
"tasks:",
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/kestra/plugin/core/flow/Dag.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
title = "Run a series of tasks for which the execution order is defined by their upstream dependencies.",
full = true,
code = """
id: dag-flow
id: dag_flow
namespace: company.team
tasks:
- id: dag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
@Example(
full = true,
code = {
"id: each-parallel",
"id: each_parallel",
"namespace: company.team",
"",
"tasks:",
" - id: each-parallel",
" - id: each_parallel",
" type: io.kestra.plugin.core.flow.EachParallel",
" value: '[\"value 1\", \"value 2\", \"value 3\"]'",
" tasks:",
" - id: each-value",
" - id: each_value",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} with current value '{{ taskrun.value }}'\"",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@
),
@Example(
full = true,
title = "This task shows that the value can be a bullet-style list. The task iterates over the list of values and executes the `each-value` child task for each value.",
title = "This task shows that the value can be a bullet-style list. The task iterates over the list of values and executes the `each_value` child task for each value.",
code = {
"id: each_sequential",
"id: each_sequential_flow",
"namespace: company.team",
"",
"tasks:",
" - id: each-sequential",
" - id: each_sequential",
" type: io.kestra.plugin.core.flow.EachSequential",
" value: ",
" - value 1",
" - value 2",
" - value 3",
" tasks:",
" - id: each-value",
" - id: each_value",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} with value '{{ taskrun.value }}'\"",
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/kestra/plugin/core/flow/Sequential.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
" - id: sequential",
" type: io.kestra.plugin.core.flow.Sequential",
" tasks:",
" - id: 1st",
" - id: first_task",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.startDate }}\"",
" - id: 2nd",
" - id: second_task",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.id }}\"",
" - id: last",
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/io/kestra/plugin/core/flow/Switch.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@
" value: \"{{ inputs.string }}\"",
" cases:",
" FIRST:",
" - id: 1st",
" - id: first",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.startDate }}\"",
" SECOND:",
" - id: 2nd",
" - id: second",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.startDate }}\"",
" THIRD:",
" - id: 3th",
" - id: third",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.startDate }}\"",
" defaults:",
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/io/kestra/plugin/core/flow/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@
"namespace: company.team",
"",
"inputs:",
" - id: with-string",
" - id: with_string",
" type: STRING",
"",
"tasks:",
" - id: 1-return",
" - id: 1_return",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.startDate }}\"",
" - id: 2-template",
" - id: 2_template",
" type: io.kestra.plugin.core.flow.Template",
" namespace: company.team",
" templateId: template",
" args:",
" my-forward: \"{{ inputs.with-string }}\"",
" - id: 3-end",
" my-forward: \"{{ inputs.with_string }}\"",
" - id: 3_end",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ task.id }} > {{ taskrun.startDate }}\"\n"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
full = true,
title = "Clone a Git repository into the Working Directory and run a Python script in a Docker container.",
code = """
id: gitPython
id: git_python
namespace: company.team
tasks:
- id: wdir
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: cloneRepository
- id: clone_repository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/examples
branch: main
Expand All @@ -84,7 +84,7 @@
full = true,
title = "Add input and output files within a Working Directory to use them in a Python script.",
code = """
id: apiJSONtoMongoDB
id: api_json_to_mongodb
namespace: company.team
tasks:
Expand All @@ -97,7 +97,7 @@
SELECT sum(total) as total, avg(quantity) as avg_quantity
FROM sales;
tasks:
- id: inlineScript
- id: inline_script
type: io.kestra.plugin.scripts.python.Script
taskRunner:
type: io.kestra.plugin.scripts.runner.docker.Docker
Expand All @@ -121,7 +121,7 @@ with open('output.json', 'w') as output_file:
Kestra.outputs({'receivedSQL': sql, 'status': response.status_code})
- id: loadToMongoDB
- id: load_to_mongodb
type: io.kestra.plugin.mongodb.Load
connection:
uri: mongodb://host.docker.internal:27017/
Expand All @@ -133,11 +133,11 @@ with open('output.json', 'w') as output_file:
@Example(
full = true,
code = {
"id: working-directory",
"id: working_directory",
"namespace: company.team",
"",
"tasks:",
" - id: working-directory",
" - id: working_directory",
" type: io.kestra.plugin.core.flow.WorkingDirectory",
" tasks:",
" - id: first",
Expand All @@ -155,10 +155,10 @@ with open('output.json', 'w') as output_file:
full = true,
title = "A working directory with a cache of the node_modules directory.",
code = """
id: node-with-cache
id: node_with_cache
namespace: company.team
tasks:
- id: working-dir
- id: working_dir
type: io.kestra.plugin.core.flow.WorkingDirectory
cache:
patterns:
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/kestra/plugin/core/http/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
full = true,
code = {
"""
id: http-trigger
id: http_trigger
namespace: company.team
triggers:
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/kestra/plugin/core/kv/Delete.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
code = """
id: delete_kv
type: io.kestra.plugin.core.kv.Delete
key: myvariable
key: my_variable
namespace: dev # the current namespace of the flow will be used by default"""
)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/kestra/plugin/core/kv/Get.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
@Plugin(
examples = {
@Example(
title = "Get value for `myvariable` key in `dev` namespace and fail if it's not present.",
title = "Get value for `my_variable` key in `dev` namespace and fail if it's not present.",
full = true,
code = """
id: get_kv
type: io.kestra.plugin.core.kv.Get
key: myvariable
key: my_variable
namespace: dev # the current namespace of the flow will be used by default
errorOnMissing: true"""
)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/kestra/plugin/core/kv/GetKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
@Plugin(
examples = {
@Example(
title = "Get keys that are prefixed by `myvar`.",
title = "Get keys that are prefixed by `my_var`.",
full = true,
code = """
id: keys_kv
type: io.kestra.plugin.core.kv.GetKeys
prefix: myvar
prefix: my_var
namespace: dev # the current namespace of the flow will be used by default"""
)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/kestra/plugin/core/kv/Set.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
@Plugin(
examples = {
@Example(
title = "Set `query` task `uri` output as value for `myvariable` key in `dev` namespace.",
title = "Set `query` task `uri` output as value for `my_variable` key in `dev` namespace.",
full = true,
code = """
id: set_kv
type: io.kestra.plugin.core.kv.Set
key: myvariable
key: my_variable
value: "{{ outputs.query.uri }}"
namespace: dev # the current namespace of the flow will be used by default
overwrite: true # whether to overwrite or fail if a value for that key already exists; default true
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/io/kestra/plugin/core/log/PurgeLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
code = {
"endDate: \"{{ now() | dateAdd(-1, 'MONTHS') }}\"",
"logLevels:",
"- TRACE",
"- DEBUG",
"- INFO",
"- WARN",
" - TRACE",
" - DEBUG",
" - INFO",
" - WARN",
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
full = true,
code = """
id: upload_dbt_project
namespace: dwh
namespace: company.team
tasks:
- id: wdir
type: io.kestra.plugin.core.flow.WorkingDirectory
Expand All @@ -87,7 +87,7 @@
full = true,
code = """
id: upload_a_file
namespace: dwh
namespace: company.team
tasks:
- id: download
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/io/kestra/plugin/core/runner/Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@Example(
title = "Execute a Shell command.",
code = """
id: new-shell
id: new_shell
namespace: company.team
tasks:
Expand All @@ -55,7 +55,7 @@
taskRunner:
type: io.kestra.plugin.core.runner.Process
commands:
- echo "Hello World\"""",
- echo "Hello World\"""",
full = true
),
@Example(
Expand Down Expand Up @@ -91,7 +91,7 @@
@Example(
title = "Pass input files to the task, execute a Shell command, then retrieve output files.",
code = """
id: new-shell-with-file
id: new_shell_with_file
namespace: company.team
inputs:
Expand All @@ -108,7 +108,7 @@
taskRunner:
type: io.kestra.plugin.core.runner.Process
commands:
- cp {{workingDir}}/data.txt {{workingDir}}/out.txt""",
- cp {{workingDir}}/data.txt {{workingDir}}/out.txt""",
full = true
)
}
Expand Down
Loading

0 comments on commit 4c1020d

Please sign in to comment.