Conversation
fdccca4 to
371b080
Compare
371b080 to
18042dd
Compare
kolina
left a comment
There was a problem hiding this comment.
Let's test compatibility with different Dataform core versions.
Also this change seems worth it to bump a minor version of Dataform core
ikholopov-omni
left a comment
There was a problem hiding this comment.
Blocked on review of https://github.com/dataform-co/dataform/pull/2109/changes
* feat: add worker process management for JiT compilation - Introduce base worker and JiT-specific child process logic - Implement RPC bridge for database access during JiT - Add VM scripts and loader for isolated execution - Add unit tests for the RPC mechanism
- Enhance error coercion in common/errors/errors.ts - Sync protos/execution.proto and protos/jit.proto with new fields
* feat: add worker process management for JiT compilation - Introduce base worker and JiT-specific child process logic - Implement RPC bridge for database access during JiT - Add VM scripts and loader for isolated execution - Add unit tests for the RPC mechanism
* feat: add action descriptor support to JiT compilation results - Implement action and column descriptor logic in core/jit_compiler.ts - Support overrides for descriptions, labels, and tags in JiT results - Enhance error coercion in common/errors/errors.ts - Add comprehensive JiT metadata tests in core/jit_compiler_test.ts - Sync protos/execution.proto and protos/jit.proto with new result fields
10bb4e6 to
824d7d9
Compare
2466f28 to
38cd3b9
Compare
| try { | ||
| if (action.jitCode) { | ||
| await this.compileJitAction(action, actionResult, this.dbadapter); | ||
| if ((actionResult.status as dataform.ActionResult.ExecutionStatus) === dataform.ActionResult.ExecutionStatus.FAILED) { |
There was a problem hiding this comment.
Do we need casts here? Here and below
There was a problem hiding this comment.
Yes, to override TypeScript narrowing the type to exactly RUNNING (literal types). It believes the type is ExecutionStatus.FAILED and assumes it is not mutated.
There was a problem hiding this comment.
It seems that compileJitAction only updates actionResult in the exception block, so you can consider not passing actionResult there and moving the exception block into this function
| try { | ||
| const jitResponse = await this.executionOptions.jitCompiler( | ||
| jitRequest, | ||
| this.executionOptions.projectDir, |
There was a problem hiding this comment.
Reponding to the older comment
In the CLI, projectDir allows the JiT worker to resolve local require() calls and find @dataform/core. While this is convenient for local development, it does differ from the cloud environment where source code isn't available during execution. We may want to consider if JiT code should be strictly self-contained for better parity. This would make the project to be unportable from local to GCP and we don't want it, right?
I think it should be consistent. Allowing JiT compilation to access other files in a project seems ok to me, but if we don't support it in JiT, it'd make sense to not allow it in CLI as well
There was a problem hiding this comment.
In both AoT compilation:
Line 47 in 38cd3b9
What exactly you would align in AoT and JiT compilation?
There was a problem hiding this comment.
My comment is about "GCP vs CLI": if my JiT task will be able to import other files locally, but then will break in GCP because JiT compilation in GCP doesn't support it, it'll be not a great experience.
| return moduleName; | ||
| } | ||
| }, | ||
| sourceExtensions: ["js", "json"] |
There was a problem hiding this comment.
Hm, interesting - should yaml be really supported and is ever read in JiT compilation?
| if ( | ||
| argv[dryRunOptionName] && | ||
| isJsonOutput && | ||
| !executionGraph.actions.some(action => !!action.jitCode) |
There was a problem hiding this comment.
I think it makes sense to preserve printing graph here
There was a problem hiding this comment.
If we preserve printing the executionGraph here, the JSON output for JiT actions will be incomplete (it will only contain the raw js jitCode, not the generated SQL). I added this condition so that a dry-run with JiT actions falls through to the Runner, forcing the JiT compilation to happen, and outputting a runResult that contains the actual compiled SQL. If we remove this, users lose the ability to inspect dynamically generated JiT queries via JSON dry-runs. Do you still want me to revert this and print the uncompiled graph?
| @@ -1,2 +1,28 @@ | |||
| import { listenForCompileRequest } from "df/cli/vm/compile"; | |||
There was a problem hiding this comment.
This function can be cleaned up?
There was a problem hiding this comment.
I mean removing this function from listenForCompileRequest :_)
483f247 to
807dae4
Compare
* feat: enable JiT compilation in CLI run, build and compile commands - Connect main CLI execution flow to the JiT worker process - Add comprehensive JiT test suite - Finalize AoT build logic to preserve JiT-specific fields - Update CLI console and entry points for integrated JiT support
807dae4 to
82adbdd
Compare
kolina
left a comment
There was a problem hiding this comment.
No outstanding issues from my side except question about access of JiT compiled code to other files
| ) { | ||
| return { | ||
| runResult: { | ||
| actions: [], |
There was a problem hiding this comment.
Don't need this if actions is present in executionOptions?
| private readonly dbadapter: dbadapters.IDbAdapter, | ||
| private readonly graph: dataform.IExecutionGraph, | ||
| private readonly executionOptions: IExecutionOptions = {}, | ||
| optionsOrProjectDir: RunOptionsOrProjectDir = ".", |
There was a problem hiding this comment.
verify what exactly are we passing here
| try { | ||
| const jitResponse = await this.executionOptions.jitCompiler( | ||
| jitRequest, | ||
| this.executionOptions.projectDir, |
There was a problem hiding this comment.
My comment is about "GCP vs CLI": if my JiT task will be able to import other files locally, but then will break in GCP because JiT compilation in GCP doesn't support it, it'll be not a great experience.
| try { | ||
| if (action.jitCode) { | ||
| await this.compileJitAction(action, actionResult, this.dbadapter); | ||
| if ((actionResult.status as dataform.ActionResult.ExecutionStatus) === dataform.ActionResult.ExecutionStatus.FAILED) { |
There was a problem hiding this comment.
It seems that compileJitAction only updates actionResult in the exception block, so you can consider not passing actionResult there and moving the exception block into this function
| return moduleName; | ||
| } | ||
| }, | ||
| sourceExtensions: ["js", "json"] |
| @@ -1,2 +1,28 @@ | |||
| import { listenForCompileRequest } from "df/cli/vm/compile"; | |||
There was a problem hiding this comment.
I mean removing this function from listenForCompileRequest :_)
No description provided.