Question: Patterns for Parallelization?
- Lingua principale
- C#
- Stelle
- 1.7k
- Fork
- 335
- Merge medio
- 2g 23h
- PR unite (30g)
- 6
Descrizione
So it's not fully clear reading the wiki nor examples if this is supported for scatter-gather scenarios inside orchestrations so bringing it up here.
We have a set of work item that need to be done in total but they don't have any requirement for being serially processed. Just the orchestration has to have them all complete prior to finishing.
So lets say we have this naive orchestration that schedules a task per input (doesn't really matter) and when they are all done, it completes.
```csharp
public class Orchestration : TaskOrchestration>
{
public override async Task RunTask(OrchestrationContext context, List input)
{
foreach (var thingToDo in input)
{
await context.ScheduleTask(typeof(DoWorkTask), thingToDo);
}
return "done";
}
}
```
So in a short execution time for DoWorkTask with a short enough set of inputs, serialized execution doesn't matter. However let's postulate that DoWorkTask averages say 1 hour of execution time. In addition we regularly have 20 or 30 "DoWorks" we need to perform together. However, if each DoWork didn't care about anything else and wouldn't interfere can we schedule multiple tasks and then await?
Basically something along this naive example (assume there's a extension method to build the parallelized partitioned work for brevity)
```csharp
public class Orchestration : TaskOrchestration>
{
public override async Task RunTask(OrchestrationContext context, List input)
{
foreach (List> partitionedWork in input.Partition(5)) // Do up to 5 things in parallel
{
var tasks = new List();
foreach (var thingToDo in partitionedWork)
{
tasks.Add(context.ScheduleTask(typeof(DoWorkTask), thingToDo));
}
await Task.WhenAll(tasks);
}
return "done";
}
}
```
so this is the type of thing we're checking for supported use
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dal wiki e dagli esempi referenziati nell'issue, quindi esamina le API di pianificazione dell'orchestrazione utilizzate da ScheduleTask e Task.WhenAll. Determina se i pattern proposti di scatter-gather e parallelismo partizionato sono supportati e documenta le indicazioni supportate e le limitazioni, se il progetto prevede un aggiornamento della documentazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- backend, distributed-systems
- Tipo di issue
- Documentazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100