Batch Runner avatar
Batch Runner
Try for free

No credit card required

View all Actors
Batch Runner

Batch Runner

useful-tools/batch-runner
Try for free

No credit card required

Actor for starting several Runs from single Input. It also has capability to merge the Dataset items from the created batch.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn mode

Node.js

Python

curl

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "batch": [
11        {
12            "actorId": "useful-tools/wait-and-finish",
13            "input": {
14                "minWaitTime": 30,
15                "dataset": {
16                    "items": [
17                        {
18                            "key": "value1"
19                        }
20                    ]
21                }
22            }
23        },
24        {
25            "actorId": "useful-tools/wait-and-finish",
26            "input": {
27                "dataset": {
28                    "items": [
29                        {
30                            "key": "value1"
31                        },
32                        {
33                            "key": "value2"
34                        }
35                    ]
36                }
37            }
38        }
39    ],
40    "maxConcurrency": 25,
41    "maxMemoryMb": 32768
42};
43
44(async () => {
45    // Run the Actor and wait for it to finish
46    const run = await client.actor("useful-tools/batch-runner").call(input);
47
48    // Fetch and print Actor results from the run's dataset (if any)
49    console.log('Results from dataset');
50    const { items } = await client.dataset(run.defaultDatasetId).listItems();
51    items.forEach((item) => {
52        console.dir(item);
53    });
54})();
Developer
Community logoMaintained by Community
Actor metrics
  • 2 monthly users
  • 61.2% runs succeeded
  • Created in Sep 2023
  • Modified about 20 hours ago

You might also like these Actors