← All procedures

client.parallel

Execute procedures in parallel

MCPCLIbrowser
Package
@procedures/client · README
Path
["client","parallel"]
CLI
mark client parallel --tasks <any[]>
MCP tool
client.parallel on the dev-tools server
As data
{"$proc":["client","parallel"],"input":{}}
Tags
core, control-flow, runs-refs

Try it in the Composer →

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";

for (const procedure of allCoreProcedures) {
  if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","parallel"], { tasks: [] });
console.log(JSON.stringify(result));

From the command line

$ mark client parallel --tasks <any[]>

As data, in a program

{ "$proc": ["client", "parallel"], "input": { "tasks": [] } }

Input

FieldTypeRequired
tasksunknown[]yes
concurrencynumberno
failFastbooleanno

Output

FieldTypeRequiredDefaultDescription
resultsany[]yesThe result of each task, in the order of the tasks
allSucceededbooleanyesTrue when no task failed
errorsobject[]yesThe failed tasks
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "tasks": {
        "type": "array",
        "items": {},
        "description": "The tasks to run at the same time: calls or values"
      },
      "concurrency": {
        "description": "The most tasks that run at the same time (default: all)",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "failFast": {
        "description": "Stop at the first error (default: false)",
        "type": "boolean"
      }
    },
    "required": [
      "tasks"
    ],
    "additionalProperties": {}
  },
  "output": {
    "type": "object",
    "properties": {
      "results": {
        "type": "array",
        "items": {},
        "description": "The result of each task, in the order of the tasks"
      },
      "allSucceeded": {
        "type": "boolean",
        "description": "True when no task failed"
      },
      "errors": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "index": {
              "type": "number",
              "description": "The index of the task that failed"
            },
            "error": {
              "type": "string",
              "description": "The error message of the task"
            }
          },
          "required": [
            "index",
            "error"
          ],
          "additionalProperties": {}
        },
        "description": "The failed tasks"
      }
    },
    "required": [
      "results",
      "allSucceeded",
      "errors"
    ],
    "additionalProperties": {}
  }
}