Documentation ¶
Index ¶
- func CancelTask(taskID string) error
- func CheckAndSetTaskErrorMessage(taskID, errorMessage string, overwriteExisting bool) error
- func CheckTaskStepStatusChange(before, after string) (bool, error)
- func DeleteTask(taskID string) error
- func EmitTaskEventWithContextualLogs(ctx context.Context, deploymentID, taskID string, taskType TaskType, ...) (string, error)
- func GetAllTaskData(taskID string) (map[string]string, error)
- func GetInstances(ctx context.Context, taskID, deploymentID, nodeName string) ([]string, error)
- func GetQueryTaskIDs(taskType TaskType, query string, target string) ([]string, error)
- func GetTaskCreationDate(taskID string) (time.Time, error)
- func GetTaskData(taskID, dataName string) (string, error)
- func GetTaskErrorMessage(taskID string) (string, error)
- func GetTaskInput(taskID, inputName string) (string, error)
- func GetTaskOutput(taskID, outputName string) (string, error)
- func GetTaskOutputs(taskID string) (map[string]string, error)
- func GetTaskRelatedNodes(taskID string) ([]string, error)
- func GetTaskResultSet(taskID string) (string, error)
- func GetTaskTarget(taskID string) (string, error)
- func GetTasksIdsForTarget(targetID string) ([]string, error)deprecated
- func HasLivingTasks(taskIDs []string, tasksTypesToIgnore []TaskType) (bool, string, string, error)
- func IsAnotherLivingTaskAlreadyExistsError(err error) (bool, string)
- func IsDeploymentRelatedTask(tt TaskType) bool
- func IsStepRegistrationInProgress(taskID string) (bool, error)
- func IsTaskDataNotFoundError(err error) bool
- func IsTaskNotFoundError(err error) bool
- func IsTaskRelatedNode(taskID, nodeName string) (bool, error)
- func IsWorkflowTask(taskType TaskType) bool
- func MonitorTaskCancellation(ctx context.Context, taskID string, f func())
- func MonitorTaskFailure(ctx context.Context, taskID string, f func())
- func NewAnotherLivingTaskAlreadyExistsError(taskID, targetID, status string) error
- func NotifyErrorOnTask(taskID string) error
- func SetTaskData(taskID, dataName, dataValue string) error
- func SetTaskDataList(taskID string, data map[string]string) error
- func SetTaskErrorMessage(taskID, errorMessage string) error
- func StoreOperations(taskID string, operations api.KVTxnOps) error
- func TargetHasLivingTasks(targetID string, tasksTypesToIgnore []TaskType) (bool, string, string, error)deprecated
- func TaskExists(taskID string) (bool, error)
- func TaskHasCancellationFlag(taskID string) (bool, error)
- func TaskHasErrorFlag(taskID string) (bool, error)
- func UpdateTaskStepStatus(taskID string, step *TaskStep) error
- func UpdateTaskStepWithStatus(taskID, stepName string, status TaskStepStatus) error
- type TaskStatus
- type TaskStep
- type TaskStepStatus
- type TaskType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAndSetTaskErrorMessage ¶ added in v4.0.1
CheckAndSetTaskErrorMessage sets a task related error message.
This function check for an existing message and overwrite it only if requested.
func CheckTaskStepStatusChange ¶
CheckTaskStepStatusChange checks if a status change is allowed
func EmitTaskEventWithContextualLogs ¶
func EmitTaskEventWithContextualLogs(ctx context.Context, deploymentID, taskID string, taskType TaskType, workflowName, status string) (string, error)
EmitTaskEventWithContextualLogs emits a task event based on task type
func GetAllTaskData ¶
GetAllTaskData returns all registered data for a task
func GetInstances ¶
GetInstances retrieve instances in the context of this task.
Basically it checks if a list of instances is defined for this task for example in case of scaling. If not found it will returns the result of deployments.GetNodeInstancesIds(kv, deploymentID, nodeName).
func GetQueryTaskIDs ¶
GetQueryTaskIDs returns an array of taskID query-typed, optionally filtered by query and target
func GetTaskCreationDate ¶
GetTaskCreationDate retrieves the creationDate of a task
func GetTaskData ¶
GetTaskData retrieves data for tasks
func GetTaskErrorMessage ¶
GetTaskErrorMessage retrieves the task related error message if any.
If no error message is found, an empty string is returned instead
func GetTaskInput ¶
GetTaskInput retrieves inputs for tasks
func GetTaskOutput ¶
GetTaskOutput retrieves a specified output with name outputName for tasks
func GetTaskOutputs ¶
GetTaskOutputs retrieves all outputs for tasks
func GetTaskRelatedNodes ¶
GetTaskRelatedNodes returns the list of nodes that are specifically targeted by this task
Currently it only appens for scaling tasks
func GetTaskResultSet ¶
GetTaskResultSet retrieves the task related resultSet in json string format
If no resultSet is found, nil is returned instead
func GetTaskTarget ¶
GetTaskTarget retrieves the targetID of a task
func GetTasksIdsForTarget
deprecated
func HasLivingTasks ¶ added in v4.0.3
HasLivingTasks checks if the tasks list contains tasks in status INITIAL or RUNNING and returns the id and status of the first one found
The last argument specifies tasks types which should be ignored.
func IsAnotherLivingTaskAlreadyExistsError ¶
IsAnotherLivingTaskAlreadyExistsError checks if an error is due to the fact that another task is currently running If true, it returns the taskID of the currently running task
func IsDeploymentRelatedTask ¶ added in v4.0.3
IsDeploymentRelatedTask returns true if the task is related to a deployment
Typically query and action tasks are not necessary related to a deployment.
func IsStepRegistrationInProgress ¶
IsStepRegistrationInProgress checks if a task registration is still in progress, in which case it should not yet be executed
func IsTaskDataNotFoundError ¶
IsTaskDataNotFoundError checks if an error is a task data not found error
func IsTaskNotFoundError ¶
IsTaskNotFoundError checks if an error is a task not found error
func IsTaskRelatedNode ¶
IsTaskRelatedNode checks if the given nodeName is declared as a task related node
func IsWorkflowTask ¶
IsWorkflowTask returns true if the task type is related to workflow
func MonitorTaskCancellation ¶
MonitorTaskCancellation runs a routine that will constantly check if a given task is requested to be cancelled
If so and if the given f function is not nil then f is called and the routine stop itself. To stop this routine the given context should be cancelled.
func MonitorTaskFailure ¶
MonitorTaskFailure runs a routine that will constantly check if a given task is tagged as failed.
If so and if the given f function is not nil then f is called and the routine stop itself. To stop this routine the given context should be cancelled.
func NewAnotherLivingTaskAlreadyExistsError ¶
NewAnotherLivingTaskAlreadyExistsError allows to create a new anotherLivingTaskAlreadyExistsError error
func NotifyErrorOnTask ¶
NotifyErrorOnTask sets a flag that is used to notify task executors that a part of the task failed.
MonitorTaskFailure can be used to be notified.
func SetTaskData ¶
SetTaskData sets a data in the task's context
func SetTaskDataList ¶
SetTaskDataList sets a list of data into the task's context
func SetTaskErrorMessage ¶
SetTaskErrorMessage sets a task related error message.
Set task error message even if it already contains a value. For a better control on gracefully setting this error message use CheckAndSetTaskErrorMessage
func StoreOperations ¶
StoreOperations stores operations related to a task through a transaction splitting this transaction if needed, in which case it will create a key notifying a registration is in progress
func TargetHasLivingTasks
deprecated
func TargetHasLivingTasks(targetID string, tasksTypesToIgnore []TaskType) (bool, string, string, error)
TargetHasLivingTasks checks if a targetID has associated tasks in status INITIAL or RUNNING and returns the id and status of the first one found
The last argument specifies tasks types which should be ignored.
Deprecated: Prefer HasLivingTasks() instead
func TaskExists ¶
TaskExists checks if a task with the given taskID exists
func TaskHasCancellationFlag ¶
TaskHasCancellationFlag check if a task has was flagged as canceled
func TaskHasErrorFlag ¶
TaskHasErrorFlag check if a task has was flagged as error
func UpdateTaskStepStatus ¶
UpdateTaskStepStatus allows to update the task step status
func UpdateTaskStepWithStatus ¶
func UpdateTaskStepWithStatus(taskID, stepName string, status TaskStepStatus) error
UpdateTaskStepWithStatus allows to update the task step status
Types ¶
type TaskStatus ¶
type TaskStatus int
TaskStatus is an enumerated type for tasks statuses
ENUM( INITIAL RUNNING DONE FAILED CANCELED )
const ( // TaskStatusINITIAL is a TaskStatus of type INITIAL TaskStatusINITIAL TaskStatus = iota // TaskStatusRUNNING is a TaskStatus of type RUNNING TaskStatusRUNNING // TaskStatusDONE is a TaskStatus of type DONE TaskStatusDONE // TaskStatusFAILED is a TaskStatus of type FAILED TaskStatusFAILED // TaskStatusCANCELED is a TaskStatus of type CANCELED TaskStatusCANCELED )
func GetTaskStatus ¶
func GetTaskStatus(taskID string) (TaskStatus, error)
GetTaskStatus retrieves the TaskStatus of a task
func ParseTaskStatus ¶
func ParseTaskStatus(name string) (TaskStatus, error)
ParseTaskStatus attempts to convert a string to a TaskStatus
func (TaskStatus) String ¶
func (x TaskStatus) String() string
String implements the Stringer interface.
type TaskStep ¶
TaskStep represents a step related to a workflow
func GetTaskRelatedSteps ¶
GetTaskRelatedSteps returns the steps of the related workflow
type TaskStepStatus ¶
type TaskStepStatus int
TaskStepStatus is an enumerated type for tasks steps statuses
ENUM( INITIAL RUNNING DONE ERROR CANCELED )
const ( // TaskStepStatusINITIAL is a TaskStepStatus of type INITIAL TaskStepStatusINITIAL TaskStepStatus = iota // TaskStepStatusRUNNING is a TaskStepStatus of type RUNNING TaskStepStatusRUNNING // TaskStepStatusDONE is a TaskStepStatus of type DONE TaskStepStatusDONE // TaskStepStatusERROR is a TaskStepStatus of type ERROR TaskStepStatusERROR // TaskStepStatusCANCELED is a TaskStepStatus of type CANCELED TaskStepStatusCANCELED )
func GetTaskStepStatus ¶
func GetTaskStepStatus(taskID, stepName string) (TaskStepStatus, error)
GetTaskStepStatus returns the step status of the related step name
func ParseTaskStepStatus ¶
func ParseTaskStepStatus(name string) (TaskStepStatus, error)
ParseTaskStepStatus attempts to convert a string to a TaskStepStatus
func (TaskStepStatus) String ¶
func (x TaskStepStatus) String() string
String implements the Stringer interface.
type TaskType ¶
type TaskType int
TaskType is an enumerated type for tasks
ENUM( Deploy UnDeploy ScaleOut ScaleIn Purge CustomCommand CustomWorkflow Query Action ForcePurge // ForcePurge is deprecated and should not be used anymore this stay here to prevent task renumbering colision AddNodes RemoveNodes )
const ( // TaskTypeDeploy is a TaskType of type Deploy TaskTypeDeploy TaskType = iota // TaskTypeUnDeploy is a TaskType of type UnDeploy TaskTypeUnDeploy // TaskTypeScaleOut is a TaskType of type ScaleOut TaskTypeScaleOut // TaskTypeScaleIn is a TaskType of type ScaleIn TaskTypeScaleIn // TaskTypePurge is a TaskType of type Purge TaskTypePurge // TaskTypeCustomCommand is a TaskType of type CustomCommand TaskTypeCustomCommand // TaskTypeCustomWorkflow is a TaskType of type CustomWorkflow TaskTypeCustomWorkflow // TaskTypeQuery is a TaskType of type Query TaskTypeQuery // TaskTypeAction is a TaskType of type Action TaskTypeAction // TaskTypeForcePurge is a TaskType of type ForcePurge // ForcePurge is deprecated and should not be used anymore this stay here to prevent task renumbering colision TaskTypeForcePurge // TaskTypeAddNodes is a TaskType of type AddNodes TaskTypeAddNodes // TaskTypeRemoveNodes is a TaskType of type RemoveNodes TaskTypeRemoveNodes )
func GetTaskType ¶
GetTaskType retrieves the TaskType of a task
func ParseTaskType ¶
ParseTaskType attempts to convert a string to a TaskType