Task chaining
You can determine the execution order of a set of tasks by passing in a list of prerequisite task IDs when you register each task. In the following example, task #2 and task #3 are registered with an array of prerequisite task IDs.
Chaining projection and merge
When you register a data projection task, you must register a dependent merge task that executes when data projection is complete.
Data projection is performed by a distributed worker (ProjectionWorker). Each worker projects data into its own temporary table in the Cortex Processing Engine Storage database, which means that ten workers will produce ten separate tables. The merge worker (MergeWorker) combines the data into a single table and deletes the temporary tables.
The RegisterModelTrainingTaskChainAsync() method in the Sitecore.Processing.Engine.Abstractions.TaskManagerExtensions extension class creates a chain of three tasks, including data projection and merge.