Skip to content

Integrate JiT compilation into CLI runtime#2184

Open
rafal-hawrylak wants to merge 3 commits into
mainfrom
pr4b-jit-runtime
Open

Integrate JiT compilation into CLI runtime#2184
rafal-hawrylak wants to merge 3 commits into
mainfrom
pr4b-jit-runtime

Conversation

@rafal-hawrylak
Copy link
Copy Markdown
Collaborator

@rafal-hawrylak rafal-hawrylak commented May 28, 2026

Part of #2110 - [Integrate JiT compilation into CLI]

@rafal-hawrylak rafal-hawrylak requested a review from a team as a code owner May 28, 2026 05:32
@rafal-hawrylak rafal-hawrylak requested review from krushangSk17 and removed request for a team May 28, 2026 05:32
@rafal-hawrylak rafal-hawrylak removed the request for review from krushangSk17 May 28, 2026 09:35
@rafal-hawrylak rafal-hawrylak force-pushed the pr4b-jit-runtime branch 2 times, most recently from 0cc664d to 72e576f Compare May 28, 2026 13:14
Comment thread cli/api/commands/run.ts
}

export class Runner {
private static handleParamsOverloads(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please don't insert static functions the class.
  2. I don't think having it static vs having it as a standalone function brings any value.

Comment thread cli/api/commands/run.ts
optionsOrResult: RunOptionsOrResult,
partiallyExecutedRunResult: dataform.IRunResult
): { options: IExecutionOptions; runResult: dataform.IRunResult } {
if (optionsOrResult && "actions" in optionsOrResult) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please only use "'key' in X" checks only for types with signature '{[key: string]: ...}`.

This will break on some JS compilers that use member-renaming optimizations.

Use optionsOrResult.actions === undefined

Comment thread cli/api/commands/run.ts
// Populated when the runner cancels execution (timeout or external cancel).
// Surfaced as errorMessage on SKIPPED tasks so users can see why an action
// never ran or stopped mid-flight.
private skipReason: string = "";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think using raw strings for error handling is a good idea. Please use string literal types

Comment thread cli/api/commands/run.ts
options: { projectDir: "." }
};
}
const options = { ...(optionsOrResult as IExecutionOptions) };
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just assignment with assertion? Only to populate default?

Comment thread cli/api/commands/run.ts
private readonly dbadapter: dbadapters.IDbAdapter,
private readonly graph: dataform.IExecutionGraph,
private readonly executionOptions: IExecutionOptions = {},
optionsOrResult: RunOptionsOrResult = {},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what is the motivation of complicating the code with mixed type resolution in class. Probably these two should be separate functions returning Runner instances.

Comment thread cli/api/commands/run.ts
// shape of tasks the action would have produced. If the action has
// no built tasks (e.g. JiT-only), still emit one so the cause is
// visible in the JSON output.
tasks: (pendingAction.tasks && pendingAction.tasks.length > 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use ternary operators sparingly and only for simple statements. This is unnecessary complex code.

Comment thread cli/api/commands/run.ts
this.getBigQueryExecutionOptions(action)
);

if (jitResponse.table) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if else branch sequence should be a function returning tasks.

Comment thread cli/vm/jit_worker.ts
} else {
callback(null, res.response);

// Guard against double-initialization in some environments (e.g. Bazel)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please avoid these hacks and keep initialization idempotent, please?

Comment thread cli/index.ts
],
processFn: async argv => {
const projectDir = argv[projectDirMustExistOption.name];
const logger = new Logger(!argv[jsonOutputOption.name]);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't mix refactoring with new functionality introduction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants