Defining a temporary folder parameter - Cloud

Talend Cloud API Services Platform Studio User Guide

author
Talend Documentation Team
EnrichVersion
Cloud
EnrichProdName
Talend Cloud
task
Design and Development
EnrichPlatform
Talend Management Console
Talend Studio
You can design your Artifact in Studio to allow the use of a temporary folder during Task execution in Talend Cloud Management Console.

Before you begin

  • You have set a Talend Cloud license in the Studio.

About this task

Use this context parameter if a temporary folder is needed during the execution of the Task in Talend Cloud Management Console. The temporary folder is created before the Task is triggered and it is available to all actions in the Task. The folder is deleted after the Task is executed.

Procedure

  1. Create a Artifact with tFixedTaskInput components to generate two columns and two data rows, and use tFileOutputRaw components to write the data into two files.

    Use context variables to configure the components.

  2. Drop three tJobLog components from the palette to the design workspace:
  3. Link the first tJobLog to the first tFixedTaskInput with an OnSubjobOk link.
    Define the log message in tJobLog: "Working Folder is: " + context.resource_flow_temp_folder.
  4. Link the second and third tJobLog components to the tFileOutputRaw components with OnComponentOk links.
    Define the log messages: "Wrote file: " + ((String)globalMap.get("tFileOutputRaw_1_FILENAME_PATH")) and "Wrote File: " + ((String)globalMap.get("tFileOutputRaw_2_FILENAME_PATH")).
  5. Click the [+] button at the bottom of the Contexts view and add three lines to the table.

    If this tab is not visible in Studio, click Show view > Talend, and select Contexts.

  6. Define the context parameters, all in lower case:
    1. For the temporary file, follow the pattern resource_flow_temp_folder.
    2. Set the type of the parameter to String for this example, and set the path to the temporary folder in the Value field.
      You can set the parameter type to File or Directory according to your needs.
    3. For the files to be created, follow the pattern: parameter_<parameter_name>.
  7. Run the Artifact in the Studio to test it.
    The temporary folder is created with the two files in the directory you specified.
  8. Right-click the Artifact in the Repository tree view and select Publish to Cloud.
  9. Click Open Job Task when prompted.
  10. After setting the parameters, execute the Artifact in Talend Cloud Management Console.
  11. Review the log messages generated by the tJobLog components.
    The log messages show that a temporary folder was created during Task execution.