MCPcopy Create free account
hub / github.com/astercloud/aster / Summary

Method Summary

pkg/executionplan/types.go:242–268  ·  view source on GitHub ↗

Summary 返回计划摘要

()

Source from the content-addressed store, hash-verified

240
241// Summary 返回计划摘要
242func (p *ExecutionPlan) Summary() PlanSummary {
243 var completed, failed, pending, running int
244 for _, step := range p.Steps {
245 switch step.Status {
246 case StepStatusCompleted:
247 completed++
248 case StepStatusFailed:
249 failed++
250 case StepStatusPending:
251 pending++
252 case StepStatusRunning:
253 running++
254 }
255 }
256
257 return PlanSummary{
258 ID: p.ID,
259 Description: p.Description,
260 Status: p.Status,
261 TotalSteps: len(p.Steps),
262 Completed: completed,
263 Failed: failed,
264 Pending: pending,
265 Running: running,
266 Progress: float64(completed) / float64(len(p.Steps)) * 100,
267 }
268}
269
270// PlanSummary 计划摘要
271type PlanSummary struct {

Callers 4

TestSummaryFunction · 0.95
TestSummaryEmptyPlanFunction · 0.95
manualPlanExampleFunction · 0.95
ExecuteMethod · 0.45

Calls

no outgoing calls

Tested by 2

TestSummaryFunction · 0.76
TestSummaryEmptyPlanFunction · 0.76