I've updated the documentation for Processing batch jobs with drush to reflect this problem and provide a way around it.

In my case, core functions like node_save() were executed but not the functions in my .module file;

this worked: $batch['operations'][] = array('node_save', $a_args);

this didn't work: $batch['operations'][] = array('my_module_function', $a_args);

However, once I set $batch['file'] to the path of the .module file

$batch['file'] = drupal_get_path('module', 'mydrushmodule') . '/mydrushmodule.module';

the functions were executed.

I assume that if a function is within a .module file and the module has been installed and activated, the regular core batch_process() can find and execute any functions in that .module file and that drush_backend_batch_process() should also find and execute them.

Comments

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.