MCPcopy Index your code
hub / github.com/docker/cli / replicatedJobProgressUpdater

Struct replicatedJobProgressUpdater

cli/command/service/progress/progress.go:537–572  ·  view source on GitHub ↗

replicatedJobProgressUpdater outputs the progress of a replicated job. This progress consists of a few main elements. The first is the progress bar for the job as a whole. This shows the number of completed out of total tasks for the job. Tasks that are currently running are not counted. The secon

Source from the content-addressed store, hash-verified

535// shown as a fraction of the maximum concurrent tasks that can be running,
536// which is the less of MaxConcurrent or TotalCompletions - completed tasks.
537type replicatedJobProgressUpdater struct {
538 progressOut progress.Output
539
540 // jobIteration is the service's job iteration, used to exclude tasks
541 // belonging to earlier iterations.
542 jobIteration uint64
543
544 // concurrent is the value of MaxConcurrent as an int. That is, the maximum
545 // number of tasks allowed to be run simultaneously.
546 concurrent int
547
548 // total is the value of TotalCompletions, the number of complete tasks
549 // desired.
550 total int
551
552 // initialized is set to true after the first time update is called. the
553 // first time update is called, the components of the progress UI are all
554 // written out in an initial pass. this ensure that they will subsequently
555 // be in order, no matter how they are updated.
556 initialized bool
557
558 // progressDigits is the number digits in total, so that we know how much
559 // to pad the job progress field with.
560 //
561 // when we're writing the number of completed over total tasks, we need to
562 // pad the numerator with spaces, so that the bar doesn't jump around.
563 // we'll compute that once on init, and then reuse it over and over.
564 //
565 // we compute this in the least clever way possible: convert to string
566 // with strconv.Itoa, then take the len.
567 progressDigits int
568
569 // activeDigits is the same, but for active tasks, and it applies to both
570 // the numerator and denominator.
571 activeDigits int
572}
573
574func newReplicatedJobProgressUpdater(service swarm.Service, progressOut progress.Output) *replicatedJobProgressUpdater {
575 concurrent := int(*service.Spec.Mode.ReplicatedJob.MaxConcurrent)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected