org.springframework.cloud.dataflow.server.controller

## Class TaskExecutionController

- java.lang.Object
- - org.springframework.cloud.dataflow.server.controller.TaskExecutionController

-     @RestController
       @RequestMapping(value="/tasks/executions")
       @ExposesResourceFor(value=TaskExecutionResource.class)
      public class TaskExecutionController
      extends Object

  Controller for operations on `TaskExecution`. This includes obtaining task execution information from the task explorer.
  Author:
    Glenn Renfro, Michael Minella, Ilayaperumal Gopinathan, Christian Tzolov, David Turanski, Gunnar Hillert

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskExecutionController(org.springframework.cloud.task.repository.TaskExplorer explorer, TaskExecutionService taskExecutionService, TaskDefinitionRepository taskDefinitionRepository, TaskExecutionInfoService taskExecutionInfoService, TaskDeleteService taskDeleteService, TaskJobService taskJobService)` Creates a `TaskExecutionController` that retrieves Task Execution information from a the `TaskExplorer`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanup(Set<Long> ids, TaskExecutionControllerDeleteAction[] actions)` Cleanup resources associated with one or more task executions, specified by id(s).
    `void` | `cleanupAll(TaskExecutionControllerDeleteAction[] actions, boolean completed, String taskName)` Cleanup resources associated with one or more task executions.
    `Collection<CurrentTaskExecutionsResource>` | `getCurrentTaskExecutionsInfo()`
    `long` | `launch(String taskName, String properties, String arguments)` Request the launching of an existing task definition.
    `org.springframework.hateoas.PagedModel<TaskExecutionResource>` | `list(org.springframework.data.domain.Pageable pageable, org.springframework.data.web.PagedResourcesAssembler<TaskJobExecutionRel> assembler)` Return a page-able list of `TaskExecutionResource` defined tasks.
    `org.springframework.hateoas.PagedModel<TaskExecutionResource>` | `retrieveTasksByName(String taskName, org.springframework.data.domain.Pageable pageable, org.springframework.data.web.PagedResourcesAssembler<TaskJobExecutionRel> assembler)` Retrieve all task executions with the task name specified
    `void` | `stop(Set<Long> ids, String platform)` Stop a set of task executions.
    `TaskExecutionResource` | `view(long id)` View the details of a single task execution, specified by id.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TaskExecutionController

          public TaskExecutionController(org.springframework.cloud.task.repository.TaskExplorer explorer,
                                         TaskExecutionService taskExecutionService,
                                         TaskDefinitionRepository taskDefinitionRepository,
                                         TaskExecutionInfoService taskExecutionInfoService,
                                         TaskDeleteService taskDeleteService,
                                         TaskJobService taskJobService)

      Creates a `TaskExecutionController` that retrieves Task Execution information from a the `TaskExplorer`
      Parameters:
        `explorer` - the explorer this controller will use for retrieving task execution information.
        `taskExecutionService` - used to launch tasks
        `taskDefinitionRepository` - the task definition repository
        `taskExecutionInfoService` - the task execution information service
        `taskDeleteService` - the task deletion service
        `taskJobService` - the task job service

  - ### Method Detail

    - #### list

          @RequestMapping(value="",
                          method=GET)
           @ResponseStatus(value=OK)
          public org.springframework.hateoas.PagedModel<TaskExecutionResource> list(org.springframework.data.domain.Pageable pageable,
                                                                                                                                                                     org.springframework.data.web.PagedResourcesAssembler<TaskJobExecutionRel> assembler)

      Return a page-able list of `TaskExecutionResource` defined tasks.
      Parameters:
        `pageable` - page-able collection of `TaskExecution`s.
        `assembler` - for the `TaskExecution`s
      Returns:
        a list of task executions

    - #### retrieveTasksByName

          @RequestMapping(value="",
                          method=GET,
                          params="name")
           @ResponseStatus(value=OK)
          public org.springframework.hateoas.PagedModel<TaskExecutionResource> retrieveTasksByName(@RequestParam(value="name")
                                                                                                                                                                                                                   String taskName,
                                                                                                                                                                                                                   org.springframework.data.domain.Pageable pageable,
                                                                                                                                                                                                                   org.springframework.data.web.PagedResourcesAssembler<TaskJobExecutionRel> assembler)

      Retrieve all task executions with the task name specified
      Parameters:
        `taskName` - name of the task
        `pageable` - page-able collection of `TaskExecution`s.
        `assembler` - for the `TaskExecution`s
      Returns:
        the paged list of task executions

    - #### launch

          @RequestMapping(value="",
                          method=POST,
                          params="name")
           @ResponseStatus(value=CREATED)
          public long launch(@RequestParam(value="name")
                                                                                                                                                   String taskName,
                                                                                                                                                   @RequestParam(required=false)
                                                                                                                                                   String properties,
                                                                                                                                                   @RequestParam(required=false)
                                                                                                                                                   String arguments)

      Request the launching of an existing task definition. The task definition will be created from a registered task application if `spring.cloud.dataflow.task.auto-create-task-definitions` is true. The name must be included in the path.
      Parameters:
        `taskName` - the name of the task to be executed (required)
        `properties` - the runtime properties for the task, as a comma-delimited list of key=value pairs
        `arguments` - the runtime commandline arguments
      Returns:
        the taskExecutionId for the executed task

    - #### view

          @RequestMapping(value="/{id}",
                          method=GET)
           @ResponseStatus(value=OK)
          public TaskExecutionResource view(@PathVariable(value="id")
                                                                                                                                  long id)

      View the details of a single task execution, specified by id.
      Parameters:
        `id` - the id of the requested `TaskExecution`
      Returns:
        the `TaskExecution`

    - #### getCurrentTaskExecutionsInfo

          @RequestMapping(value="/current",
                          method=GET)
           @ResponseStatus(value=OK)
          public Collection<CurrentTaskExecutionsResource> getCurrentTaskExecutionsInfo()

    - #### cleanup

          @RequestMapping(value="/{id}",
                          method=DELETE)
           @ResponseStatus(value=OK)
          public void cleanup(@PathVariable(value="id")
                                                                                                                       Set<Long> ids,
                                                                                                                       @RequestParam(defaultValue="CLEANUP",name="action")
                                                                                                                       TaskExecutionControllerDeleteAction[] actions)

      Cleanup resources associated with one or more task executions, specified by id(s). The optional `actions` parameter can be used to not only clean up task execution resources, but can also trigger the deletion of task execution and job data in the persistence store.
      Parameters:
        `ids` - The id of the `TaskExecution`s to clean up
        `actions` - Defaults to "CLEANUP" if not specified

    - #### cleanupAll

          @RequestMapping(method=DELETE)
           @ResponseStatus(value=OK)
          public void cleanupAll(@RequestParam(defaultValue="CLEANUP",name="action")
                                                                                           TaskExecutionControllerDeleteAction[] actions,
                                                                                           @RequestParam(defaultValue="false",name="completed")
                                                                                           boolean completed,
                                                                                           @RequestParam(defaultValue="",name="name")
                                                                                           String taskName)

      Cleanup resources associated with one or more task executions. The optional `actions` and `completed` parameters can be used to not only clean up task execution resources, but can also trigger the deletion of task execution and job data in the persistence store.
      Parameters:
        `actions` - Defaults to "CLEANUP" if not specified
        `completed` - Defaults to cleanup only completed task executions

    - #### stop

          @RequestMapping(value="/{id}",
                          method=POST)
           @ResponseStatus(value=OK)
          public void stop(@PathVariable(value="id")
                                                                                                                  Set<Long> ids,
                                                                                                                  @RequestParam(defaultValue="",name="platform")
                                                                                                                  String platform)

      Stop a set of task executions.
      Parameters:
        `ids` - the ids of the `TaskExecution`s to stop
        `platform` - the platform name

Copyright © 2021 Pivotal Software, Inc.. All rights reserved.