@@ -15,8 +15,7 @@ It is responsible for:
1515- ** Worker group** : A group of workers that all pull from the same queue, e.g. "us-east-1", "my-self-hosted-workers".
1616 - ** Worker** : A worker is a 'server' that connects to the platform and receives runs.
1717 - ** Supervisor** : Pulls new runs from the queue, communicates with the platform, spins up new Deploy executors.
18- - ** Checkpointer** : Responsible for checkpointing runs.
19- - ** Deploy executor** : Container that comes from a specific deploy from a user's project.
18+ - ** Deploy container** : Container that comes from a specific deploy from a user's project.
2019 - ** Run controller** : The code that manages running the task.
2120 - ** Run executor** : The actual task running.
2221
@@ -188,109 +187,3 @@ This is useful:
188187## Emitting events
189188
190189The Run Engine emits events using its ` eventBus ` . This is used for runs completing, failing, or things that any workers should be aware of.
191-
192- # Legacy system
193-
194- These are all the TaskRun mutations happening right now:
195-
196- ## 1. TriggerTaskService
197-
198- This is called from:
199-
200- - trigger task API
201- - ` BatchTriggerTaskService ` for each item
202- - ` ReplayTaskRunService `
203- - ` TestTaskService `
204- - ` TriggerScheduledTaskService ` when the CRON fires
205-
206- Directly creates a run if it doesn't exist, either in the ` PENDING ` or ` DELAYED ` states.
207- Enqueues the run.
208-
209- [ TriggerTaskService.call()] ( /apps//webapp/app/v3/services/triggerTask.server.ts#246 )
210-
211- ## 2. Batch trigger
212-
213- ## 3. DevQueueConsumer executing a run
214-
215- ### a. Lock run and set status to ` EXECUTING `
216-
217- [ DevQueueConsumer.#doWorkInternal()] ( /apps/webapp/app/v3/marqs/devQueueConsumer.server.ts#371 )
218-
219- ### b. If an error is thrown, unlock the run and set status to ` PENDING `
220-
221- [ DevQueueConsumer.#doWorkInternal()] ( /apps/webapp/app/v3/marqs/devQueueConsumer.server.ts#477 )
222-
223- ## 4. SharedQueueConsumer executing a run
224-
225- ### a. ` EXECUTE ` , lock the run
226-
227- We lock the run and update some basic metadata (but not status).
228- [ SharedQueueConsumer.#doWorkInternal()] ( /apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts#394 )
229-
230- ### b. ` EXECUTE ` , if an error is thrown, unlock the run
231-
232- We unlock the run, but don't change the status.
233- [ SharedQueueConsumer.#doWorkInternal()] ( /apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts#552 )
234-
235- ### c. ` EXECUTE ` , if the run has no deployment set the status to ` WAITING_FOR_DEPLOY `
236-
237- [ SharedQueueConsumer.#doWorkInternal()] ( /apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts#876 )
238-
239- ## 5. CompleteAttemptService retrying a run
240-
241- ### a. When an attempt has failed, we set the status to ` RETRYING_AFTER_FAILURE `
242-
243- [ CompleteAttemptService.#completeAttemptFailed()] ( /apps/webapp/app/v3/services/completeAttempt.server.ts#239 )
244-
245- ## 6. CreateTaskRunAttemptService creating a new attempt, setting the run to ` EXECUTING `
246-
247- We call this when:
248-
249- - [ Executing a DEV run from the CLI.] ( /packages/cli-v3//src/dev/workerRuntime.ts#305 )
250- - [ Deprecated: directly from the SharedQueueCOnsumer when we don't support lazy attempts] ( /apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts#501 )
251- - [ When we receive a ` CREATE_TASK_RUN_ATTEMPT ` message from the coordinator] ( /apps/webapp//app/v3//handleSocketIo.server.ts#187 )
252-
253- This is the actual very simple TaskRun update:
254- [ CreateTaskRunAttemptService.call()] ( /apps/webapp/app/v3/services/createTaskRunAttempt.server.ts#134 )
255-
256- ## 7. EnqueueDelayedRunService set a run to ` PENDING ` when the ` delay ` has elapsed
257-
258- When the run attempt gets created it will be marked as ` EXECUTING ` .
259-
260- [ EnqueueDelayedRunService.#call()] ( /apps/webapp/app/v3/services/enqueueDelayedRun.server.ts#41 )
261-
262- ## 8. FinalizeTaskRunService finalizing a run
263-
264- This service is called from many places, when a run is in a "final" state. This means the run can't be acted on anymore.
265-
266- We set the status, expiredAt and completedAt fields.
267-
268- [ FinalizeTaskRunService.#call()] ( /apps/webapp/app/v3/services/finalizeTaskRun.server.ts#63 )
269-
270- This function is called from:
271-
272- - [ ` FailedTaskRunService ` when a run has SYSTEM_FAILURE] ( /apps/webapp/app/v3/failedTaskRun.server.ts#41 )
273- - [ ` CancelAttemptService ` when an attempt is canceled] ( /apps/webapp/app/v3/services/cancelAttempt.server.ts#66 )
274- - [ ` CancelTaskRunService ` when a run is canceled] ( /apps/webapp/app/v3/services/cancelTaskRun.server.ts#51 )
275- - ` CompleteAttemptService ` when a SYSTEM_FAILURE happens
276- - [ No attempt] ( /apps/webapp/app/v3/services/completeAttempt.server.ts#74 )
277- - [ ` completeAttemptFailed ` and there's no checkpoint] ( /apps/webapp/app/v3/services/completeAttempt.server.ts#280 )
278- - [ ` completeAttemptFailed ` and the error is internal and a graceful exit timeout] ( /apps/webapp/app/v3/services/completeAttempt.server.ts#321 )
279- - ` CompleteTaskRunService ` when a run has failed (this isn't a bug)
280- - [ ` completeAttemptFailed ` ] ( /apps/webapp/app/v3/services/completeAttempt.server.ts#352 )
281- - ` CompleteTaskRunService ` when a run is completed successfully
282- - [ ` completeAttemptSuccessfully ` ] ( /apps/webapp/app/v3/services/completeAttempt.server.ts#135 )
283- - ` CrashTaskRunService ` when a run has crashed
284- - [ ` call ` ] ( /apps/webapp/app/v3/services/crashTaskRun.server.ts#47 )
285- - ` ExpireEnqueuedRunService ` when a run has expired
286- - [ ` call ` ] ( /apps/webapp/app/v3/services/expireEnqueuedRun.server.ts#42 )
287-
288- ## 9. RescheduleTaskRunService (when further delaying a delayed run)
289-
290- [ RescheduleTaskRunService.#call()] ( /apps/webapp/app/v3/services/rescheduleTaskRun.server.ts#21 )
291-
292- ## 10. Triggering a scheduled run
293-
294- Graphile Worker calls this function based on the schedule. We add the schedule data onto the run, and call ` TriggerTaskService.call() ` .
295-
296- [ TriggerScheduledRunService.#call()] ( /apps/webapp/app/v3/services/triggerScheduledTask.server.ts#131 )
0 commit comments