Skip to content

MILAB-6480: migrate resource formula to fluent API (workflow-tengo 6.7.0)#89

Merged
blackcat merged 7 commits into
mainfrom
MILAB-6480_fluent-formula-api
Jul 15, 2026
Merged

MILAB-6480: migrate resource formula to fluent API (workflow-tengo 6.7.0)#89
blackcat merged 7 commits into
mainfrom
MILAB-6480_fluent-formula-api

Conversation

@blackcat

@blackcat blackcat commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Bumps @platforma-sdk/workflow-tengo 6.6.5 → 6.7.0 (fluent-only exec.formula) and migrates the analyze exec's RAM sizing to the new API.

  • .memFormula(f.clamp(f.add(f.gib(64), f.mul(f.size("reads"), 4)), f.gib(64), f.gib(256)), { fallback }).resources({ onCPU: { cpu, ram } }) with f.size("reads").times(4).plus(f.gib(64)).between(f.gib(64), f.gib(256)).staticFallback(...).
  • Behavior-preserving: RAM stays clamp(64 GiB + 4·size, 64 GiB, 256 GiB); CPU is the same per-sample count (stated in onCPU since the new API bundles cpu with a ram formula).

Verified: tengo check clean, full block build passes (10/10).

Greptile Summary

This PR migrates the MiXCR analyze exec's resource-sizing from the older imperative .cpu() / .mem() / .memFormula() calls to the new fluent .resources({ onCPU: { cpu, ram } }) API introduced in @platforma-sdk/workflow-tengo 6.7.0, while also bumping @platforma-sdk/block-tools to 2.12.0.

  • RAM formula equivalence preserved: clamp(64 GiB + 4·size("reads"), 64 GiB, 256 GiB) — the old f.clamp(f.add(f.gib(64), f.mul(f.size("reads"), 4)), ...) is rewritten as the fluent chain .times(4).plus(f.gib(64)).between(f.gib(64), f.gib(256)).staticFallback("64GiB"), which is mathematically identical.
  • CPU default unchanged: the perProcessCPUs ?? 16 logic is now expressed inline via a ternary inside the onCPU object rather than as a separate .cpu() branch.
  • Static RAM override preserved: when perProcessMemGB is set, ram is assigned a plain string (e.g., "128GiB") and passed directly into onCPU.ram, matching the old .mem() behavior.

Confidence Score: 5/5

Straightforward API migration — the RAM formula, CPU default, and static override paths all produce the same effective resource requests as before.

The only changed logic is in the tengo template: the formula chain is reordered (addition is commutative), the fallback is moved from an option object to a fluent call, and CPU is folded into the same resources() call. No branching paths change and no values are dropped. The lockfile additions are consistent with the declared version bumps and carry no unexpected transitive concerns.

No files require special attention.

Important Files Changed

Filename Overview
workflow/src/mixcr-analyze.tpl.tengo Migrates resource sizing from separate .cpu() / .mem() / .memFormula() calls to the new .resources({ onCPU: { cpu, ram } }) fluent API; RAM formula and CPU values are behaviorally equivalent to the old code.
pnpm-workspace.yaml Bumps @platforma-sdk/workflow-tengo 6.6.5→6.7.0 and @platforma-sdk/block-tools 2.11.9→2.12.0 in the workspace catalog.
pnpm-lock.yaml Lockfile update reflecting the two catalog version bumps; new transitive dependencies (archiver, ECR public client, package-builder-lib) pulled in by block-tools 2.12.0 look consistent.
.changeset/migrate-fluent-formula-api.md New changeset entry correctly documents the patch-level behavior-preserving formula migration.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[mixcr-analyze.tpl.tengo] --> B{perProcessMemGB set?}
    B -- yes --> C["ram = string(perProcessMemGB) + 'GiB'\n(static override)"]
    B -- no --> D["f.size('reads').times(4)\n.plus(f.gib(64))\n.between(f.gib(64), f.gib(256))\n.staticFallback('64GiB')"]
    E{perProcessCPUs set?} -- yes --> F[cpu = perProcessCPUs]
    E -- no --> G[cpu = 16]
    C --> H
    D --> H
    F --> H
    G --> H
    H["mixcrCmdBuilder.resources({ onCPU: { cpu, ram } })"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[mixcr-analyze.tpl.tengo] --> B{perProcessMemGB set?}
    B -- yes --> C["ram = string(perProcessMemGB) + 'GiB'\n(static override)"]
    B -- no --> D["f.size('reads').times(4)\n.plus(f.gib(64))\n.between(f.gib(64), f.gib(256))\n.staticFallback('64GiB')"]
    E{perProcessCPUs set?} -- yes --> F[cpu = perProcessCPUs]
    E -- no --> G[cpu = 16]
    C --> H
    D --> H
    F --> H
    G --> H
    H["mixcrCmdBuilder.resources({ onCPU: { cpu, ram } })"]
Loading

Reviews (1): Last reviewed commit: "MILAB-6480: fix Tengo parse error — use ..." | Re-trigger Greptile

Bump @platforma-sdk/workflow-tengo 6.6.5 -> 6.7.0 (fluent-only exec.formula) and migrate the analyze exec's RAM sizing from .memFormula(f.clamp(...)) to .resources({ onCPU: { cpu, ram } }). Behavior-preserving: RAM stays clamp(64 GiB + 4*size, 64 GiB, 256 GiB); cpu is the same per-sample count.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the RAM sizing logic in workflow/src/mixcr-analyze.tpl.tengo to the new fluent exec.formula API introduced in @platforma-sdk/workflow-tengo version 6.7.0. Specifically, it replaces mixcrCmdBuilder.memFormula with mixcrCmdBuilder.resources using the bundled onCPU resource specification. The dependency versions in pnpm-lock.yaml and pnpm-workspace.yaml have been updated accordingly. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

…onCPU })

cpu is a plain constant and ram is either a static Advanced-Settings override or a formula carrying .staticFallback, so both paths go through one resources({ onCPU }) call. Resolves on backends without getBlobSize (formula falls back to the 64 GiB floor; constant/static values used as-is).
@blackcat
blackcat marked this pull request as ready for review July 9, 2026 15:39
@blackcat
blackcat merged commit 3690851 into main Jul 15, 2026
11 checks passed
@blackcat
blackcat deleted the MILAB-6480_fluent-formula-api branch July 15, 2026 09:41
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.

3 participants