Batch API processes next operation if existing operation is taking too much time
I have achieved this using php.

Here is the sample code

$operations[] = array('batch_function_1');
$operations[] = array('batch_function_2');

$batch = array(
  'title' =&gt; t('Processing'),
  'operations' =&gt; $operations,
  'init_message' =&gt; t('Please wait processing is starting.....'),
  'progress_message' =&gt; t('Processed @current out of @total.'),
  'error_message' =&gt; t('Processing has encountered an error.'),
  'finished' =&gt; 'processing_finished',
);

batch_set($batch);


In case of soap I achieved using default_socket_timeout

function batch_function_1 () {
  ini_set("default_socket_timeout", $time);
  try{
    $client = new SoapClient($path_to_wsdl));
  }
  catch(Exception $e) {
    dpm('Timeout'); // echo 'Timeout';                                                                                                        
  }
}


And timeout when using exec.

function batch_function_2 () {
  // $command : Which needs to be executed for communicating with server.                                                                       
  exec("timeout {$time} {$command}", $output);
}


I also tried the set_time_limit which was not working with batch api.