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.

You can access the Batch Runner programmatically from your own JavaScript applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6    token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
11    "batch": [
12        {
13            "actorId": "useful-tools/wait-and-finish",
14            "input": {
15                "minWaitTime": 30,
16                "dataset": {
17                    "items": [
18                        {
19                            "key": "value1"
20                        }
21                    ]
22                }
23            }
24        },
25        {
26            "actorId": "useful-tools/wait-and-finish",
27            "input": {
28                "dataset": {
29                    "items": [
30                        {
31                            "key": "value1"
32                        },
33                        {
34                            "key": "value2"
35                        }
36                    ]
37                }
38            }
39        }
40    ],
41    "maxConcurrency": 25,
42    "maxMemoryMb": 32768
43};
44
45// Run the Actor and wait for it to finish
46const run = await client.actor("useful-tools/batch-runner").call(input);
47
48// Fetch and print Actor results from the run's dataset (if any)
49console.log('Results from dataset');
50console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51const { items } = await client.dataset(run.defaultDatasetId).listItems();
52items.forEach((item) => {
53    console.dir(item);
54});
55
56// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

Batch Runner API in JavaScript

The Apify API client for JavaScript is the official library that allows you to use Batch Runner API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.

Install the apify-client

npm install apify-client

Other API clients include:

Developer
Maintained by Community

Actor Metrics

  • 3 monthly users

  • 5 stars

  • >99% runs succeeded

  • Created in Sep 2023

  • Modified 2 months ago