Repository navigation
feat(pipelines): compose Deepnote notebook runs into pipelines #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jamesbhobbs
wants to merge
11
commits into
main
Choose a base branch
from
feat/orchestration-engine
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b587099
feat(local-runner): orchestrate notebook pipelines
jamesbhobbs 95d6d5d
fix(local-runner): address review on the orchestration engine
jamesbhobbs b300446
refactor(pipelines): move the pipeline engine to @deepnote/pipelines
jamesbhobbs b0f5afa
refactor(pipelines): trim the public surface and drop dead result fields
jamesbhobbs 713dedd
feat(pipelines): cap concurrent notebook steps
jamesbhobbs 11a13d1
fix(cloud): wake the poll sleep when the run is aborted
jamesbhobbs fed8d12
feat(pipelines): send Date inputs as ISO 8601
jamesbhobbs 7988c4f
refactor(local-runner): take DEFAULT_CLOUD_API_URL from @deepnote/pip…
jamesbhobbs ec57a40
docs(pipelines): fix stale references in comments and the example
jamesbhobbs ca8ccc5
feat(pipelines): keep the partial run when a pipeline fails
jamesbhobbs 7b3dfd6
fix(pipelines): let allowFailure cover a throwing executor
jamesbhobbs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor(pipelines): move the pipeline engine to @deepnote/pipelines
The engine imports no `node:*` by design, so a pipeline can run in a browser tab. That made `@deepnote/local-runner` — a local, Python-backed runner — the wrong home for it. Move it to its own package before the API is published, and name it after what it does. - `orchestrate` -> `runPipeline`, `runOrchestration` -> `runPipelineWithExecutor`, `Orchestration*` -> `Pipeline*`, `orchestrationOutputs` -> `pipelineOutputs`. - Snapshot reading moves too: `snapshot-view.ts` and `input-info.ts` are the browser-safe half of local-runner and the pipeline needs them, so keeping them behind would have made the two packages depend on each other. `local-runner` re-exports them, and `local-runner/snapshot-reader` still bundles them, so nothing already published changes shape. - `RunBlockOutput` moves alongside, with `ExecutionSummary` and `AgentStreamEvent` restated rather than imported: depending on `@deepnote/runtime-core` for two type aliases would pull a Python execution engine into a browser bundle. `pipeline-types.test.ts` fails to compile if the shapes drift. - The example moves to `examples/pipelines/script`, run by `pnpm example:pipeline`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Loading branch information
commit b300446fb5964ced70aec98e792a8d8595ef491a
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ples/local-runner/orchestration/README.md → examples/pipelines/script/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import type { | ||
| AgentStreamEvent as PipelineAgentStreamEvent, | ||
| ExecutionSummary as PipelineExecutionSummary, | ||
| } from '@deepnote/pipelines' | ||
| import type { AgentStreamEvent, ExecutionSummary } from '@deepnote/runtime-core' | ||
| import { describe, expect, it } from 'vitest' | ||
|
|
||
| /** | ||
| * `@deepnote/pipelines` restates these two types rather than depending on `@deepnote/runtime-core`, | ||
| * so that composing cloud runs in a browser does not pull in a Python execution engine. That is | ||
| * only safe while the shapes stay assignable in both directions, which is what this asserts: a | ||
| * local run's summary can be reported as a pipeline step's, and vice versa. | ||
| * | ||
| * If a field is added to one side, this stops compiling — which is the point. | ||
| */ | ||
| describe('pipeline types mirror the runtime-core types', () => { | ||
| it('keeps ExecutionSummary assignable in both directions', () => { | ||
| const fromRuntime: ExecutionSummary = { totalBlocks: 3, executedBlocks: 3, failedBlocks: 0, totalDurationMs: 12 } | ||
| const asPipeline: PipelineExecutionSummary = fromRuntime | ||
| const backAgain: ExecutionSummary = asPipeline | ||
|
|
||
| expect(backAgain).toEqual(fromRuntime) | ||
| }) | ||
|
|
||
| it('keeps AgentStreamEvent assignable in both directions', () => { | ||
| const fromRuntime: AgentStreamEvent = { type: 'text_delta', text: 'hello' } | ||
| const asPipeline: PipelineAgentStreamEvent = fromRuntime | ||
| const backAgain: AgentStreamEvent = asPipeline | ||
|
|
||
| expect(backAgain).toEqual(fromRuntime) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs' | ||
| import { tmpdir } from 'node:os' | ||
| import path from 'node:path' | ||
| import { deserializeDeepnoteFile } from '@deepnote/blocks' | ||
| import { describe, expect, it } from 'vitest' | ||
| import { readSnapshot } from './read-snapshot' | ||
|
|
||
| const FIXTURES = path.join(__dirname, '../../../test-fixtures') | ||
| const SNAPSHOT = readFileSync(path.join(FIXTURES, 'snapshot-view.snapshot.deepnote'), 'utf8') | ||
|
|
||
| /** | ||
| * The parsing itself is tested in `@deepnote/pipelines`, which owns it. What is left here is the | ||
| * part that needs Node: deciding whether a string is a path or the snapshot itself. | ||
| */ | ||
| describe('readSnapshot', () => { | ||
| it('reads from a path, raw YAML, or a parsed object', () => { | ||
| const dir = mkdtempSync(path.join(tmpdir(), 'snap-')) | ||
| const snapshotPath = path.join(dir, 'run.snapshot.deepnote') | ||
| writeFileSync(snapshotPath, SNAPSHOT) | ||
|
|
||
| expect(readSnapshot(snapshotPath).projectName).toBe('Sales') | ||
| expect(readSnapshot(SNAPSHOT).projectName).toBe('Sales') | ||
|
|
||
| const file = deserializeDeepnoteFile(SNAPSHOT) | ||
| expect(readSnapshot(file).notebooks[0].blocks.map(b => b.id)).toEqual(['b-input', 'b-md', 'b-code', 'b-sql']) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: deepnote/deepnote
Length of output: 248
🏁 Script executed:
Repository: deepnote/deepnote
Length of output: 14566
🏁 Script executed:
Repository: deepnote/deepnote
Length of output: 42135
🏁 Script executed:
Repository: deepnote/deepnote
Length of output: 21671
Preserve the local-runner compatibility exports.
The previous index exported the orchestration types and helpers. The current index removes them, while
@deepnote/pipelinesprovides the correspondingPipeline*,runPipeline, andrunPipelineWithExecutorAPIs. Add compatibility aliases or wrappers so existing@deepnote/local-runnerimports continue to compile.🤖 Prompt for AI Agents