MCPcopy
hub / github.com/apache/devlake / monitorPipeline

Method monitorPipeline

backend/test/helper/api.go:391–417  ·  view source on GitHub ↗

MonitorPipeline FIXME

(id uint64)

Source from the content-addressed store, hash-verified

389
390// MonitorPipeline FIXME
391func (d *DevlakeClient) monitorPipeline(id uint64) models.Pipeline {
392 d.testCtx.Helper()
393 var previousResult models.Pipeline
394 endpoint := fmt.Sprintf("%s/pipelines/%d", d.Endpoint, id)
395 coloredPrintf("calling:\n\t%s %s\nwith:\n%s\n", http.MethodGet, endpoint, string(ToCleanJson(false, nil)))
396 var pipelineResult models.Pipeline
397 require.NoError(d.testCtx, runWithTimeout(d.pipelineTimeout, func() (bool, errors.Error) {
398 pipelineResult = sendHttpRequest[models.Pipeline](d.testCtx, d.pipelineTimeout, &testContext{
399 client: d,
400 printPayload: false,
401 }, http.MethodGet, fmt.Sprintf("%s/pipelines/%d", d.Endpoint, id), nil, nil)
402 if pipelineResult.Status == models.TASK_COMPLETED {
403 coloredPrintf("result: %s\n", ToCleanJson(true, &pipelineResult))
404 return true, nil
405 }
406 if pipelineResult.Status == models.TASK_FAILED {
407 coloredPrintf("result: %s\n", ToCleanJson(true, &pipelineResult))
408 return true, errors.Default.New("pipeline task failed")
409 }
410 if !reflect.DeepEqual(pipelineResult, previousResult) {
411 coloredPrintf("result: %s\n", ToCleanJson(true, &pipelineResult))
412 }
413 previousResult = pipelineResult
414 return false, nil
415 }))
416 return pipelineResult
417}
418
419func getScopeResponse(scopeRaw map[string]any) ScopeResponse {
420 response := Cast[ScopeResponse](scopeRaw)

Callers 2

TriggerBlueprintMethod · 0.95
RunPipelineMethod · 0.95

Calls 5

coloredPrintfFunction · 0.85
ToCleanJsonFunction · 0.85
runWithTimeoutFunction · 0.85
sendHttpRequestFunction · 0.85
NewMethod · 0.65

Tested by

no test coverage detected