Skip to content

Commit

Permalink
[Docs] Remove incorrect condition/extra code from example
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Aniceto committed Feb 27, 2023
1 parent 6575db1 commit 6e16ae1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 2 additions & 7 deletions docs/parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ setParallelCanAssign(function (pickleInQuestion, picklesInProgress) {
})
```

Additionally, you can make use of the third argument to get information regarding the worker and decide weather or not to run a scenario.
Additionally, you can make use of the third argument to get information regarding the worker and decide wether or not to run a scenario.

Example:
```javascript
setParallelCanAssign(function (pickleInQuestion, picklesInProgress, worker) {
const inQuestionTags = pickleInQuestion.tags.map(tag => tag.name);
// Does the scenario have a tag that matches this worker (E.g. @WORKER_0)?
if (inQuestionTags.includes(`WORKER_${worker.id}`)) {
// If there's already a scenario inProgress for this worker, don't run it
return picklesInProgress.every((p) => !p.tags.map(t=> t.name).includes(`WORKER_${worker.id}`))
}
// No other restrictions
return true
return inQuestionTags.includes(`WORKER_${worker.id}`);
})
```

Expand Down
1 change: 0 additions & 1 deletion src/runtime/parallel/coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export default class Coordinator implements IRuntime {
nextPicklePlacement(worker: IWorker): IPicklePlacement {
for (let index = 0; index < this.pickleIds.length; index++) {
const placement = this.placementAt(index)

if (
this.supportCodeLibrary.parallelCanAssign(
placement.pickle,
Expand Down

0 comments on commit 6e16ae1

Please sign in to comment.