Package io.kestra.core.tasks.storages
Class LocalFiles
java.lang.Object
io.kestra.core.models.tasks.Task
io.kestra.core.tasks.storages.LocalFiles
- All Implemented Interfaces:
RunnableTask<LocalFiles.LocalFilesOutput>
@Example(full=true,title="Output local files created in a Python task and load them to S3",code="id: outputsFromPythonTask\nnamespace: dev\n\ntasks:\n - id: wdir\n type: io.kestra.core.tasks.flows.WorkingDirectory\n tasks:\n - id: cloneRepository\n type: io.kestra.plugin.git.Clone\n url: https://github.com/kestra-io/examples\n branch: main\n\n - id: gitPythonScripts\n type: io.kestra.plugin.scripts.python.Commands\n warningOnStdErr: false\n runner: DOCKER\n docker:\n image: ghcr.io/kestra-io/pydata:latest\n beforeCommands:\n - pip install faker > /dev/null\n commands:\n - python scripts/etl_script.py\n - python scripts/generate_orders.py\n\n - id: outputFile\n type: io.kestra.core.tasks.storages.LocalFiles\n outputs:\n - orders.csv\n - \"*.parquet\"\n\n - id: loadCsvToS3\n type: io.kestra.plugin.aws.s3.Upload\n accessKeyId: \"{{secret(\'AWS_ACCESS_KEY_ID\')}}\"\n secretKeyId: \"{{secret(\'AWS_SECRET_ACCESS_KEY\')}}\"\n region: eu-central-1\n bucket: kestraio\n key: stage/orders.csv\n from: \"{{outputs.outputFile.uris[\'orders.csv\']}}\"\n disabled: true\n") @Example(full=true,title="Create a local file that will be accessible to a bash task",code="id: \"local-files\"\nnamespace: \"io.kestra.tests\"\n\ntasks:\n - id: workingDir\n type: io.kestra.core.tasks.flows.WorkingDirectory\n tasks:\n - id: inputFiles\n type: io.kestra.core.tasks.storages.LocalFiles\n inputs:\n hello.txt: \"Hello World\\n\"\n address.json: \"{{ outputs.myTaskId.uri }}\"\n - id: bash\n type: io.kestra.plugin.scripts.shell.Commands\n commands:\n - cat hello.txt\n") @Example(full=true,title="Send local files to Kestra\'s internal storage",code="id: \"local-files\"\nnamespace: \"io.kestra.tests\"\n\ntasks:\n - id: workingDir\n type: io.kestra.core.tasks.flows.WorkingDirectory\n tasks:\n - id: bash\n type: io.kestra.plugin.scripts.shell.Commands\n commands:\n - mkdir -p sub/dir\n - echo \"Hello from Bash\" >> sub/dir/bash1.txt\n - echo \"Hello from Bash\" >> sub/dir/bash2.txt\n - id: outputFiles\n type: io.kestra.core.tasks.storages.LocalFiles\n outputs:\n - sub/**\n")
public class LocalFiles
extends Task
implements RunnableTask<LocalFiles.LocalFilesOutput>
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrun(RunContext runContext) Thsis method is called inside the Worker to run (execute) the task.Methods inherited from class io.kestra.core.models.tasks.Task
findById, findById, isFlowable, isSendToWorkerTask
-
Constructor Details
-
LocalFiles
public LocalFiles()
-
-
Method Details
-
run
Description copied from interface:RunnableTaskThsis method is called inside the Worker to run (execute) the task.- Specified by:
runin interfaceRunnableTask<LocalFiles.LocalFilesOutput>- Throws:
Exception
-