MCPcopy Index your code
hub / github.com/dagger/dagger / tryRunCheckScaleOut

Method tryRunCheckScaleOut

core/modtree.go:258–311  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

256}
257
258func (node *ModTreeNode) tryRunCheckScaleOut(ctx context.Context) (_ bool, rerr error) {
259 q, err := CurrentQuery(ctx)
260 if err != nil {
261 return true, err
262 }
263
264 cloudClient, useCloud, err := q.CloudEngineClient(ctx,
265 node.RootAddress(),
266 node.PathString(),
267 nil,
268 )
269 if err != nil {
270 return true, fmt.Errorf("engine-to-engine connect: %w", err)
271 }
272 if !useCloud {
273 return false, nil
274 }
275 defer func() {
276 rerr = errors.Join(rerr, cloudClient.Close())
277 }()
278
279 query, err := node.buildScaleOutModuleQuery(cloudClient.Dagger().QueryBuilder())
280 if err != nil {
281 return true, err
282 }
283
284 query = query.Select("check").Arg("name", node.moduleLocalPathString())
285 query = query.Select("run")
286 query = query.Select("error")
287 query = query.Select("id")
288
289 var errID string
290 if err := query.Bind(&errID).Execute(ctx); err != nil {
291 return true, err
292 }
293
294 if errID != "" {
295 srv, err := CurrentDagqlServer(ctx)
296 if err != nil {
297 return true, err
298 }
299 var idp call.ID
300 if err := idp.Decode(errID); err != nil {
301 return true, err
302 }
303 errObj, err := dagql.NewID[*Error](&idp).Load(ctx, srv)
304 if err != nil {
305 return true, err
306 }
307 return true, errObj.Self()
308 }
309
310 return true, nil
311}
312
313// ServiceNameAttr is the telemetry attribute key for the service name.
314// Defined locally because the canonical constant lives in the external

Callers 1

RunCheckMethod · 0.95

Calls 15

RootAddressMethod · 0.95
PathStringMethod · 0.95
moduleLocalPathStringMethod · 0.95
DecodeMethod · 0.95
CurrentQueryFunction · 0.85
DaggerMethod · 0.80
SelfMethod · 0.80
CurrentDagqlServerFunction · 0.70
CloudEngineClientMethod · 0.65
CloseMethod · 0.65
SelectMethod · 0.65

Tested by

no test coverage detected