Skip to content

Commit

Permalink
fix(docs): doc correction in plugin script and plugin script groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutimantri authored and smantri-moveworks committed Jan 15, 2024
1 parent 8c9e613 commit 9ec3f94
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
@Getter
@NoArgsConstructor
@Schema(
title = "Execute a groovy script."
title = "Execute a Groovy script."
)
@Plugin(
examples = {
@Example(
full = true,
title = "Make an API call and pass request body to a Groovy script",
title = "Make an API call and pass request body to a Groovy script.",
code = """
id: api-request-to-groovy
namespace: dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Plugin(
examples = {
@Example(
title = "Convert every row by row with file from internal storage",
title = "Convert row by row of a file from Kestra's internal storage.",
code = {
"from: \"{{ outputs['avro-to-gcs'] }}\"",
"script: |",
Expand All @@ -31,7 +31,7 @@
}
),
@Example(
title = "Create multiple rows from one row",
title = "Create multiple rows from one row.",
code = {
"from: \"{{ outputs['avro-to-gcs'] }}\"",
"script: |",
Expand All @@ -40,9 +40,9 @@
}
),
@Example(
title = "Transform with file from json string",
title = "Transform a JSON string to a file.",
code = {
"from: \"[{\"name\":\"jane\"}, {\"name\":\"richard\"}]\"",
"from: \"[{\\\"name\\\":\\\"jane\\\"}, {\\\"name\":\\\"richard\\\"}]\"",
"script: |",
" logger.info('row: {}', row)",
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
abstract public class AbstractBash extends Task {
@Builder.Default
@Schema(
title = "The script runner — by default, Kestra runs all scripts in `DOCKER`."
title = "The script runner."
)
@PluginProperty
@NotNull
Expand All @@ -61,14 +61,14 @@ abstract public class AbstractBash extends Task {

@Builder.Default
@Schema(
title = "Interpreter args used"
title = "Interpreter arguments to be used."
)
@PluginProperty
protected String[] interpreterArgs = {"-c"};

@Builder.Default
@Schema(
title = "Exit if any non true value is returned",
title = "Exit if any non-true value is returned.",
description = "This tells bash that it should exit the script if any statement returns a non-true return value. \n" +
"Setting this to `true` helps catch cases where a command fails and the script continues to run anyway."
)
Expand All @@ -77,40 +77,40 @@ abstract public class AbstractBash extends Task {
protected Boolean exitOnFailed = true;

@Schema(
title = "The list of files that will be uploaded to internal storage, ",
description ="use `outputFiles` property instead",
title = "[Deprecated] The list of files that will be uploaded to Kestra's internal storage.",
description ="Use `outputFiles` instead.",
deprecated = true
)
@PluginProperty(dynamic = true)
@Deprecated
protected List<String> files;

@Schema(
title = "Deprecated Output file",
description = "use `outputFiles`",
title = "[Deprecated] Output files.",
description = "Use `outputFiles` instead.",
deprecated = true
)
@PluginProperty
@Deprecated
protected List<String> outputsFiles;

@Schema(
title = "Output file list that will be uploaded to internal storage",
description = "List of key that will generate temporary files.\n" +
"On the command, just can use with special variable named `outputFiles.key`.\n" +
"If you add a files with `[\"first\"]`, you can use the special vars `echo 1 >> {[ outputFiles.first }}`" +
" and you used on others tasks using `{{ outputs.taskId.outputFiles.first }}`"
title = "Output file list that will be uploaded to Kestra's internal storage.",
description = "List of keys that will generate temporary files.\n" +
"This property can be used with a special variable named `outputFiles.key`.\n" +
"If you add a file with `[\"first\"]`, you can use the special var `echo 1 >> {[ outputFiles.first }}`," +
" and on other tasks, you can reference it using `{{ outputs.taskId.outputFiles.first }}`."
)
@PluginProperty
protected List<String> outputFiles;

@Schema(
title = "List of output directories that will be uploaded to internal storage",
title = "List of output directories that will be uploaded to Kestra's internal storage.",
description = "List of keys that will generate temporary directories.\n" +
"On the command, just can use with special variable named `outputDirs.key`.\n" +
"If you add a files with `[\"myDir\"]`, you can use the special vars `echo 1 >> {[ outputDirs.myDir }}/file1.txt` " +
"and `echo 2 >> {[ outputDirs.myDir }}/file2.txt` and both files will be uploaded to internal storage." +
" Then you can used them on others tasks using `{{ outputs.taskId.outputFiles['myDir/file1.txt'] }}`"
"This property can be used with a special variable named `outputDirs.key`.\n" +
"If you add a file with `[\"myDir\"]`, you can use the special var `echo 1 >> {[ outputDirs.myDir }}/file1.txt` " +
"and `echo 2 >> {[ outputDirs.myDir }}/file2.txt`, and both the files will be uploaded to Kestra's internal storage. " +
"You can reference them in other tasks using `{{ outputs.taskId.outputFiles['myDir/file1.txt'] }}`."
)
@PluginProperty
protected List<String> outputDirs;
Expand All @@ -119,7 +119,8 @@ abstract public class AbstractBash extends Task {
title = "Input files are extra files that will be available in the script's working directory.",
description = "Define the files **as a map** of a file name being the key, and the value being the file's content.\n" +
"Alternatively, configure the files **as a JSON string** with the same key/value structure as the map.\n" +
"In both cases, you can either specify the file's content inline, or reference a file from Kestra's internal storage by its URI, e.g. a file from an input, output of a previous task, or a [namespace file](https://kestra.io/docs/developer-guide/namespace-files)."
"In both cases, you can either specify the file's content inline, or reference a file from Kestra's internal " +
"storage by its URI, e.g. a file from an input, output of a previous task, or a [Namespace File](https://kestra.io/docs/developer-guide/namespace-files)."
)
@PluginProperty(
additionalProperties = String.class,
Expand All @@ -138,7 +139,7 @@ abstract public class AbstractBash extends Task {

@Builder.Default
@Schema(
title = "Whether to set the execution state in `WARNING` if any `stdErr` is sent."
title = "Whether to set the execution state to `WARNING` if any `stdErr` is emitted."
)
@PluginProperty
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@
@Deprecated
public class ScriptOutput implements io.kestra.core.models.tasks.Output {
@Schema(
title = "The value extract from output of the commands"
title = "The value extracted from the output of the commands."
)
private final Map<String, Object> vars;

@Schema(
title = "The standard output line count"
title = "The standard output line count."
)
private final int stdOutLineCount;

@Schema(
title = "The standard error line count"
title = "The standard error line count."
)
private final int stdErrLineCount;

@Schema(
title = "The exit code of the whole execution"
title = "The exit code of the whole execution."
)
@NotNull
private final int exitCode;

@Schema(
title = "Deprecated output files",
description = "use `outputFiles`",
title = "[Deprecated] Output files.",
description = "Use `outputFiles` instead.",
deprecated = true
)
@Deprecated
@PluginProperty(additionalProperties = URI.class)
private final Map<String, URI> files;

@Schema(
title = "The output files uri in Kestra internal storage"
title = "The output files' URIs in Kestra's internal storage."
)
@PluginProperty(additionalProperties = URI.class)
private final Map<String, URI> outputFiles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
public abstract class AbstractExecScript extends Task implements RunnableTask<ScriptOutput>, NamespaceFilesInterface, InputFilesInterface, OutputFilesInterface {
@Builder.Default
@Schema(
title = "Which script runner to use — by default, Kestra runs all scripts in `DOCKER`."
title = "The script runner to use — by default, Kestra runs all scripts in `DOCKER`."
)
@PluginProperty
@NotNull
@NotEmpty
protected RunnerType runner = RunnerType.DOCKER;

@Schema(
title = "A list of commands that will run before the `commands`, allowing to set up the environment e.g. `pip install -r requirements.txt`"
title = "A list of commands that will run before the `commands`, allowing to set up the environment e.g. `pip install -r requirements.txt`."
)
@PluginProperty(dynamic = true)
protected List<String> beforeCommands;
Expand All @@ -49,15 +49,15 @@ public abstract class AbstractExecScript extends Task implements RunnableTask<Sc

@Builder.Default
@Schema(
title = "Set the task state to `WARNING`if any `stdErr` is emitted"
title = "Whether to set the task state to `WARNING` if any `stdErr` is emitted."
)
@PluginProperty
@NotNull
protected Boolean warningOnStdErr = true;

@Builder.Default
@Schema(
title = "Which interpreter to use"
title = "Which interpreter to use."
)
@PluginProperty
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
@Introspected
public class DockerOptions {
@Schema(
title = "Docker api uri"
title = "Docker API URI."
)
@PluginProperty(dynamic = true)
private String host;

@Schema(
title = "Docker config file",
description = "Docker configuration file that can set access credentials to private container registries. Usually located in `~/.docker/config.json`",
title = "Docker configuration file.",
description = "Docker configuration file that can set access credentials to private container registries. Usually located in `~/.docker/config.json`.",
anyOf = {String.class, Map.class}
)
@PluginProperty(dynamic = true)
Expand All @@ -39,27 +39,27 @@ public class DockerOptions {
private Credentials credentials;

@Schema(
title = "Docker image to use"
title = "Docker image to use."
)
@PluginProperty(dynamic = true)
@NotNull
@NotEmpty
protected String image;

@Schema(
title = "User within the container"
title = "User in the Docker container."
)
@PluginProperty(dynamic = true)
protected String user;

@Schema(
title = "Docker entrypoint to use"
title = "Docker entrypoint to use."
)
@PluginProperty(dynamic = true)
protected List<String> entryPoint;

@Schema(
title = "Extra hostname mappings to the container network interface configuration"
title = "Extra hostname mappings to the container network interface configuration."
)
@PluginProperty(dynamic = true)
protected List<String> extraHosts;
Expand All @@ -71,23 +71,23 @@ public class DockerOptions {
protected String networkMode;

@Schema(
title = "List of volumes to mount",
description = "Must be a valid mount expression as string, example : `/home/user:/app`\n\n" +
"Volumes mount are disabled by default for security reasons; you must enable them on server configuration by setting `kestra.tasks.scripts.docker.volume-enabled` to `true`"
title = "List of volumes to mount.",
description = "Must be a valid mount expression as string, example : `/home/user:/app`.\n\n" +
"Volumes mount are disabled by default for security reasons; you must enable them on server configuration by setting `kestra.tasks.scripts.docker.volume-enabled` to `true`."
)
@PluginProperty(dynamic = true)
protected List<String> volumes;

@Schema(
title = "The pull policy for an image",
title = "The pull policy for an image.",
description = "Pull policy can be used to prevent pulling of an already existing image `IF_NOT_PRESENT`, or can be set to `ALWAYS` to pull the latest version of the image even if an image with the same tag already exists."
)
@PluginProperty
@Builder.Default
protected PullPolicy pullPolicy = PullPolicy.ALWAYS;

@Schema(
title = "A list of device requests to be sent to device drivers"
title = "A list of device requests to be sent to device drivers."
)
@PluginProperty(dynamic = false)
protected List<DeviceRequest> deviceRequests;
Expand All @@ -113,14 +113,14 @@ public class DockerOptions {

@Schema(
title = "Size of `/dev/shm` in bytes.",
description = "The size must be greater than 0. If omitted the system uses 64MB."
description = "The size must be greater than 0. If omitted, the system uses 64MB."
)
@PluginProperty(dynamic = true)
private String shmSize;

@Introspected
@Schema(
title = "The PullPolicy for a container and the tag of the image affect when docker attempts to pull (download) the specified image."
title = "The image pull policy for a container image and the tag of the image, which affect when Docker attempts to pull (download) the specified image."
)
public enum PullPolicy {
IF_NOT_PRESENT,
Expand All @@ -137,8 +137,8 @@ public enum PullPolicy {
)
public static class Credentials {
@Schema(
title = "The registry url.",
description = "if not defined, the registry will be extracted from the image name."
title = "The registry URL.",
description = "If not defined, the registry will be extracted from the image name."
)
@PluginProperty(dynamic = true)
private String registry;
Expand Down Expand Up @@ -168,7 +168,7 @@ public static class Credentials {
private String identityToken;

@Schema(
title = "The registry auth.",
title = "The registry authentication.",
description = "The `auth` field is a base64-encoded authentication string of `username:password` or a token."
)
@PluginProperty(dynamic = true)
Expand All @@ -180,7 +180,7 @@ public static class Credentials {
@Getter
@Introspected
@Schema(
title = "A request for devices to be sent to device drivers"
title = "A request for devices to be sent to device drivers."
)
public static class DeviceRequest {
@PluginProperty(dynamic = true)
Expand Down Expand Up @@ -213,7 +213,7 @@ public static class DeviceRequest {
public static class Cpu {
@Schema(
title = "The maximum amount of CPU resources a container can use.",
description = "For instance, if the host machine has two CPUs and you set `cpus:\"1.5\"`, the container is guaranteed at most one and a half of the CPUs"
description = "For instance, if the host machine has two CPUs and you set `cpus:\"1.5\"`, the container is guaranteed at most one and a half of the CPUs."
)
@PluginProperty
private Long cpus;
Expand All @@ -226,13 +226,13 @@ public static class Cpu {
public static class Memory {
@Schema(
title = "The maximum amount of memory resources the container can use.",
description = "That is, you must set the value to at least 6 megabytes."
description = "It is recommended that you set the value to at least 6 megabytes."
)
@PluginProperty(dynamic = true)
private String memory;

@Schema(
title = "The amount of memory this container is allowed to swap to disk",
title = "The amount of memory this container is allowed to swap to disk.",
description = "If `memory` and `memorySwap` are set to the same value, this prevents containers from " +
"using any swap. This is because `memorySwap` is the amount of combined memory and swap that can be " +
"used, while `memory` is only the amount of physical memory that can be used."
Expand All @@ -241,15 +241,15 @@ public static class Memory {
private String memorySwap;

@Schema(
title = "The amount of memory this container is allowed to swap to disk",
title = "The amount of memory this container is allowed to swap to disk.",
description = "By default, the host kernel can swap out a percentage of anonymous pages used by a " +
"container. You can set `memorySwappiness` to a value between 0 and 100, to tune this percentage."
)
@PluginProperty(dynamic = true)
private String memorySwappiness;

@Schema(
title = "Allows you to specify a soft limit smaller than --memory which is activated when Docker detects contention or low memory on the host machine.",
title = "Allows you to specify a soft limit smaller than `memory` which is activated when Docker detects contention or low memory on the host machine.",
description = "If you use `memoryReservation`, it must be set lower than `memory` for it to take precedence. " +
"Because it is a soft limit, it does not guarantee that the container doesn’t exceed the limit."
)
Expand Down
Loading

0 comments on commit 9ec3f94

Please sign in to comment.