-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
Run Engine 2.0 (alpha) #1575
Open
nicktrn
wants to merge
360
commits into
main
Choose a base branch
from
run-engine-2
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.
Open
Run Engine 2.0 (alpha) #1575
Changes from 250 commits
Commits
Show all changes
360 commits
Select commit
Hold shift + click to select a range
a6a7b40
basic worker api routes
nicktrn a035ab1
add worker group tests
nicktrn d36b2d5
Improved attempt completing and made a test for retries
matt-aitken a958af2
Merge remote-tracking branch 'origin/main' into run-engine-2
matt-aitken cca3a5b
Add a delayed run test
matt-aitken 8cda15c
rename and implement lastDequeueAt
nicktrn 0160c97
Renamed checkpointThresholdMs, added a stub for createCheckpoint, and…
matt-aitken dbc28a8
Fix tests
matt-aitken 176407b
rename complete attempt result
nicktrn 5cb1fef
When an attempt fails snapshot goes to “PENDING_EXECUTING”. Fixes for…
matt-aitken 318d3e0
Cancelling a run. Heartbeat function exposed
matt-aitken 29e8228
Cancelling test now includes a running child task
matt-aitken 3668cf5
don't await the unawaitable
nicktrn a0dcd78
simplify image build and add node-22 runtime
nicktrn cba4fca
new worker action api routes
nicktrn b10094f
deprecate several context props
nicktrn f14aa04
Fix for bad import
matt-aitken 9741512
Test for cancelling a non-executing run
matt-aitken d6da828
move image ref helper to core
nicktrn aa9538d
unify bundling more
nicktrn f7d2c4c
add missing node-22 case
nicktrn 9c93498
Rescheduling test
matt-aitken a67a874
Made the rescheduling test a bit more robust/harder to fluke
matt-aitken 915e359
fix cli version import
nicktrn df14586
Use the eventBus to send worker notifications out of the run engine
matt-aitken 7f2ef42
Update the snapshot with the heartbeat time when we receive one, make…
matt-aitken 66256fc
Split the run engine tests into separate files, it was getting too crazy
matt-aitken 391613e
Added some better comments to the prisma schema
matt-aitken 1640bb2
Use nacking when a heartbeat fails before an attempt is created
matt-aitken bc01fdb
First heartbeat test working
matt-aitken 5c5312f
If something throws when dequeuing a run, nack it (ideally with a val…
matt-aitken d89c25a
A test when we fail to start runs until the run goes into a SystemFai…
matt-aitken 5bf7596
Updated the Run Engine readme to document some things and capture som…
matt-aitken 71d1cf8
Tweaked some of the text
matt-aitken b1cb62f
Added a todo to the prisma schema for auto deactivating idempotency k…
matt-aitken fa06e80
Added heartbeat recoveries when workers are unresponsive (after an at…
matt-aitken b787408
Added notes about how to detect if we should use the run engine when …
matt-aitken caa87af
Improved the test so the run recovers, then completely fails after 2 …
matt-aitken 3049e47
When an attempt fails we remove waitpoints blocking the run
matt-aitken ae9cfbc
Remove todo
matt-aitken 05154aa
Improved comment
matt-aitken c7db647
Pending cancel heartbeat test
matt-aitken 42843cd
Emit a `runAttemptStarted` event that can be used for sending invocat…
matt-aitken c3929c2
Added an env queue so we can track the number of queued items
matt-aitken d40249f
Increase the delay to make the test more robust
matt-aitken 9885749
Added the env queue length guard to triggerTaskV2
matt-aitken 8670edb
Move the queue length function down
matt-aitken cafb313
Same logic for waitingForDeploy for dev
matt-aitken 485b1b9
Updated the engine readme after speaking to Eric
matt-aitken 4dfcae6
WorkerGroup migrations
matt-aitken 0af6ead
Waitpoint type event -> manual
matt-aitken b03982b
Increase some of the timeouts in the heartbeat tests more to avoid fl…
matt-aitken 96b3e8e
Manually creating, blocking, and completing waitpoints added to the r…
matt-aitken 64770ce
When blocking a run with a manual waitpoint, you can set a failAfter …
matt-aitken 5232dfd
Added some notes about run flow control. Rate limit, throttle, batchi…
matt-aitken 954c2bd
worker package updates
nicktrn 8484c55
update worker api routes
nicktrn dba02b5
one trigger service to rule them all
nicktrn 3201424
minor changes to deployments and run pages
nicktrn 513ea90
update helper import
nicktrn 786b035
managed worker secret and other auth improvements
nicktrn c898fb2
update populate script
nicktrn 0237752
fix webapp builds
nicktrn 9fa3c98
update lockfile
nicktrn 017d8cf
add worker socket
nicktrn ece3303
deployment service updates
nicktrn 2ebdbf2
use new trigger service in tests
nicktrn da5226a
correctly lock to unmanaged background worker
nicktrn 232475e
fix worker http client
nicktrn 2cbcbdb
compare core schema enums against db types
nicktrn 6323e7b
Added jsdocs to the redis worker enqueue function
matt-aitken 6625f69
Deal with runs being dequeued where there’s no background worker, wit…
matt-aitken 85f3dab
Added explicit return types to the other dequeue functions
matt-aitken de9dd66
BatchTaskRun taskidentifier optional, updated unique constraint
matt-aitken e4cb7fd
DB migration for BatchTaskRun and worker changes
matt-aitken 7f7644f
Added a todo to triggerTask
matt-aitken 7c0befe
Added some notes to the schema making it clear what we’re using for b…
matt-aitken 33fbc2e
Move the emitted event down
matt-aitken 51c4434
Added a batchTrigger test where a BatchTaskRun is created and passed in
matt-aitken d203c3e
add workers list command
nicktrn 1bf37c9
support a worker group being set as default by multiple projects
nicktrn 5747417
Run test files in sequence
matt-aitken a2dd5e3
Moved types to a separate file
matt-aitken 12f4fbb
WIP improving the consistency of the return types in the run engine
matt-aitken 766c4ac
Latest lockfile
matt-aitken f6208de
Wait for duration explicit return type, including the execution result
matt-aitken 0799938
Recheduling returns the updated TaskRun
matt-aitken 77b7d0f
Added a friendlyId to Waitpoints now we’re going to have a public API…
matt-aitken 04dc85f
A couple more return types
matt-aitken 808a6f9
Organized imports
matt-aitken c71ac30
Added a test for blocking a second parent with the same child run
matt-aitken 6c3c9f0
Modified triggerTaskV2 to work with the new parentRunId/resumeParentO…
matt-aitken 81188eb
Added TaskRun priorityMs column
matt-aitken 5e2f70a
Migration for Waitpoint.friendlyId and TaskRun.priorityMs
matt-aitken e3d729c
save cli config in pretty format
nicktrn f6047d5
fix worker schema import
nicktrn 862339a
cli profile switcher and other goodies
nicktrn 31993c4
add missing node-22 cases
nicktrn a9db8c3
Better description of the priorityMs column
matt-aitken 4f3c51d
Use the priority when enqueuing runs
matt-aitken 683ceb4
Added a test for priorities
matt-aitken 8f87206
create backup before migrating to new config format
nicktrn 4d5f9c0
first eventbus handler to complete successful run spans
nicktrn 5423968
return env vars when starting run attempts
nicktrn 3276d2b
add basic worker events
nicktrn dc3a2c1
unmanaged worker builds
nicktrn b3d42d6
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn 65f471c
bump worker version
nicktrn f084df1
update lockfile after worker bump
nicktrn 9003b18
add v2 run cancellation
nicktrn d11612e
surface master queues in admin view
nicktrn 99a33e8
run engine compatibility flag and deploy scaffold
nicktrn ac7076b
checkpoint event indexes
nicktrn 66edfe2
shared -> managed worker
nicktrn f25a971
add snapshot creation debug task events
nicktrn 26a72dd
add worker instance metadata
nicktrn ffcd387
remove random package.json
nicktrn 9187996
Revert "checkpoint event indexes"
nicktrn da74e88
managed worker wip
nicktrn 768fc9b
deprecate cli logger warn and error methods
nicktrn 66a0ff9
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn d95a750
add run heartbeat route
nicktrn a06e270
update run engine zod version
nicktrn 78a3d35
add workload heartbeats
nicktrn 5da5a61
unify run heartbeat methods
nicktrn bb824df
restore trigger task service router
nicktrn 0a605b6
remove debug log
nicktrn 68a7e33
complete failed run events, fix success output
nicktrn 3058cdd
child event completion on run failure, better logging
nicktrn 3070a9d
fix http client run heartbeat route
nicktrn 5a79e10
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn a73a3eb
update lockfile
nicktrn 515641e
remove rate limit from run engine
nicktrn 3e26ea4
Always display errors before other code blocks in the run overview tab
nicktrn ff20023
add retry delay spans
nicktrn a1b545b
resurrect uncaught exception handler
nicktrn bed6677
run completion handling and retries
nicktrn 8973ccb
fix span presenter v2 engine outputs and errors
nicktrn 6a91584
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn 676496a
bump worker version
nicktrn 0631b22
remove retry span attribute bloat
nicktrn f595ae4
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn f1b4861
bump worker version
nicktrn 7913e39
report invocation usage
nicktrn 1cc0284
bump node-22 image to 22.12.0 require esm
nicktrn cd0347f
use full node 21 image version tag
nicktrn b42db7b
use multi-arch images for bun and node
nicktrn d9db268
remove unmanaged core export and add managed runtime
nicktrn b9c9c75
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn 71f04cf
bump worker version
nicktrn 3fe3c39
Suggested glossary for the RunEngine, TBC
matt-aitken 2635c58
Removed BatchTaskRun changes from this branch, they were done in main
matt-aitken fb6c33d
Set the BatchTaskRun status to completed when all runs are completed
matt-aitken 7653c22
When dequeuing respect passed in maxResources
matt-aitken ff369f3
Ported over the new run props: idempotencyKeyExpiresAt, versions, one…
matt-aitken fcb4e3b
Didn’t hit save… the new props when triggering tasks passed through
matt-aitken fd58ce6
Idempotency expiration + waitpoint edge case
matt-aitken d7a9e2b
WIP on creating checkpoint, parking for now
matt-aitken b95dd63
fix worker routes
nicktrn d434746
upgrade webapp node types to support generic event emitter
nicktrn eb69641
separate event bus handler singleton and run failure alerts
nicktrn 8262320
duration waits
nicktrn 05b7e30
fix execution snapshot debug spans
nicktrn a6d5ec4
task waits
nicktrn d4a638e
fix event bus types
nicktrn 4d41221
temporary fix for react hook run handle type
nicktrn d707a94
disable run notifications for now
nicktrn 3cee74c
convert any typecasts to expect errors to more easily fix later
nicktrn b4739b7
fix webapp types after node types upgrade
nicktrn c9a51f1
updateEnvConcurrencyLimits across marqs and the runqueue
matt-aitken 9da544e
Pass proper values into the run engine
matt-aitken ff79a77
RunQueue settings and removed unused rebalancing workers
matt-aitken 03c9899
Remove rebalancing prop
matt-aitken c84b506
Tidied more things up
matt-aitken 160e219
Update/remove queue limits for MARQS and RunQueue
matt-aitken 086c1bf
taskQueue/concurrencyLimit changes ported back into the RunEngine
matt-aitken e1177f7
Reworked completing waitpoints to improve performance and reduce race…
matt-aitken b57e913
Improved test robustness
matt-aitken ab9e268
Down to a single run lock only when a run is totally unblocked and re…
matt-aitken 872cea3
warm starts, worker notifications, wait fixes
nicktrn 93d2501
Fix for Run Engine poll interval env var
matt-aitken f572c0f
Expect the waitpoint to be completed quickly
matt-aitken fb56932
If a run is locked then it’s too late to expire it
matt-aitken e01288d
Added VALKEY_ env vars and plugged them into the run engine
matt-aitken 4c9e024
Extracted and updated the guard queue function so it can be used when…
matt-aitken f020acf
Merge remote-tracking branch 'origin/main' into run-engine-2
matt-aitken f1e2736
Added logging and universal concurrency changes to trigger task v1
matt-aitken fb433de
Added notes back in
matt-aitken 1238ef7
Bump @trigger.dev/worker to 3.3.7
matt-aitken 2490882
reportInvocationUsage for the runAttemptStarted event
matt-aitken a24644b
improve execution snapshot span debug span start times
nicktrn 3df8158
Unfriendly IDs
nicktrn 677a2d6
update lockfile
nicktrn 62c03bf
Created a shared determineEngineVersion function
matt-aitken 0b37539
disable unfinished commands
nicktrn da41728
save new cli config to different location, misc fixes
nicktrn d3a3951
add basic engine version check via current deploy
nicktrn 476b20f
new run engine will default to node 22 runtime
nicktrn e155aad
block some actions for projects on previous run engine
nicktrn 23e8d37
fix worker group tests
nicktrn fb5b2e7
fix triggerAndWait test
nicktrn f94154a
one typescript version to rule them all
nicktrn 23f3400
redlock type patch
nicktrn 5f07ff2
fix type issues caused by ts-reset
nicktrn 46c79e0
improve cleanup scripts
nicktrn accf9f7
add missing socket.io dep
nicktrn 0b0b7da
fix run notification handler type
nicktrn fa8bfc9
fix worker group test again
nicktrn 958c439
generate prisma client for e2e tests
nicktrn c8f460e
remove worker group tests for now
nicktrn 082644e
prevent image pull rate limits during unit tests
nicktrn 95a7155
increase timeout for queue concurrency limit test
nicktrn 610c95f
generate prisma client for preview release
nicktrn b1604fb
same node types everywhere
nicktrn 079bd5c
Merge branch 'main' into run-engine-2
matt-aitken 14250d5
Updated engine readme, removed legacy system notes
matt-aitken 56979e6
use default machine preset from platform package
nicktrn ae6a473
worker instances plural in schema
nicktrn 482a98d
disable pnpm update notifications
nicktrn d3386e2
return worker group details from connect call
nicktrn 7d382ac
add workers admin route
nicktrn a759bf7
fix heartbeat route return type
nicktrn 927edea
move deployment labels to core apps
nicktrn 3d21147
refactor run controller env schema
nicktrn 4f954b2
Add firstAttemptStartedAt to TaskRun
matt-aitken 3d4068a
RunEngine 2.0 batch trigger support (#1581)
matt-aitken 0642c9c
More changes to blocking to support continuing after idempotent compl…
matt-aitken fdf0bf6
Fix for the wrong type when blocking a run
matt-aitken d6e8743
remove @map
nicktrn 9d24fc1
optimise worker auth query
nicktrn 446a94f
add engine version header to core api client requests
nicktrn ca82d75
remove unique constraint for default group id
nicktrn 3c67350
consolidate migrations
nicktrn f961a75
the first managed worker becomes the global default
nicktrn 3e2687e
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn 45a829e
Debug events off by default, added an admin toggle to show them
matt-aitken a254602
worker group name can't be an empty string
nicktrn bc38276
add exec helper to core
nicktrn 1d6fb48
move machine resources to core
nicktrn a76ef98
add pre-dequeue callback to determine max resources
nicktrn 5cf7c52
optionally skip dequeue
nicktrn 994ac3e
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn 70abb63
bump worker package
nicktrn f319d3a
move worker to core
nicktrn 74dd91f
fix ReadableStream type error
nicktrn 8704e77
Merge remote-tracking branch 'origin/main' into run-engine-2
nicktrn 4f8ce0b
fix another type issue
nicktrn b8cb8dc
update a few more tsconfigs
nicktrn b12b617
add metadata changes introduced in #1563
nicktrn c8b835a
Run Engine 2.0 trigger idempotency (#1613)
matt-aitken 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
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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.
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.
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium