Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [batch-api]

Use it for questions about the core API that allows developers to split a big task in several minor chunks or batches.

0
votes
1answer
38 views

How to handle exceptions in a batch process

I have some special configured content entities in my system which are protected in a pre-delete hook against entity deletion. There is also a batch process (VBO - entity delete) where they can be ...
0
votes
0answers
13 views

Download a file and redirect to the form after batch operation

On submitting a form we need to run a batch process that writes to a CSV file. Once the batch process is completed we would like to download the CSV file automatically and redirect back to the form. ...
-4
votes
1answer
38 views

How to import OAI or REST API url data in a specific content type node?

I have a OAI/REST API url having thousand of records. How do I import these records in my content type node. Which module should I use? or I have to write custom module for this. Suggest some solution....
0
votes
2answers
95 views

Use of batch in REST endpoints

I want to use batch in POST in rest endpoints in Drupal 8, but my batch is not getting progressed. I am creating rest endpoints for my module which will send email to bulk users. So for this purpose I ...
3
votes
1answer
81 views

JS batch progress bar: possible to force refresh more frequently than every 1500 ms?

After initiating a js-based batch with batch_set(), and the redirect to batch do URL, the JS refresh interval is every 1500 ms by default. So status message and progress bar are only updated every 1 1/...
0
votes
0answers
81 views

Trigger a batch process via a rest endpoint and check on progress

I'm looking to see if it's possible to trigger and monitor a batch process via a REST endpoint (or similar) in Drupal 8. This is for a headless Drupal site. Triggering is fine I suppose, I can ...
1
vote
1answer
77 views

Batch API to process millions of records

I need to run Batch API on a huge dataset. Specifically I have a custom table with a lot of rows which I need to iterate over. The batch process works fine using small numbers. When using the full set ...
0
votes
0answers
48 views

Batch API error: ResponseText: {“errors”:[{“message”:“Not acceptable format: json”}]}

When running a batch process on Drupal 8, the following error is returned: ResponseText: {"errors":[{"message":"Not acceptable format: json"}]} The HTTP response is HTTP POST / 406 I can see the ...
3
votes
1answer
351 views

Is it normal that Drupal enters maintenance mode during a module update?

I have created a custom module with an .install file, which includes some hook_update_N() and hook_update_N(&$sandbox) update hooks. These are used to update a collection of existing nodes. ...
0
votes
1answer
47 views

Feeds remove item with certainly conditions

Good day I have a problem with the side of developer with certainly conditions i need remove a item from source. for example i have in source nid and phone1 and phone2 but if phone2 is the same ...
1
vote
1answer
67 views

Batch API: What am I doing wrong?

I am trying to import some videos into a 8.0.5 site (yes, I know I should upgrade) I have over 200 videos that neeed to be imported into their own individual node. It seems like a perfect opportunity ...
0
votes
2answers
28 views

Is it possible for 3rd Party Script to Create Users

Our company has many systems that require for users to have user names and passwords. We have been able to use SAML to cut down on the number of accounts we must manually create. With that said, we ...
-1
votes
1answer
35 views

Does drupal batch finished call back is mandatory?

I am working on batch api in Drupal. Ihave checked Drupal batch api document it shows operations callback and finishes callback. I implemented batch array without finished callback funtion it is ...
0
votes
1answer
66 views

Batch API timing out (running as one operation?)

I'm trying to print ~100 nodes worth of content (Performance Plans) out to the private file system using the batch API. My process works perfectly up until about 10 of them and then times out. The ...
1
vote
1answer
77 views

Passing form value into batch process

I have a form that is used to trigger a bulk operation and add a node for each of the currently registered users on the site. This is all working well, but I'd like to pass form data from BulkAddForm....
0
votes
0answers
141 views

How to trigger batch job from the command line

I have a batch job that is triggered as soon as I open a specific url of my site, let's call it "http:\mysite.com\job" The last code of that page is: batch_set($batch); batch_process('/'); I need ...
2
votes
1answer
279 views

