runner
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
const (MissingParameterErrorCode = "MISSING_TEMPLATE_PARAMETER"RequiredTemplateVariablesErrorCode = "REQUIRED_TEMPLATE_VARIABLES")
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeJobUpdater¶
typeMetrics¶
type Metrics struct {ConcurrentJobs *prometheus.GaugeVecNumDaemonsprometheus.Gauge// JobTimings also counts the total amount of jobs.JobTimings *prometheus.HistogramVec// WorkspaceBuilds counts workspace build successes and failures.WorkspaceBuilds *prometheus.CounterVecWorkspaceBuildTimings *prometheus.HistogramVec}
typeOptions¶
type Options struct {UpdaterJobUpdaterQuotaCommitterQuotaCommitterLoggerslog.LoggerProvisionersdkproto.DRPCProvisionerClientUpdateIntervaltime.DurationForceCancelIntervaltime.DurationLogDebounceIntervaltime.DurationTracertrace.TracerMetricsMetrics}
typeQuotaCommitter¶
type QuotaCommitter interface {CommitQuota(ctxcontext.Context, in *proto.CommitQuotaRequest) (*proto.CommitQuotaResponse,error)}
typeRunner¶
type Runner struct {// contains filtered or unexported fields}
func (*Runner)Cancel¶
func (r *Runner) Cancel()
Cancel initiates a Cancel on the job, but allows it to keep running to do so gracefully. Read from Done() tobe notified when the job completes.
func (*Runner)Fail¶
Fail immediately halts updates and, if the job is not complete sends FailJob to the coder server. Running goroutinesare canceled but complete asynchronously (although they are prevented from further updating the job to the coderserver). The provided context sets how long to keep trying to send the FailJob.
func (*Runner)ForceStop¶
func (r *Runner) ForceStop()
ForceStop signals all goroutines to stop and prevents any further API calls back to coder server for this job
func (*Runner)Run¶
func (r *Runner) Run()
Run executes the job.
the idea here is to run two goroutines to work on the job: doCleanFinish and heartbeat, then usethe `r.cond` to wait until the job is either complete or failed. This function then sends thecomplete or failed message --- the exception to this is if something calls Fail() on the Runner;either something external, like the server getting closed, or the heartbeat goroutine timing outafter attempting to gracefully cancel. If something calls Fail(), then the failure is sent onthat goroutine on the context passed into Fail(), and it marks okToSend false to signal us herethat this function should not also send a terminal message.