-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit implements the flow to execute a batch evaluation up until the point of actually running the evaluation.
- Loading branch information
Showing
27 changed files
with
681 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { jobs } from '@latitude-data/core/jobs' | ||
import { | ||
DatasetsRepository, | ||
DocumentVersionsRepository, | ||
EvaluationsRepository, | ||
} from '@latitude-data/core/repositories' | ||
import { nanoid } from 'nanoid' | ||
import { z } from 'zod' | ||
|
||
import { authProcedure } from '../procedures' | ||
|
||
export const runBatchAction = authProcedure | ||
.createServerAction() | ||
.input( | ||
z.object({ | ||
datasetId: z.number(), | ||
projectId: z.number(), | ||
documentUuid: z.string(), | ||
commitUuid: z.string(), | ||
runCount: z.number(), | ||
offset: z.number().optional().default(0), | ||
parameters: z.record(z.number()).optional(), | ||
evaluationId: z.number(), | ||
}), | ||
) | ||
.handler(async ({ input, ctx }) => { | ||
const evaluationsRepo = new EvaluationsRepository(ctx.workspace.id) | ||
const evaluation = await evaluationsRepo | ||
.find(input.evaluationId) | ||
.then((r) => r.unwrap()) | ||
|
||
const datasetsRepo = new DatasetsRepository(ctx.workspace.id) | ||
const dataset = await datasetsRepo | ||
.find(input.datasetId) | ||
.then((r) => r.unwrap()) | ||
|
||
const docsRepo = new DocumentVersionsRepository(ctx.workspace.id) | ||
const document = await docsRepo | ||
.getDocumentAtCommit({ | ||
projectId: input.projectId, | ||
commitUuid: input.commitUuid, | ||
documentUuid: input.documentUuid, | ||
}) | ||
.then((r) => r.unwrap()) | ||
|
||
const batchId = nanoid() | ||
await jobs.queues.defaultQueue.jobs.enqueueRunBatchEvaluationJob({ | ||
evaluation, | ||
dataset, | ||
document, | ||
runCount: input.runCount, | ||
offset: input.offset, | ||
parametersMap: input.parameters, | ||
batchId, | ||
}) | ||
|
||
return { success: true, batchId } | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { setupJobs } from '@latitude-data/jobs' | ||
|
||
export const jobs = setupJobs() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.