Continuing an interrupted batch

I'm using a batch job in Drupal 8 to scrape pages from another site to import. I'm using httpClient, and I have it wrapped in a try/catch. try { $response = \Drupal::httpClient()->get($parts['...
0
votes
0answers
39 views

Is it possible to set time interval between adjacent operations in Batch API?

I need to send several thousands of e-mails via Amazon SES. As it turned out, Amazon SES can send no more that 14 e-mails per second. I can send to it no more than 14 e-mails per second - it's a ...
4
votes
3answers
2k views

How do I structure the batch operations array?

I'm working on a Drupal 8 custom module to scrape pages from a site for migration. Since we're dealing with a large number of pages, I wanted to set up batch processing, to deal with timeouts. I ...
0
votes
1answer
275 views

Read node from CSV file and save using batch - Drupal 7

When I'm trying to save a node using batch processing, I'm getting this error: PDOException: in drupal_write_record() (line 7383 of C:\wamp64\www\drupal7\includes\common.inc). Here is my complete ...
-1
votes
1answer
87 views

Passing important data to batch operation

I can't seem to pass any info to the 'finished' function of this batch operation. Everything works in terms of data getting saved correctly but I get the following error message due to the 'finished' ...
1
vote
3answers
827 views

How to write big updation code using Batch API?

I am writing a script to update all website registered user's Username & Email address. I have more then 5000+ users in my website which causes PHP execution time out error. So I tried to ...
0
votes
1answer
323 views

Batch API timeout during initialization

I'm creating a module to batch import/update nodes in Drupal 7 based on input files that can be XML or other formats. Worst case scenario is they are like ~10-20MB and can contain 10-20k entries. ...
1
vote
1answer
179 views

Why won't my batch finish?

I have setup a Batch work which looks the following (dump at run time). The method called for each batch is a public static method, so that is not a problem. All operations performs perfectly, my ...
1
vote
1answer
44 views

How to send large amount of email in backgroup process

I have created a custom menu in my custom module. I need to send email to 10000 users with different email greeting lines. I am fetching each user profile information and then send email to each user....
2
votes
2answers
3k views

How can execute batch api over cron jobs

I am working on Drupal 8 and batch API. I created the batch api calling importingmatch and it should automatically importing every 1 hour. My solution is use Drush for make it works without the ...
2
votes
1answer
177 views

How to know how many elements are processed in the finish callback?

I followed Smack My Batch Up : Batch Processing In Drupal 8 article to create a batch job and all works fine. But in the finish callback I can't get the total number of processed elements. This is my ...
4
votes
2answers
1k views

How do you do a redirect after a batch job?

I'm working on setting up a batch process in Drupal 8 that will gather a bunch of remote information for a collection of entities, cache it, and create a list of the results on its own page. The batch ...
0
votes
2answers
90 views

What's the correct way of referencing a method in a controller for running through batch processing?

I have a set of batch operations with: foreach ($urls as $url) { $test_sites[] = array('\Drupal\my_module\Controller\BatchTestSite::TestSite', $url); } When I run it I get the following: ...
3
votes
0answers
108 views

Is it possible to have a batch job run in a modal

I created a form that on submit it creates a CSV file via batch API. It works perfectly when submitting the form regularly but can't get it to work from a Ctools modal. Could it be that it just isn't ...
0
votes
1answer
101 views

How do I show a message about the currently executed operation?

I have created a batch, and it's working, but I want to control the messaging a little better. I would like to give the user some feedback about the currently executing operation, other than just ...
5
votes
3answers
6k views

Documentation or Tutorial on using Batch or Queue Services API Programmatically

I am working on importing content into my drupal 8 website from an external API that returns XML data. The calls to the API take a long time to process. When I make too many queries at once it takes ...
1
vote
2answers
1k views

How to delete stuck batch?

What is a good way to delete a stuck batch in Drupal 7? It is on a production server, we are using the Background Batch module so it shows us which one it is at admin/config/system/batch/overview. I ...
1
vote
1answer
82 views

Drupal on load balanced servers and remote db server

What are the implications of Drupal setup where files are mirrored on 2 load balanced servers and the database on a separate database server? NFS is used to keep uploaded files in sync. Does this ...
1
vote
1answer
476 views

Use static function as operations with batch API

I can't get batch to work with a static method as callback function for the operation $batch['operations'][] = ['MyController::MyMethod', [$arg]]; If I use a procedural function and call a static ...
0
votes
1answer
156 views

Batch operation keeps looping after completion

The batch operation I created works fine, until it's done. Once it's done it just loops back and does it again. It will loop through until the VM runs out of resources. I am fairly certain this ...
1
vote
2answers
446 views

How to hide form bulk operations for a specified user role in Drupal 8?

I have a view where I list user's own contents, this contains bulk operations. Users with "add article" permission can see this bulk operations thing but I would like to hide this bulk operations "...
1
vote
1answer
43 views

Modify code to use batch api?

I have a custom module written to import data from a Salesforce API and update organic group info by adding/updating/removing members from groups. I originally wrote it as a drush command for ease of ...
1
vote
1answer
23 views

How to change images without removing and re-uploading via GUI back end?

I have some images I need to change in batches on the website. For example, I want to replace all color header images with grayscale images. What I did was subsitute the old images with the new ones ...
1
vote
0answers
60 views

How to use batch in hook_uninstall?

I have big data in hook_uninstall(). How to handle this data? Can I use batch in hook_uninstall()?
0
votes
1answer
42 views

Delete entities in batches [duplicate]

Is there a way to organized entity deletion by braking into different batches? I have 700.000 entities associated with pictures that I would like to delete and I would like to perform that into ...
0
votes
1answer
892 views

How to bulk re-index the whole site for core search?

I have a website that has about 100,000 nodes. In the core search page (admin/config/search/settings) it shows that: There are 80801 items left to index. It index 100 (or at most 500) nodes per ...
3
votes
1answer
677 views

Long-running cron task never fully executed [duplicate]

I am developing a Drupal Cron that has a very long-running task. First I tried with a simple Cron, which, of course, did not work because of "Memory exhausted" PHP fatal error. Then, I developed a ...
0
votes
1answer
29 views

Assigning roles to all users during hook_install

I have a module that needs to create a new role and assign all users to that new role while it's being installed. I have the code to make this happen; however, currently I have 1500 users on my ...
2
votes
2answers
493 views

Do PHP static variables persist across Batch API batch items processing?

Do PHP static variables, which do persist during a normal page request, persist between progressive Batch API runs? What about during non-progressive (command-line) batch execution? Does &...
0
votes
1answer
59 views

Start next batch process automatically

Is it possible to start next batch_set() after finishing first one? I've some import functionality which includes 4 steps. The next step takes data processed from first batch process so this is ...
0
votes
1answer
318 views

Run Batch process every 1 hour

Currently, I have a batch process that is triggered on a form submit. With more detail, I have something like this: function mymodule_form_submit($form, &$form_state) { // call some functions ...
1
vote
2answers
410 views

How to trigger consecutive batch operations using the output of the first one?

I have 2 operations in a module using Batch API. Below is the code for the first one: function get_first_data($qc, $path) { $testsets = some array... foreach ($testsets as $testset) { $...
0
votes
0answers
37 views

Views page load indication batch api

I have created a view and put it on a custom page using panels. Sadly my query is too complicated and the page times out after about 10 seconds. On top of this i wanted my page to provide a 'loading' ...
3
votes
2answers
890 views

How to debug Batch API more efficiently?

I've some issues with Feeds importing (I don't want to focus on particular case) and I'd like to find the way of able to debug Batch API processing more efficiently. Given the fact of complexity of ...