Continuing an interrupted batch
So I think there is no way to tell batch to restart when it's gotten an error response. What you could do is to not return a possible error but rather re-try the request using your own wrapper. So could do 

try {

  $TestRetry = new TestRetry();
  return $TestRetry-&gt;test();
}
// And I think you won't need this but handle the exception in your wrapper class.
catch (Exception $e) {
  watchdog_exception('scrape', $e);
  return FALSE;
}


and in your wrapper, you could attempt to retry the request to avoid an error. So your wrapper may look like this:

&lt;?php

use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;

class TestRetry {

  public function test() {
    $handlerStack = HandlerStack::create(new CurlHandler());
    $handlerStack-&gt;push(Middleware::retry($this-&gt;retryDecider(), $this-&gt;retryDelay()));
    $client = new Client(array('handler' =&gt; $handlerStack));

    $response = $client-&gt;request(
      'GET',
// @todo replace to a real url!!!
      'https://500-error-code-url'
    )-&gt;getBody()-&gt;getContents();

    return \GuzzleHttp\json_decode($response, TRUE);
  }


  public function retryDecider() {
    return function (
      $retries,
      Request $request,
      Response $response = NULL,
      RequestException $exception = NULL
    ) {
// Limit the number of retries to 5
      if ($retries &gt;= 5) {
        return FALSE;
      }

// Retry connection exceptions
      if ($exception instanceof ConnectException) {
        return TRUE;
      }

      if ($response) {
// Retry on server errors
        if ($response-&gt;getStatusCode() &gt;= 500) {
          return TRUE;
        }
      }

      return FALSE;
    };
  }

  /**
   * delay 1s 2s 3s 4s 5s
   *
   * @return Closure
   */
  public function retryDelay() {
    return function ($numberOfRetries) {
      return 1000 * $numberOfRetries;
    };
  }
}