Documentation ¶
Index ¶
- func CancelTask(kv *api.KV, taskID string) error
- func CheckTaskStepStatusChange(before, after string) (bool, error)
- func DeleteTask(kv *api.KV, taskID string) error
- func EmitTaskEvent(kv *api.KV, deploymentID, taskID string, taskType TaskType, status string) (string, error)deprecated
- func EmitTaskEventWithContextualLogs(ctx context.Context, kv *api.KV, deploymentID, taskID string, ...) (string, error)
- func GetAllTaskData(kv *api.KV, taskID string) (map[string]string, error)
- func GetInstances(kv *api.KV, taskID, deploymentID, nodeName string) ([]string, error)
- func GetQueryTaskIDs(kv *api.KV, taskType TaskType, query string, target string) ([]string, error)
- func GetTaskCreationDate(kv *api.KV, taskID string) (time.Time, error)
- func GetTaskData(kv *api.KV, taskID, dataName string) (string, error)
- func GetTaskInput(kv *api.KV, taskID, inputName string) (string, error)
- func GetTaskRelatedNodes(kv *api.KV, taskID string) ([]string, error)
- func GetTaskResultSet(kv *api.KV, taskID string) (string, error)
- func GetTaskTarget(kv *api.KV, taskID string) (string, error)
- func GetTasksIdsForTarget(kv *api.KV, targetID string) ([]string, error)
- func IsAnotherLivingTaskAlreadyExistsError(err error) (bool, string)
- func IsTaskDataNotFoundError(err error) bool
- func IsTaskRelatedNode(kv *api.KV, taskID, nodeName string) (bool, error)
- func IsWorkflowTask(taskType TaskType) bool
- func MonitorTaskCancellation(ctx context.Context, kv *api.KV, taskID string, f func())
- func MonitorTaskFailure(ctx context.Context, kv *api.KV, taskID string, f func())
- func NewAnotherLivingTaskAlreadyExistsError(taskID, targetID, status string) error
- func NotifyErrorOnTask(taskID string) error
- func ResumeTask(kv *api.KV, taskID string) errordeprecated
- func SetTaskData(kv *api.KV, taskID, dataName, dataValue string) error
- func SetTaskDataList(kv *api.KV, taskID string, data map[string]string) error
- func TargetHasLivingTasks(kv *api.KV, targetID string) (bool, string, string, error)
- func TaskExists(kv *api.KV, taskID string) (bool, error)
- func TaskHasCancellationFlag(kv *api.KV, taskID string) (bool, error)
- func TaskHasErrorFlag(kv *api.KV, taskID string) (bool, error)
- func UpdateTaskStepStatus(kv *api.KV, taskID string, step *TaskStep) error
- func UpdateTaskStepWithStatus(kv *api.KV, taskID, stepName string, status TaskStepStatus) error
- type Collectordeprecated
- type TaskStatus
- type TaskStep
- type TaskStepStatus
- type TaskType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CancelTask ¶
CancelTask marks a task as Canceled
func CheckTaskStepStatusChange ¶
CheckTaskStepStatusChange checks if a status change is allowed
func DeleteTask ¶
DeleteTask allows to delete a stored task
func EmitTaskEventWithContextualLogs ¶
func EmitTaskEventWithContextualLogs(ctx context.Context, kv *api.KV, 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 GetTaskInput ¶
GetTaskInput retrieves inputs 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 ¶
GetTasksIdsForTarget returns IDs of tasks related to a given targetID
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 IsTaskDataNotFoundError ¶
IsTaskDataNotFoundError checks if an error is a task data 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 ResumeTask
deprecated
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 TargetHasLivingTasks ¶
TargetHasLivingTasks checks if a targetID has associated tasks in status INITIAL or RUNNING and returns the id and status of the first one found
Only Deploy, UnDeploy, ScaleOut, ScaleIn and Purge task type are considered.
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(kv *api.KV, taskID, stepName string, status TaskStepStatus) error
UpdateTaskStepWithStatus allows to update the task step status
Types ¶
type Collector
deprecated
type Collector struct {
// contains filtered or unexported fields
}
A Collector is used to register new tasks in Yorc
Deprecated: use *collector.Collector instead
func NewCollector
deprecated
func (*Collector) RegisterTask
deprecated
RegisterTask register a new Task of a given type.
The task id is returned. Basically this is a shorthand for RegisterTaskWithData(targetID, taskType, nil)
Deprecated: use (c *collector.Collector) RegisterTask instead
func (*Collector) RegisterTaskWithData
deprecated
type TaskStatus ¶
type TaskStatus int
TaskStatus x 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(kv *api.KV, 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 x 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(kv *api.KV, 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 x ENUM( Deploy, UnDeploy, ScaleOut, ScaleIn, Purge, CustomCommand, CustomWorkflow, Query, Action ForcePurge )
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 TaskTypeForcePurge )
func GetTaskType ¶
GetTaskType retrieves the TaskType of a task
func ParseTaskType ¶
ParseTaskType attempts to convert a string to a TaskType