org.springframework.cloud.dataflow.server.service.impl

## Class DefaultTaskExecutionService

- java.lang.Object
- - org.springframework.cloud.dataflow.server.service.impl.DefaultTaskExecutionService

- All Implemented Interfaces:
    TaskExecutionService

      @Transactional
      public class DefaultTaskExecutionService
      extends Object
      implements TaskExecutionService

  Default implementation of the `TaskExecutionService` interface. Provide service methods for Tasks.
  Author:
    Michael Minella, Marius Bogoevici, Glenn Renfro, Mark Fisher, Janne Valkealahti, Gunnar Hillert, Thomas Risberg, Ilayaperumal Gopinathan, Michael Wirth, David Turanski, Daniel Serleg

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.springframework.cloud.dataflow.audit.service.AuditRecordService` | `auditRecordService`
    `static String` | `COMMAND_LINE_ARGS`
    `static String` | `TASK_DEFINITION_DSL_TEXT`
    `static String` | `TASK_DEPLOYMENT_PROPERTIES`
    `static String` | `TASK_PLATFORM_NAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultTaskExecutionService(LauncherRepository launcherRepository, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, org.springframework.cloud.task.repository.TaskRepository taskRepository, TaskExecutionInfoService taskExecutionInfoService, TaskDeploymentRepository taskDeploymentRepository, TaskExecutionCreationService taskExecutionRepositoryService, TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator, org.springframework.cloud.task.repository.TaskExplorer taskExplorer, DataflowTaskExecutionDao dataflowTaskExecutionDao, DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao, org.springframework.cloud.common.security.core.support.OAuth2TokenUtilsService oauth2TokenUtilsService, TaskSaveService taskSaveService, TaskConfigurationProperties taskConfigurationProperties)` Deprecated.
    `DefaultTaskExecutionService(LauncherRepository launcherRepository, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, org.springframework.cloud.task.repository.TaskRepository taskRepository, TaskExecutionInfoService taskExecutionInfoService, TaskDeploymentRepository taskDeploymentRepository, TaskExecutionCreationService taskExecutionRepositoryService, TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator, org.springframework.cloud.task.repository.TaskExplorer taskExplorer, DataflowTaskExecutionDao dataflowTaskExecutionDao, DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao, org.springframework.cloud.common.security.core.support.OAuth2TokenUtilsService oauth2TokenUtilsService, TaskSaveService taskSaveService, TaskConfigurationProperties taskConfigurationProperties, ComposedTaskRunnerConfigurationProperties composedTaskRunnerConfigurationProperties)` Initializes the `DefaultTaskExecutionService`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `executeTask(String taskName, Map<String,String> taskDeploymentProperties, List<String> commandLineArgs)` Launch a task.
    `TaskManifest` | `findTaskManifestById(Long id)` Retrieve the TaskManifest for the execution id provided
    `Set<Long>` | `getAllTaskExecutionIds(boolean onlyCompleted, String taskName)` Returns all the task execution IDs with the option to include only the completed task executions.
    `Integer` | `getAllTaskExecutionsCount(boolean onlyCompleted, String taskName)` Returns the count of all the task execution IDs with the option to include only the completed task executions.
    `String` | `getLog(String platformName, String taskId)` Retrieve logs for the task application.
    `void` | `setAutoCreateTaskDefinitions(boolean autoCreateTaskDefinitions)`
    `void` | `stopTaskExecution(Set<Long> ids)` Request the platform to stop the task executions for the ids provided.
    `void` | `stopTaskExecution(Set<Long> ids, String platform)` Request the platform to stop the task executions for the ids provided.
    `protected void` | `updateExternalExecutionId(long executionId, String taskLaunchId)`

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

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

- - ### Field Detail

    - #### TASK_DEFINITION_DSL_TEXT

          public static final String TASK_DEFINITION_DSL_TEXT

      See Also:
        Constant Field Values

    - #### TASK_DEPLOYMENT_PROPERTIES

          public static final String TASK_DEPLOYMENT_PROPERTIES

      See Also:
        Constant Field Values

    - #### COMMAND_LINE_ARGS

          public static final String COMMAND_LINE_ARGS

      See Also:
        Constant Field Values

    - #### TASK_PLATFORM_NAME

          public static final String TASK_PLATFORM_NAME

      See Also:
        Constant Field Values

    - #### auditRecordService

          protected final org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService

  - ### Constructor Detail

    - #### DefaultTaskExecutionService

          @Deprecated
          public DefaultTaskExecutionService(LauncherRepository launcherRepository,
                                                         org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService,
                                                         org.springframework.cloud.task.repository.TaskRepository taskRepository,
                                                         TaskExecutionInfoService taskExecutionInfoService,
                                                         TaskDeploymentRepository taskDeploymentRepository,
                                                         TaskExecutionCreationService taskExecutionRepositoryService,
                                                         TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
                                                         org.springframework.cloud.task.repository.TaskExplorer taskExplorer,
                                                         DataflowTaskExecutionDao dataflowTaskExecutionDao,
                                                         DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
                                                         org.springframework.cloud.common.security.core.support.OAuth2TokenUtilsService oauth2TokenUtilsService,
                                                         TaskSaveService taskSaveService,
                                                         TaskConfigurationProperties taskConfigurationProperties)

      Deprecated.
      Initializes the `DefaultTaskExecutionService`.
      Parameters:
        `launcherRepository` - the repository of task launcher used to launch task apps.
        `auditRecordService` - the audit record service
        `taskRepository` - the repository to use for accessing and updating task executions
        `taskExecutionInfoService` - the task execution info service
        `taskDeploymentRepository` - the repository to track task deployment
        `taskExecutionInfoService` - the service used to setup a task execution
        `taskExecutionRepositoryService` - the service used to create the task execution
        `taskAppDeploymentRequestCreator` - the task app deployment request creator
        `taskExplorer` - the task explorer
        `dataflowTaskExecutionDao` - the dataflow task execution dao
        `dataflowTaskExecutionMetadataDao` - repository used to manipulate task manifests
        `oauth2TokenUtilsService` - the oauth2 token server
        `taskSaveService` - the task save service

    - #### DefaultTaskExecutionService

          public DefaultTaskExecutionService(LauncherRepository launcherRepository,
                                             org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService,
                                             org.springframework.cloud.task.repository.TaskRepository taskRepository,
                                             TaskExecutionInfoService taskExecutionInfoService,
                                             TaskDeploymentRepository taskDeploymentRepository,
                                             TaskExecutionCreationService taskExecutionRepositoryService,
                                             TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
                                             org.springframework.cloud.task.repository.TaskExplorer taskExplorer,
                                             DataflowTaskExecutionDao dataflowTaskExecutionDao,
                                             DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
                                             org.springframework.cloud.common.security.core.support.OAuth2TokenUtilsService oauth2TokenUtilsService,
                                             TaskSaveService taskSaveService,
                                             TaskConfigurationProperties taskConfigurationProperties,
                                             ComposedTaskRunnerConfigurationProperties composedTaskRunnerConfigurationProperties)

      Initializes the `DefaultTaskExecutionService`.
      Parameters:
        `launcherRepository` - the repository of task launcher used to launch task apps.
        `auditRecordService` - the audit record service
        `taskRepository` - the repository to use for accessing and updating task executions
        `taskExecutionInfoService` - the task execution info service
        `taskDeploymentRepository` - the repository to track task deployment
        `taskExecutionInfoService` - the service used to setup a task execution
        `taskExecutionRepositoryService` - the service used to create the task execution
        `taskAppDeploymentRequestCreator` - the task app deployment request creator
        `taskExplorer` - the task explorer
        `dataflowTaskExecutionDao` - the dataflow task execution dao
        `dataflowTaskExecutionMetadataDao` - repository used to manipulate task manifests
        `oauth2TokenUtilsService` - the oauth2 token server
        `taskSaveService` - the task save service
        `composedTaskRunnerConfigurationProperties` - properties used to configure the composed task runner

  - ### Method Detail

    - #### executeTask

          public long executeTask(String taskName,
                                  Map<String,String> taskDeploymentProperties,
                                  List<String> commandLineArgs)

      Launch a task.
      Specified by:
        `executeTask` in interface `TaskExecutionService`
      Parameters:
        `taskName` - Name of the task definition or registered task application. If a task definition does not exist, one will be created if `autoCreateTask-Definitions` is true. Must not be null or empty.
        `taskDeploymentProperties` - Optional deployment properties. Must not be null.
        `commandLineArgs` - Optional runtime commandline argument
      Returns:
        the task execution ID.

    - #### getLog

          public String getLog(String platformName,
                               String taskId)

      Description copied from interface: `TaskExecutionService`
      Retrieve logs for the task application.
      Specified by:
        `getLog` in interface `TaskExecutionService`
      Parameters:
        `platformName` - the name of the platform
        `taskId` - the ID that uniquely identifies the task
      Returns:
        the logs of the task application.

    - #### stopTaskExecution

          public void stopTaskExecution(Set<Long> ids)

      Description copied from interface: `TaskExecutionService`
      Request the platform to stop the task executions for the ids provided.
      Specified by:
        `stopTaskExecution` in interface `TaskExecutionService`
      Parameters:
        `ids` - a set of ids for the task executions to be stopped.

    - #### stopTaskExecution

          public void stopTaskExecution(Set<Long> ids,
                                        String platform)

      Description copied from interface: `TaskExecutionService`
      Request the platform to stop the task executions for the ids provided.
      Specified by:
        `stopTaskExecution` in interface `TaskExecutionService`
      Parameters:
        `ids` - a set of ids for the task executions to be stopped.
        `platform` - The name of the platform where the tasks are executing.

    - #### findTaskManifestById

          public TaskManifest findTaskManifestById(Long id)

      Description copied from interface: `TaskExecutionService`
      Retrieve the TaskManifest for the execution id provided
      Specified by:
        `findTaskManifestById` in interface `TaskExecutionService`
      Parameters:
        `id` - task exectution id
      Returns:
        `TaskManifest` or null if not found.

    - #### setAutoCreateTaskDefinitions

          public void setAutoCreateTaskDefinitions(boolean autoCreateTaskDefinitions)

    - #### updateExternalExecutionId

          protected void updateExternalExecutionId(long executionId,
                                                   String taskLaunchId)

    - #### getAllTaskExecutionIds

          public Set<Long> getAllTaskExecutionIds(boolean onlyCompleted,
                                                  String taskName)

      Description copied from interface: `TaskExecutionService`
      Returns all the task execution IDs with the option to include only the completed task executions.
      Specified by:
        `getAllTaskExecutionIds` in interface `TaskExecutionService`
      Parameters:
        `onlyCompleted` - filter by completed task executions
        `taskName` - the task name, if null then retrieve all the tasks

    - #### getAllTaskExecutionsCount

          public Integer getAllTaskExecutionsCount(boolean onlyCompleted,
                                                   String taskName)

      Description copied from interface: `TaskExecutionService`
      Returns the count of all the task execution IDs with the option to include only the completed task executions.
      Specified by:
        `getAllTaskExecutionsCount` in interface `TaskExecutionService`
      Parameters:
        `onlyCompleted` - filter by completed task executions
        `taskName` - the task name, if null then retrieve all the tasks

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