Questions tagged [batch-operations]
Use it for questions about the core API that allows developers to split a big task in several minor chunks or batches.
143 questions
2 votes
0 answers
34 views
How can I print $context['message'] before execution?
Within a batch step, $context['message'] defines what will show up above the progress bar in the UI. However, it seems it shows up after the execution of the step finished, which makes sense. I have ...
0 votes
1 answer
117 views
Storage issue in batch process
We have developed a batch process to fetch entities and retrieve the necessary details. Given the large number of entities, the process handles them in chunks of 100. We are not storing the processed ...
0 votes
2 answers
74 views
Duplicate nodes in batch
I'm trying to write a module to duplicate a series of nodes and to make sure there is no timeout I want to use the Batch Api for this. This is what I have at this moment in src/Controller/...
0 votes
0 answers
224 views
Unable to process Batch actions as Administrator
I'm working with a brand new install of Drupal 10 and am having issues with the administrator account (both the default one created at startup and my own personal account) having 'Access Denied' ...
1 vote
0 answers
101 views
How can i exit out of a batch process in Drupal 10 or make the operation as a fail?
In the event of a runtime error on a custom batch process how can i either quit the entire batch process or mark that the process was not able to complete?
2 votes
2 answers
431 views
Deleting entities using Batch API without a form or user interface
In a custom Drupal 9 module, I need to delete entities using Batch API without a form or user interface. The list of entity IDs are generated and the batch is built in hook_views_post_execute(). When ...
2 votes
0 answers
139 views
How to handle batch operations when the user machine gets into suspended mode?
I'm importing a large dataset into the database using the BatchBuilder in Drupal. It takes more than one and a half hours to complete all the operations in the batch. The process starts with user ...
1 vote
0 answers
960 views
batch_set results in TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback
I am trying to set a batch from a confirmation form. When it is submitted, this is the code: $operations = []; $operations[] = [ [UpdateEntity::class, 'execute'], ['field_group'] ]; $batch = ...
3 votes
1 answer
2k views
How do I programmatically add images to a node?
I have a content type to which I added an image field. The database has a custom table with different columns, including the image ID. Previously, I created a batch that writes data from this table to ...
1 vote
2 answers
512 views
Batch API drush command running once then shows Solr error
I am trying to create a drush command to run a batch process. When I run the command, the batch runs just once, and I get this error : in Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase-&...
1 vote
0 answers
200 views
Why might a batch initiated in hook_install() sometimes not process?
I have two modules, module_alpha and module_beta. Both modules install a database table with hook_schema() which they use to track information about published nodes. Data is logged in the table with ...
1 vote
1 answer
1k views
How can I fix "Allowed memory size exhausted" on batch finish?
The batch processed all the items, but instead of showing the finish message, I see the error "Allowed memory size of 536870912 bytes exhausted". When I debug the code, I notice that Drupal ...
0 votes
0 answers
680 views
Batch Error: Using $this when not in object context, so Can I call batch method in non static way?
The existing code when a form is submitted I execute this batch : /** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $node_titles = ['node1', '...
1 vote
1 answer
1k views
How to know if a batch process is still running?
I have a form with 5 buttons and each button run a different batch, some batch processes take several minutes. I want to block the button if the batch processes is already running, because other user ...
0 votes
1 answer
404 views
Batch processing possible without redirects?
I'm using the Views Data Export module for exporting Views as .csv. Standard exports work in most cases, but with larger table only batch exports work. The problem with batch exports is that the ...