Getting Started with Task Processing
In this guide, we create a simple task definition and launch the task.
We will start with a pre-packaged task application, which is basically a hello-world-style application that logs the current timestamp. For this guide, we assume that the respective timestamp
task application has already been imported and registered with Spring Cloud Data Flow, as described in Short Lived Applications.
For a refresher, it can be registered by executing the following Dataflow shell command:
dataflow:> app register --name timestamp --type task --uri maven://io.spring:timestamp-task:2.0.2
Creating the Task
To create a task:
- In the menu, click Tasks.
-
Click the CREATE TASK button.
-
In the text area, type
timestamp
. This creates a simple task definition that uses the Timestamp task application. The following image shows the Timestamp application:Alternatively, you could have also dragged the Timestamp application from the apps palette on the left to the Flo canvas and connected
START
andEND
with the task application. - Click
Create Task
. -
Enter
timestamp-task
as the name, as follows: -
Click the
CREATE THE TASK
button.The Task Definitions page appears and lists the created definition (
timestamp-task
), as follows:
Running the Task
Now that you have created a task definition, you can run it. To do so:
-
Click the drop down control on the
timestamp-task
definition row and click the Launch option, as follows:The UI lets you provide additional:
- Properties: Additional properties meant for a
TaskLauncher
. - Arguments: Any properties that need to be passed as command-line arguments.
- Properties: Additional properties meant for a
-
As we do not need to provide additional argument or parameters, click the LAUNCH TASK button. The UI returns to the task execution page. For now lets select the
Tasks
option on the left side of the page. This will bring us back to the Task Definition page as follows:
After a few moments, the task definition should show a status of "COMPLETE". You may need to press the REFRESH button to see the updated status.
Verifying the Output
To verify that the output is what you expect:
-
Click on the Task executions tab, as follows:
You can see your task application with an exit code of
0
, indicating a successful execution. -
Click on the
Execution ID
on the row to see even more details, as follows:
If you would also like to see the timestamp log, click the VIEW LOG button on the bottom of the page: