MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / execute

Method execute

internal/cmd/plugin/pgbench/pgbench.go:72–90  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

70 --time 30 --client 1 --jobs 1`
71
72func (cmd *pgBenchRun) execute(ctx context.Context) error {
73 cluster, err := cmd.getCluster(ctx)
74 if err != nil {
75 return err
76 }
77
78 job := cmd.buildJob(cluster)
79
80 if cmd.dryRun {
81 return plugin.Print(job, plugin.OutputFormatYAML, os.Stdout)
82 }
83
84 if err := plugin.Client.Create(ctx, job); err != nil {
85 return err
86 }
87
88 fmt.Printf("job/%v created\n", job.Name)
89 return nil
90}
91
92func (cmd *pgBenchRun) getCluster(ctx context.Context) (*apiv1.Cluster, error) {
93 var cluster apiv1.Cluster

Callers 1

NewCmdFunction · 0.95

Calls 4

getClusterMethod · 0.95
buildJobMethod · 0.95
PrintFunction · 0.92
CreateMethod · 0.65

Tested by

no test coverage detected