Documentation
¶
Overview ¶
Package workflow describes a daisy workflow.
Index ¶
- type CopyGCSObject
- type CopyGCSObjects
- type CreateDisk
- type CreateDisks
- type CreateImage
- type CreateImages
- type CreateInstance
- type CreateInstances
- type DeleteResources
- type IncludeWorkflow
- type InstanceSignal
- type SerialOutput
- type Step
- type SubWorkflow
- type WaitForInstancesSignal
- type Workflow
- func (w *Workflow) AddVar(k, v string)
- func (w *Workflow) NewIncludedWorkflow() *Workflow
- func (w *Workflow) NewIncludedWorkflowFromFile(file string) (*Workflow, error)
- func (w *Workflow) NewSubWorkflow() *Workflow
- func (w *Workflow) NewSubWorkflowFromFile(file string) (*Workflow, error)
- func (w *Workflow) Print()
- func (w *Workflow) Run() error
- func (w *Workflow) String() string
- func (w *Workflow) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyGCSObject ¶
CopyGCSFile copies a GCS file from Source to Destination.
type CopyGCSObjects ¶
type CopyGCSObjects []CopyGCSObject
CopyGCSFiles is a Daisy CopyGCSFiles workflow step.
type CreateDisk ¶
type CreateDisk struct {
compute.Disk
// Size of this disk.
SizeGb string `json:"sizeGb,omitempty"`
// Zone to create the instance in, overrides workflow Zone.
Zone string `json:",omitempty"`
// Project to create the instance in, overrides workflow Project.
Project string `json:",omitempty"`
// Should this resource be cleaned up after the workflow?
NoCleanup bool
// Should we use the user-provided reference name as the actual
// resource name?
ExactName bool
// contains filtered or unexported fields
}
CreateDisk describes a GCE disk.
func (*CreateDisk) MarshalJSON ¶
func (c *CreateDisk) MarshalJSON() ([]byte, error)
MarshalJSON is a hacky workaround to prevent CreateDisk from using compute.Disk's implementation.
type CreateImage ¶
type CreateImage struct {
compute.Image
// Project to import image into. If this is unset Workflow.Project is
// used.
Project string `json:",omitempty"`
// Should this resource be cleaned up after the workflow?
NoCleanup bool
// Should we use the user-provided reference name as the actual
// resource name?
ExactName bool
// contains filtered or unexported fields
}
CreateImage creates a GCE image in a project. Supported sources are a GCE disk or a RAW image listed in Workflow.Sources.
func (*CreateImage) MarshalJSON ¶
func (c *CreateImage) MarshalJSON() ([]byte, error)
MarshalJSON is a hacky workaround to prevent CreateImage from using compute.Image's implementation.
type CreateImages ¶
type CreateImages []*CreateImage
CreateImages is a Daisy CreateImages workflow step.
type CreateInstance ¶
type CreateInstance struct {
compute.Instance
// Additional metadata to set for the instance.
Metadata map[string]string `json:"metadata,omitempty"`
// OAuth2 scopes to give the instance. If none are specified
// https://www.googleapis.com/auth/devstorage.read_only will be added.
Scopes []string `json:",omitempty"`
// StartupScript is the Sources path to a startup script to use in this step.
// This will be automatically mapped to the appropriate metadata key.
StartupScript string `json:",omitempty"`
// Project to create the instance in, overrides workflow Project.
Project string `json:",omitempty"`
// Zone to create the instance in, overrides workflow Zone.
Zone string `json:",omitempty"`
// Should this resource be cleaned up after the workflow?
NoCleanup bool
// Should we use the user-provided reference name as the actual resource name?
ExactName bool
// contains filtered or unexported fields
}
CreateInstance creates a GCE instance. Output of serial port 1 will be streamed to the daisy logs directory.
func (*CreateInstance) MarshalJSON ¶
func (c *CreateInstance) MarshalJSON() ([]byte, error)
MarshalJSON is a hacky workaround to prevent CreateInstance from using compute.Instance's implementation.
type CreateInstances ¶
type CreateInstances []*CreateInstance
CreateInstances is a Daisy CreateInstances workflow step.
type DeleteResources ¶
type DeleteResources struct {
Instances, Disks, Images []string `json:",omitempty"`
}
DeleteResources deletes GCE resources.
type IncludeWorkflow ¶
type IncludeWorkflow struct {
Path string
Vars map[string]string `json:",omitempty"`
// contains filtered or unexported fields
}
IncludeWorkflow defines a Daisy workflow injection step. This step will 'include' the workflow found the path given into the parent workflow. Unlike a Subworkflow the included workflow will exist in the same namespace as the parent and have access to all its resources.
type InstanceSignal ¶
type InstanceSignal struct {
// Instance name to wait for.
Name string
// Interval to check for signal (default is 5s).
// Must be parsable by https://golang.org/pkg/time/#ParseDuration.
Interval string
// Wait for the instance to stop.
Stopped bool
// Wait for a string match in the serial output.
SerialOutput *SerialOutput
// contains filtered or unexported fields
}
InstanceSignal waits for a signal from an instance.
type SerialOutput ¶
SerialOutput describes text signal strings that will be written to the serial port. This step will not complete until a line in the serial output matches SuccessMatch or FailureMatch. A match with FailureMatch will cause the step to fail.
type Step ¶
type Step struct {
// Time to wait for this step to complete (default 10m).
// Must be parsable by https://golang.org/pkg/time/#ParseDuration.
Timeout string
// Only one of the below fields should exist for each instance of Step.
CreateDisks *CreateDisks `json:",omitempty"`
CreateImages *CreateImages `json:",omitempty"`
CreateInstances *CreateInstances `json:",omitempty"`
CopyGCSObjects *CopyGCSObjects `json:",omitempty"`
DeleteResources *DeleteResources `json:",omitempty"`
IncludeWorkflow *IncludeWorkflow `json:",omitempty"`
SubWorkflow *SubWorkflow `json:",omitempty"`
WaitForInstancesSignal *WaitForInstancesSignal `json:",omitempty"`
// contains filtered or unexported fields
}
Step is a single daisy workflow step.
type SubWorkflow ¶
type SubWorkflow struct {
Path string
Vars map[string]string `json:",omitempty"`
// contains filtered or unexported fields
}
SubWorkflow defines a Daisy sub workflow.
type WaitForInstancesSignal ¶
type WaitForInstancesSignal []InstanceSignal
WaitForInstancesSignal is a Daisy WaitForInstancesSignal workflow step.
type Workflow ¶
type Workflow struct {
// Populated on New() construction.
Ctx context.Context `json:"-"`
Cancel chan struct{} `json:"-"`
// Workflow template fields.
// Workflow name.
Name string
// Project to run in.
Project string
// Zone to run in.
Zone string
// GCS Path to use for scratch data and write logs/results to.
GCSPath string
// Path to OAuth credentials file.
OAuthPath string `json:",omitempty"`
// Sources used by this workflow, map of destination to source.
Sources map[string]string `json:",omitempty"`
// Vars defines workflow variables, substitution is done at Workflow run time.
Vars map[string]json.RawMessage `json:",omitempty"`
Steps map[string]*Step
// Map of steps to their dependencies.
Dependencies map[string][]string
ComputeClient compute.Client `json:"-"`
StorageClient *storage.Client `json:"-"`
// contains filtered or unexported fields
}
Workflow is a single Daisy workflow workflow.
func NewFromFile ¶
NewFromFile reads and unmarshals a workflow file. Recursively reads subworkflow steps as well.
func (*Workflow) NewIncludedWorkflow ¶
NewIncludedWorkflow instantiates a new workflow with the same resources as the parent.
func (*Workflow) NewIncludedWorkflowFromFile ¶
NewIncludedWorkflowFromFile reads and unmarshals a workflow with the same resources as the parent.
func (*Workflow) NewSubWorkflow ¶
NewSubWorkflow instantiates a new workflow as a child to this workflow.
func (*Workflow) NewSubWorkflowFromFile ¶
NewSubWorkflowFromFile reads and unmarshals a workflow as a child to this workflow.