Implement progressive query admission, session boundaries and event-driven Studio observations
This commit is contained in:
@@ -3,6 +3,7 @@ import path from "node:path";
|
||||
import { profile } from "./profile.js";
|
||||
import { loadQxSources, resolveQxSources } from "./source-loader.js";
|
||||
import { compileQuery, compileRepositoryQuery } from "../query/compile.js";
|
||||
import { queryTreeProjections } from "../query/tree.js";
|
||||
import type { QueryDeclaration } from "../query/types.js";
|
||||
import { compileQueryComposition, type QueryComposition } from "../query/composition.js";
|
||||
import { checkQueryTemplate } from "../query/templates.js";
|
||||
@@ -390,6 +391,13 @@ const createResourceGraphResolver = (
|
||||
};
|
||||
pkg.checkedQueries = [];
|
||||
for (const query of pkg.queries!) pkg.checkedQueries.push(await compile(query.id));
|
||||
const projections = pkg.checkedQueries.flatMap(queryTreeProjections);
|
||||
for (const projection of projections) {
|
||||
if (pkg.queries!.some((query) => query.id === projection.declaration.id))
|
||||
throw new Error(`Generated Query Tree projection conflicts with ${projection.declaration.id}`);
|
||||
pkg.queries!.push(projection.declaration);
|
||||
pkg.checkedQueries.push(projection);
|
||||
}
|
||||
}
|
||||
if (generated?.compositions?.length) {
|
||||
const pkg = compiled.resource.revision;
|
||||
|
||||
@@ -118,7 +118,9 @@ const main = async () => {
|
||||
if (options.executionPlanOut || options.buildContextsOut) {
|
||||
const executionStarted = performance.now();
|
||||
const plan = compileExecutionPlan(assembled.workspace);
|
||||
if (options.executionPlanOut) await writeFile(options.executionPlanOut, `${JSON.stringify(plan, null, 2)}\n`);
|
||||
// Machine-consumed immutable metadata should not spend its bounded input
|
||||
// reservation on indentation. Its parsed allocation is charged separately.
|
||||
if (options.executionPlanOut) await writeFile(options.executionPlanOut, `${JSON.stringify(plan)}\n`);
|
||||
if (options.buildContextsOut)
|
||||
await writeFile(options.buildContextsOut, JSON.stringify(packageBuildContexts(plan.definition.bindingSchema)));
|
||||
profile("execution-plan-and-contexts", executionStarted);
|
||||
|
||||
Reference in New Issue
Block a user