MCPcopy
hub / github.com/determined-ai/determined / createTestTrial

Function createTestTrial

master/internal/api_trials_intg_test.go:43–69  ·  view source on GitHub ↗
(
	t *testing.T, api *apiServer, curUser model.User,
)

Source from the content-addressed store, hash-verified

41var inferenceMetricGroup = "inference"
42
43func createTestTrial(
44 t *testing.T, api *apiServer, curUser model.User,
45) (*model.Trial, *model.Task) {
46 exp := createTestExpWithProjectID(t, api, curUser, 1)
47
48 requestID := model.NewRequestID(rand.Reader)
49 task := &model.Task{
50 TaskType: model.TaskTypeTrial,
51 LogVersion: model.TaskLogVersion1,
52 StartTime: time.Now(),
53 TaskID: trialTaskID(exp.ID, requestID),
54 }
55 require.NoError(t, db.AddTask(context.TODO(), task))
56
57 trial := &model.Trial{
58 StartTime: time.Now(),
59 RequestID: &requestID,
60 State: model.PausedState,
61 ExperimentID: exp.ID,
62 }
63 require.NoError(t, db.AddTrial(context.TODO(), trial, task.TaskID))
64
65 // Return trial exactly the way the API will generally get it.
66 outTrial, err := db.TrialByID(context.TODO(), trial.ID)
67 require.NoError(t, err)
68 return outTrial, task
69}
70
71func createTestTrialWithMetrics(
72 ctx context.Context, t *testing.T, api *apiServer, curUser model.User, includeBatchMetrics bool,

Callers 15

TestMoveRunsIdsFunction · 0.85
TestMoveRunsSameIdsFunction · 0.85
TestReportCheckpointFunction · 0.85
TestUnusualMetricNamesFunction · 0.85
TestTrialAuthZFunction · 0.85
TestTrialProtoTaskIDsFunction · 0.85
TestTrialLogsFunction · 0.85
TestTrialLogFieldsFunction · 0.85

Calls 6

NewRequestIDFunction · 0.92
AddTaskFunction · 0.92
AddTrialFunction · 0.92
TrialByIDFunction · 0.92
trialTaskIDFunction · 0.85

Tested by

no test coverage detected