![Batch Runner avatar](https://images.apifyusercontent.com/DBYwqhkw1cUJSveyyvSNcZcBk1PHj4We7A_OZXKZ72U/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS94bVFtVEFVbDl5Y2N1ZnBXTC8zaHh4cjZISkhDUWpQYUc1Ui1wcm9jZXNzaW5nLnBuZw.webp)
Batch Runner
Try for free
No credit card required
View all Actors![Batch Runner](https://images.apifyusercontent.com/DBYwqhkw1cUJSveyyvSNcZcBk1PHj4We7A_OZXKZ72U/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS94bVFtVEFVbDl5Y2N1ZnBXTC8zaHh4cjZISkhDUWpQYUc1Ui1wcm9jZXNzaW5nLnBuZw.webp)
![Batch Runner](https://images.apifyusercontent.com/DBYwqhkw1cUJSveyyvSNcZcBk1PHj4We7A_OZXKZ72U/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS94bVFtVEFVbDl5Y2N1ZnBXTC8zaHh4cjZISkhDUWpQYUc1Ui1wcm9jZXNzaW5nLnBuZw.webp)
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 more
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 console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51 const { items } = await client.dataset(run.defaultDatasetId).listItems();
52 items.forEach((item) => {
53 console.dir(item);
54 });
55})();
56
57// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
- 2 monthly users
- 3 stars
- 94.9% runs succeeded
- Created in Sep 2023
- Modified 5 months ago
Categories