OpenFn / OpenFn/kit

Only compile steps that are actually being executed

Open
#1,030 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DevX
Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

When running partial workflows - locally or particularly in Lightning - compilation can take some time.

Right now, we pre-complile all steps in the workflow before the run starts. This is cleaner architecturally because we ensure the runtime has a fully executable workflow. It also ensures that syntax errors are caught immediately.

The problems come in when:

  • You're running a single step from a workflow, but that workflow contains another step with huge mappings
  • An orphaned, unused step has a syntax errror

We could add a hook to the runtime which allows it to compile steps just-in-time. This way, only steps that are executed are compiled.

It should probably be an option. The worker/cli has a "compileJIT" flag, defaulting to true.

The runtime is passed a compile callback, which is called on every step.

Either the runtime OR the compile callback itself should cache compilation (maybe find a cheap hash for the code, rather than using the expression as a key, because that's a huge key for large steps). I suppose you could also mark whether the step is compiled or not.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the worker/cli passes the compile callback into the runtime and how workflow steps are currently pre-compiled. Define the compileJIT option and decide where compilation caching belongs, then verify that only executed steps compile while syntax errors in unused steps do not block the run.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, cli, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.