Class TaskExecutionController
java.lang.Object
org.springframework.cloud.dataflow.server.controller.TaskExecutionController
@RestController
@RequestMapping("/tasks/executions")
@ExposesResourceFor(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, Corneil du Plessis
-
Constructor Summary
ConstructorDescriptionTaskExecutionController
(DataflowTaskExplorer explorer, TaskExecutionService taskExecutionService, TaskDefinitionRepository taskDefinitionRepository, TaskExecutionInfoService taskExecutionInfoService, TaskDeleteService taskDeleteService, TaskJobService taskJobService) Creates aTaskExecutionController
that retrieves Task Execution information from a theTaskExplorer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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, Integer days) Cleanup resources associated with one or more task executions.long
Request the launching of an existing task definition.launchBoot3
(String taskName, String properties, String arguments) org.springframework.hateoas.PagedModel<TaskExecutionResource>
list
(org.springframework.data.domain.Pageable pageable, org.springframework.data.web.PagedResourcesAssembler<TaskJobExecutionRel> assembler) Return a page-able list ofTaskExecutionResource
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 specifiedvoid
Stop a set of task executions.View the details of a single task execution, specified by id.viewByExternal
(String externalExecutionId, String platform)
-
Constructor Details
-
TaskExecutionController
public TaskExecutionController(DataflowTaskExplorer explorer, TaskExecutionService taskExecutionService, TaskDefinitionRepository taskDefinitionRepository, TaskExecutionInfoService taskExecutionInfoService, TaskDeleteService taskDeleteService, TaskJobService taskJobService) Creates aTaskExecutionController
that retrieves Task Execution information from a theTaskExplorer
- Parameters:
explorer
- the explorer this controller will use for retrieving task execution information.taskExecutionService
- used to launch taskstaskDefinitionRepository
- the task definition repositorytaskExecutionInfoService
- the task execution information servicetaskDeleteService
- the task deletion servicetaskJobService
- the task job service
-
-
Method Details
-
list
@GetMapping("") @ResponseStatus(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 ofTaskExecutionResource
defined tasks.- Parameters:
pageable
- page-able collection ofTaskExecution
s.assembler
- for theTaskExecution
s- Returns:
- a list of task executions
-
retrieveTasksByName
@GetMapping(value="", params="name") @ResponseStatus(OK) public org.springframework.hateoas.PagedModel<TaskExecutionResource> retrieveTasksByName(@RequestParam("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 taskpageable
- page-able collection ofTaskExecution
s.assembler
- for theTaskExecution
s- Returns:
- the paged list of task executions
-
launch
@PostMapping(value="", params="name") @ResponseStatus(CREATED) public long launch(@RequestParam("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 pairsarguments
- the runtime commandline arguments- Returns:
- the taskExecutionId for the executed task
-
launchBoot3
@PostMapping(value="/launch", params="name") @ResponseStatus(CREATED) public LaunchResponseResource launchBoot3(@RequestParam("name") String taskName, @RequestParam(required=false) String properties, @RequestParam(required=false) String arguments) -
view
View the details of a single task execution, specified by id.- Parameters:
id
- the id of the requestedTaskExecution
- Returns:
- the
TaskExecution
-
viewByExternal
@GetMapping("/external/{externalExecutionId}") @ResponseStatus(OK) public TaskExecutionResource viewByExternal(@PathVariable String externalExecutionId, @RequestParam(required=false) String platform) -
getCurrentTaskExecutionsInfo
@GetMapping("/current") @ResponseStatus(OK) public Collection<CurrentTaskExecutionsResource> getCurrentTaskExecutionsInfo() -
cleanup
@DeleteMapping("/{id}") @ResponseStatus(OK) public void cleanup(@PathVariable("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 optionalactions
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 theTaskExecution
s to clean upactions
- Defaults to "CLEANUP" if not specified
-
cleanupAll
@DeleteMapping @ResponseStatus(OK) @Async("dataflowAsyncExecutor") public void cleanupAll(@RequestParam(defaultValue="CLEANUP",name="action") TaskExecutionControllerDeleteAction[] actions, @RequestParam(defaultValue="false") boolean completed, @RequestParam(defaultValue="",name="name") String taskName, @RequestParam(required=false) Integer days) Cleanup resources associated with one or more task executions. The optionalactions
andcompleted
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.When the
spring.cloud.dataflow.async.enabled
property is set totrue
the cleanup will happen asynchronously.- Parameters:
actions
- the actions to perform (default 'CLEANUP')completed
- whether to include only completed task executions (default false)taskName
- name of the task (default '')days
- only include tasks that have ended at least this many days ago (default null)
-
stop
@PostMapping("/{id}") @ResponseStatus(OK) public void stop(@PathVariable("id") Set<Long> ids, @RequestParam(defaultValue="") String platform) Stop a set of task executions.- Parameters:
ids
- the ids of theTaskExecution
s to stopplatform
- the platform name
-