Documentation
¶
Overview ¶
Package workflow contains the actual workflow of a worker controller instance
Index ¶
- Constants
- func ValidateSpecWorkflow(ctx workflow.Context, ...) error
- func Workflow(ctx workflow.Context, ...) error
- type Activities
- func (a *Activities) HandleDeferredScalingDecision(ctx context.Context, req HandleDeferredScalingDecisionActivityRequest) (*HandleDeferredScalingDecisionActivityResponse, error)
- func (a *Activities) HandleTaskAddSignal(ctx context.Context, req HandleTaskAddSignalActivityRequest) (*HandleTaskAddSignalActivityResponse, error)
- func (a *Activities) InvokeWorker(ctx context.Context, req *InvokeWorkerActivityRequest) error
- func (a *Activities) InvokeWorkersToRegisterTaskQueues(ctx context.Context, req *InvokeWorkersToRegisterTaskQueuesRequest) (*InvokeWorkersToRegisterTaskQueuesResponse, error)
- func (a *Activities) PullStats(ctx context.Context, req *PullStatsActivityRequest) (*PullStatsActivityResponse, error)
- func (a *Activities) UpdateWorkerSetSize(ctx context.Context, req *UpdateWorkerSetSizeActivityRequest) error
- func (a *Activities) ValidateSpec(ctx context.Context, req *ValidateSpecRequest) error
- type HandleDeferredScalingDecisionActivityRequest
- type HandleDeferredScalingDecisionActivityResponse
- type HandleTaskAddSignalActivityRequest
- type HandleTaskAddSignalActivityResponse
- type InvokeWorkerActivityRequest
- type InvokeWorkersToRegisterTaskQueuesRequest
- type InvokeWorkersToRegisterTaskQueuesResponse
- type PullStatsActivityRequest
- type PullStatsActivityResponse
- type RequestContext
- type SignalHandler
- type UpdateWorkerSetSizeActivityRequest
- type ValidateSpecRequest
- type WorkerControllerInstanceWorkflowVersion
- type WorkflowRunner
Constants ¶
const ( ValidateSpecActivityTimeout = 15 * time.Second PullStatsActivityTimeout = 60 * time.Second HandleTaskAddSignalActivityTimeout = 15 * time.Second HandleDeferredScalingDecisionActivityTimeout = 15 * time.Second InvokeWorkerActivityTimeout = 2 * time.Minute UpdateWorkerSetSizeActivityTimeout = 2 * time.Minute RegisterTaskQueuesViaWorkersActivityTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func ValidateSpecWorkflow ¶
func ValidateSpecWorkflow(ctx workflow.Context, args *iface.ValidateWorkerControllerInstanceSpecWorkflowArgs, activities *Activities) error
func Workflow ¶
func Workflow(ctx workflow.Context, unsafeWorkflowVersionGetter func() WorkerControllerInstanceWorkflowVersion, unsafeMaxVersion func() int, unsafePeriodicValidationInterval func() time.Duration, args *iface.WorkerControllerInstanceWorkflowArgs, activities *Activities) error
Workflow is implemented in a way such that it always CaNs after some history events are added to it and when it has no pending work to do. This is to keep the history clean so that we have less concern about backwards and forwards compatibility. In steady state (i.e. absence of ongoing updates or signals) the wf should only have a single wft in the history.
Types ¶
type Activities ¶
type Activities struct {
// contains filtered or unexported fields
}
func NewActivities ¶
func NewActivities( namespace *namespace.Namespace, dc *dynamicconfig.Collection, workflowserviceClient workflowservice.WorkflowServiceClient, ) *Activities
func (*Activities) HandleDeferredScalingDecision ¶
func (a *Activities) HandleDeferredScalingDecision(ctx context.Context, req HandleDeferredScalingDecisionActivityRequest) (*HandleDeferredScalingDecisionActivityResponse, error)
func (*Activities) HandleTaskAddSignal ¶
func (a *Activities) HandleTaskAddSignal(ctx context.Context, req HandleTaskAddSignalActivityRequest) (*HandleTaskAddSignalActivityResponse, error)
func (*Activities) InvokeWorker ¶
func (a *Activities) InvokeWorker(ctx context.Context, req *InvokeWorkerActivityRequest) error
func (*Activities) InvokeWorkersToRegisterTaskQueues ¶
func (a *Activities) InvokeWorkersToRegisterTaskQueues(ctx context.Context, req *InvokeWorkersToRegisterTaskQueuesRequest) (*InvokeWorkersToRegisterTaskQueuesResponse, error)
func (*Activities) PullStats ¶
func (a *Activities) PullStats(ctx context.Context, req *PullStatsActivityRequest) (*PullStatsActivityResponse, error)
func (*Activities) UpdateWorkerSetSize ¶
func (a *Activities) UpdateWorkerSetSize(ctx context.Context, req *UpdateWorkerSetSizeActivityRequest) error
func (*Activities) ValidateSpec ¶
func (a *Activities) ValidateSpec(ctx context.Context, req *ValidateSpecRequest) error
type HandleDeferredScalingDecisionActivityRequest ¶
type HandleDeferredScalingDecisionActivityRequest struct {
RequestContext
Request iface.SignalTaskAddRequest `json:"request"`
ScalingGroupKey string `json:"scaling_group_key"`
ScalingGroupSpec iface.ScalingGroupSpec `json:"scaling_group_spec"`
EffectiveTaskTypes []enumspb.TaskQueueType `json:"effective_task_types"`
ScalingStatus iface.ScalingAlgorithmStatus `json:"scaling_status"`
}
type HandleDeferredScalingDecisionActivityResponse ¶
type HandleDeferredScalingDecisionActivityResponse struct {
UpdatedScalingStatus iface.ScalingAlgorithmStatus `json:"scaling_status"`
Actions []scalingalgorithm.ScalingAction `json:"actions,omitempty"`
}
type HandleTaskAddSignalActivityRequest ¶
type HandleTaskAddSignalActivityRequest struct {
RequestContext
Request iface.SignalTaskAddRequest `json:"request"`
Spec *iface.WorkerControllerInstanceSpec `json:"spec"`
ScalingStatus map[string]iface.ScalingAlgorithmStatus `json:"scaling_status"`
}
type HandleTaskAddSignalActivityResponse ¶
type HandleTaskAddSignalActivityResponse struct {
UpdatedScalingStatus map[string]iface.ScalingAlgorithmStatus `json:"scaling_status"`
Actions []scalingalgorithm.ScalingAction `json:"actions,omitempty"`
}
type InvokeWorkerActivityRequest ¶
type InvokeWorkerActivityRequest struct {
RequestContext
ComputeConfig *iface.ComputeProviderSpec `json:"compute_config"`
}
type InvokeWorkersToRegisterTaskQueuesRequest ¶
type InvokeWorkersToRegisterTaskQueuesRequest struct {
RequestContext
iface.WorkerControllerInstanceSpec
// ScalingStatus is the per-group scaling status, used to size a worker-set
// registration resize to the algorithm's planned count.
ScalingStatus map[string]iface.ScalingAlgorithmStatus `json:"scaling_status,omitempty"`
}
type InvokeWorkersToRegisterTaskQueuesResponse ¶
type InvokeWorkersToRegisterTaskQueuesResponse struct {
// UpdatedScalingStatus is the complete next-state scaling status for every group in
// the spec: resized groups carry their reconciled count, skipped (already-registered)
// groups carry their prior status forward. The workflow assigns it wholesale.
UpdatedScalingStatus map[string]iface.ScalingAlgorithmStatus `json:"scaling_status,omitempty"`
}
type PullStatsActivityRequest ¶
type PullStatsActivityRequest struct {
RequestContext
Spec *iface.WorkerControllerInstanceSpec `json:"spec"`
ScalingStatus map[string]iface.ScalingAlgorithmStatus `json:"scaling_status"`
}
type PullStatsActivityResponse ¶
type PullStatsActivityResponse struct {
UpdatedScalingStatus map[string]iface.ScalingAlgorithmStatus `json:"scaling_status"`
Actions []scalingalgorithm.ScalingAction `json:"actions,omitempty"`
NextPollSeconds uint32 `json:"next_poll_seconds"`
}
type RequestContext ¶
type RequestContext = computeprovider.RequestContext
RequestContext aliases the compute-provider request context so activity request types can embed it while compute providers consume the same type directly. The alias keeps it defined in compute_provider (which the ComputeProvider interface depends on) without an import cycle.
type SignalHandler ¶
type SignalHandler struct {
// contains filtered or unexported fields
}
SignalHandler encapsulates the signal handling logic
type UpdateWorkerSetSizeActivityRequest ¶
type UpdateWorkerSetSizeActivityRequest struct {
RequestContext
ComputeConfig *iface.ComputeProviderSpec `json:"compute_config"`
UpdatedSize int32 `json:"updated_size"`
}
type ValidateSpecRequest ¶
type ValidateSpecRequest struct {
RequestContext
Spec *iface.WorkerControllerInstanceSpec `json:"spec"`
}
type WorkerControllerInstanceWorkflowVersion ¶
type WorkerControllerInstanceWorkflowVersion int64
const ( // Represents the very first version of the workflow InitialVersion WorkerControllerInstanceWorkflowVersion = iota // Adds periodic background re-validation of the spec. The timer fires every // periodic validation interval (default 6h; configurable via dynamic config). PeriodicValidationVersion // Signals the version workflow after each ValidationStatus change so the // deployment workflow can maintain an aggregate connectivity summary in its memo. SignalVersionWorkflowVersion // Cancels the child context which is attached to the timer futures, // which, on deletion, will mark the future as failed and prevent the body of // the associated callback from running. CancelTimersOnDeleteVersion )
type WorkflowRunner ¶
type WorkflowRunner struct {
*iface.WorkerControllerInstanceWorkflowArgs
// contains filtered or unexported fields
}
WorkflowRunner holds the local state while running a worker controller workflow
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package computeprovider contains the implementations of the various compute providers
|
Package computeprovider contains the implementations of the various compute providers |
|
Package iface contains the interface definitions to interact with the WCI workflows these are internal to the project.
|
Package iface contains the interface definitions to interact with the WCI workflows these are internal to the project. |
|
Package scalingalgorithm contains the different scaling algorithms available for WCIs
|
Package scalingalgorithm contains the different scaling algorithms available for WCIs |