Progress bar advances, operations does nothing I'm trying to create a batch to import users. I used this (http://pastebin.com/duTbxpgd) as an example, but somehow it's not working. I see the progress bar advancing and It's showing the right number of rows I'm processing. But what I'm trying to do in the operation function isn't executed.

Here's my code:

function form_submit($form, &amp;$form_state) {
  batch_import_users();
}

function batch_import_users() {
  db_set_active('mysqldb');

  $result = db_query("SELECT * FROM {users}");

  db_set_active('default');

  $batch = array(
    'title' =&gt; t('Importing users ...'),
    'operations' =&gt; array(),
    'init_message' =&gt; t('Commencing'),
    'progress_message' =&gt; t('Processed @current out of @total.'),
    'error_message' =&gt; t('An error occurred during processing'),
    'finished' =&gt; 'batch_import_users_finished',
    'progressive' =&gt; FALSE,
    'file' =&gt; 'users.inc',
  );

  foreach ($result as $row) {
    $batch['operations'][] = array('batch_create_user', array($row));
  }

  batch_set($batch);

  batch_process();
}

function batch_create_user($row, &amp;$context) {
  // Here I'm just trying to get some output so I know the operation is called, I'm not actually importing the users yet.

  drupal_set_message($row-&gt;uid . ' : ' . $row-&gt;login);
  dd($row-&gt;uid . ' : ' . $row-&gt;login);

  $context['results']['processed']++;
  $context['message'] = $row-&gt;login;
}

function batch_import_users_finished($success, $results, $operations) {
  if ($success) {
    drupal_set_message('Importing users has finished.');
  }
  else {
    drupal_set_message('Some error.');
  }
}


Am I missing something or doing something wrong? Any help is very much appreciated.
Try below code 

$operations = array();
foreach ($result as $row) {
  $operations[] = array('batch_create_user', array($row));
}

$batch = array(
  'title' =&gt; t('Importing users ...'),
  'operations' =&gt; $operations,
  'init_message' =&gt; t('Commencing'),
  'progress_message' =&gt; t('Processed @current out of @total.'),
  'error_message' =&gt; t('An error occurred during processing'),
  'finished' =&gt; 'batch_import_users_finished',
  'file' =&gt; drupal_get_path('module', 'user') . '/' . 'user.inc',
);


Also add path to redirect after batch process

batch_process();