feat(research): retry failed experiment trials with retained history
This commit is contained in:
parent
6f64ef62ba
commit
b373410320
32 changed files with 3336 additions and 61 deletions
|
|
@ -10,6 +10,7 @@ import {
|
|||
parseExperimentInput,
|
||||
parseExperimentSubmission,
|
||||
} from '../services/experiment-input';
|
||||
import { parseExperimentRetry } from '../services/experiment-retry';
|
||||
import { ExperimentsService } from '../services/experiments.service';
|
||||
|
||||
/** Mounted HTTP security owns read authorization; every mutation additionally requires credential proof. */
|
||||
|
|
@ -77,5 +78,25 @@ export function createExperimentRoutes(container: IServiceContainer) {
|
|||
}
|
||||
return c.json({ experiment: await service.cancel(id) });
|
||||
});
|
||||
app.get('/api/v2/experiments/:id/trials/:runId/retries', async c =>
|
||||
c.json({
|
||||
retries: await service.listTrialRetries(
|
||||
experimentId(c.req.param('id')),
|
||||
experimentId(c.req.param('runId'))
|
||||
),
|
||||
})
|
||||
);
|
||||
app.post('/api/v2/experiments/:id/trials/:runId/retry', async c => {
|
||||
const id = experimentId(c.req.param('id')),
|
||||
runId = experimentId(c.req.param('runId'));
|
||||
const input = parseExperimentRetry(await body(c.req.raw));
|
||||
const receipt = experimentReceipt({
|
||||
principal: getCredentialHttpPrincipal(c.req.raw) ?? '',
|
||||
key: c.req.header('Idempotency-Key') ?? '',
|
||||
});
|
||||
const result = await service.retryTrial(id, runId, input, receipt);
|
||||
c.header('Location', `/api/v2/experiments/${id}`);
|
||||
return c.json(result, 202);
|
||||
});
|
||||
return app;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue