Method to create a metastore client that retries on failures
977575
private IMetaStoreClient createRetryingMetaStoreClient(final HiveConf hiveConf)
      throws MetaException {
    // Custom hook-loader to return a HiveMetaHook if the table is configured with a custom storage handler
    final HiveMetaHookLoader hookLoader = new HiveMetaHookLoader() {
      @Override
      public HiveMetaHook getHook(final Table tbl) throws MetaException {
        if (tbl == null) {
          return null;
        }

        try {
          final HiveStorageHandler storageHandler =
              HiveUtils.getStorageHandler(hiveConf, tbl.getParameters().get(META_TABLE_STORAGE));
          return storageHandler == null ? null : storageHandler.getMetaHook();
        } catch (final HiveException e) {
          HadoopSecurityManager_H_2_0.logger.error(e.toString());
          throw new MetaException("Failed to get storage handler: " + e);
        }
      }
    };

    return RetryingMetaStoreClient
        .getProxy(hiveConf, hookLoader, HiveMetaStoreClient.class.getName());
  }
567966
def retry_failed(options)
      raise "Couldn't parse retry interval from attributes" unless options[:wait].nil? || options[:wait].is_a?(AS::Duration)

      wait = options[:wait] || 1.second
      retries = options[:retries] || 1

      @metadata[:retry_failed] = {
        wait: wait,
        retries: retries
      }
    end
957195
function Retry(conf) {
  component.Component.call(this, 'controller', conf);
  this.registerGearman(conf.servers, {
    client: true,
    worker: {
      func_name: 'retryController',
      func: _.bind( function(json_string, worker) {
        try {
          // TODO: this parsing and meta parameter storing should be encapsulated into a Task class
          var task = JSON.parse( json_string.toString() );
          task._task_json_string = json_string;
          task._task_worker = worker;

          this.execute_task( task );
        }
        catch ( e ) {
          _err( 'Error executing retryController with following payload:', json_string );
        }
      }, this )
    }
  });
}
125225
def mongo_retry(f):
    
    log_all_exceptions = 'arctic' in f.__module__ if f.__module__ else False

    @wraps(f)
    def f_retry(*args, **kwargs):
        global _retry_count, _in_retry
        top_level = not _in_retry
        _in_retry = True
        try:
            while True:
                try:
                    return f(*args, **kwargs)
                except (DuplicateKeyError, ServerSelectionTimeoutError) as e:
                    # Re-raise errors that won't go away.
                    _handle_error(f, e, _retry_count, **_get_host(args))
                    raise
                except (OperationFailure, AutoReconnect) as e:
                    _retry_count += 1
                    _handle_error(f, e, _retry_count, **_get_host(args))
                except Exception as e:
                    if log_all_exceptions:
                        _log_exception(f.__name__, e, _retry_count, **_get_host(args))
                    raise
        finally:
            if top_level:
                _in_retry = False
                _retry_count = 0
    return f_retry
1123694
function (callback) {
        debug('');
        async.parallel([

          // prepare sagaStore...
          function (callback) {
            debug('prepare sagaStore...');

            self.sagaStore.on('connect', function () {
              self.emit('connect');
            });

            self.sagaStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.sagaStore.connect(callback);
          },

          // prepare revisionGuard...
          function (callback) {
            debug('prepare revisionGuard...');
            if (!self.revisionGuardStore) {
              return callback(null);
            }

            self.revisionGuardStore.on('connect', function () {
              self.emit('connect');
            });

            self.revisionGuardStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.revisionGuardStore.connect(callback);
          }
        ], callback);
      }
1071933
def retry(self, retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504)):
        
        retries = Retry(
            total=retries,
            read=retries,
            connect=retries,
            backoff_factor=backoff_factor,
            status_forcelist=status_forcelist,
        )
        # mount all https requests
        self.mount('https://', adapters.HTTPAdapter(max_retries=retries))
143092
function MongoStore(uri, options) {
        var self = this;

        this.options = options || (options = {});
        options.collectionName = options.collectionName || 'sessions';
        // 1 day
        options.ttl = options.ttl || 24 * 60 * 60 * 1000;
        // 60 s
        options.cleanupInterval = options.cleanupInterval || 60 * 1000;
        options.server = options.server || {};
        options.server.auto_reconnect = options.server.auto_reconnect != null ? options.server.auto_reconnect : true;

        this._error = function(err) {
            if (err) { self.emit('error', err); }
        };

        // It's a Db instance.
        if (uri.collection) {
            this.db = uri;
            this._setup();
        } else {
            MongoClient.connect(uri, options, function(err, db) {
                if (err) { return self._error(err); }
                self.db = db;
                self._setup();
            });
        }
    }
563301
async def retry_create_artifact(*args, **kwargs):
    
    await retry_async(
        create_artifact,
        retry_exceptions=(
            ScriptWorkerRetryException,
            aiohttp.ClientError
        ),
        args=args,
        kwargs=kwargs
    )
534848
def make_store(name, min_length=4, **kwargs):
   
  
   if name not in stores:
      raise ValueError('valid stores are {0}'.format(', '.join(stores)))

   if name == 'memcache':
      store = MemcacheStore
   elif name == 'memory':
      store = MemoryStore
   elif name == 'redis':
      store = RedisStore

   return store(min_length=min_length, **kwargs)
1183510
def retry_on_bad_auth(func):
    """"""
    @wraps(func)
    def retry_version(self, *args, **kwargs):
        while True:
            try:
                return func(self, *args, **kwargs)
            except trolly.ResourceUnavailable:
                sys.stderr.write('bad request (refresh board id)\n')
                self._board_id = None
                self.save_key('board_id', None)
            except trolly.Unauthorised:
                sys.stderr.write('bad permissions (refresh token)\n')
                self._client = None
                self._token = None
                self.save_key('token', None)
    return retry_version
805497
def cli(env, volume_id, replicant_id, immediate):
    """"""
    block_storage_manager = SoftLayer.BlockStorageManager(env.client)

    success = block_storage_manager.failover_to_replicant(
        volume_id,
        replicant_id,
        immediate
    )

    if success:
        click.echo("Failover to replicant is now in progress.")
    else:
        click.echo("Failover operation could not be initiated.")
1320712
@Override
    public RetryingRpcClient build(Client<RpcRequest, RpcResponse> delegate) {
        return new RetryingRpcClient(
                delegate, retryStrategyWithContent(), maxTotalAttempts(),
                responseTimeoutMillisForEachAttempt());
    }
663439
def copy(self):
        """"""
        return Retry(max_tries=self.max_tries, delay=self.delay, backoff=self.backoff,
                     max_jitter=self.max_jitter / 100.0, max_delay=self.max_delay, sleep_func=self.sleep_func,
                     deadline=self.deadline, retry_exceptions=self.retry_exceptions)
110430
function(err) {
      if (!err) {
        loadData(app, apimanager, models, true, uid);
      }
      if (!apimanager.host) {
        //monitor the file changes, load data again if any changes
        fs.watch(definitionsDir, function(event, filename) {
          if (filename !== '.datastore') {
            logger.debug('File changed in %s%s, reload data', definitionsDir, filename);
            loadData(app, apimanager, models, false, uid);
          }
        });
      }
    }
553658
def retry_failure(self, tenant_id, tenant_name, fw_data, is_fw_virt,
                      result):
        
        try:
            with self.mutex_lock:
                ret = self.retry_failure_internal(tenant_id, tenant_name,
                                                  fw_data, is_fw_virt, result)
        except Exception as exc:
            LOG.error("Exception raised in create fabric %s", str(exc))
            return False
        return ret
282
def retry(self):
        

        if self.connector is None:
            raise ValueError("No connector to retry")
        if self.service is None:
            return
        self.connector.connect()
1337014
function Client (config) {
  this.token = null

  this.publicKey = config.publicKey || config.public_key

  this.baseUrl = 'https://api.marketcloud.it'

  // Marketcloud's api is versioned by URL
  // for instance, the current api is api.marketcloud.it/v0/<endpoint>
  this.apiVersion = 'v0'

  // If this is true, then api responses with status code >= 400
  //  are rejected as errors.
  //  If set to false all responses from server are resolved
  //
  //  In both cases, "failures" are rejected.
  this.rejectApiErrors = config.rejectApiErrors || true

  // Creating resources instances
  this.addresses = new Addresses(this)
  this.brands = new Brands(this)
  this.categories = new Categories(this)
  this.carts = new Carts(this)
  this.collections = new Collections(this)
  this.coupons = new Coupons(this)
  this.products = new Products(this)
  this.orders = new Orders(this)
  this.invoices = new Invoices(this)
  this.users = new Users(this)
  this.contents = new Contents(this)
  this.files = new Media(this)
  this.media = this.files
  this.promotions = new Promotions(this)
  this.shippingMethods = new ShippingMethods(this)
  this.shippings = this.shippingMethods
  this.payments = new Payments(this)
  this.paymentMethods = new PaymentMethods(this)
  this.variables = new Variables(this)

  // Done retries for failed requests
  this.RETRIES = 0
    // Maximum number of retries for failed requests
  this.MAX_RETRIES = 2

  // This is a handy reference for better testability
  // and observability of the whole client.
  this.LAST_REQUEST = null

  // Trying to resume a previously created session
  // from this device.
  //
  // By default this uses localStorage and it gets prefixed
  // with Marketcloud.Storage.prefix
  //
  // We suggest to change the prefix to some strong unique to your app
  // such as 'myStore_'. This way all keys will be namespaced with myStore_ .
  if (Storage.get('AuthenticatedUserToken')) {
    this.token = Storage.get('AuthenticatedUserToken')
    this.currentUser = JSON.parse(Storage.get('AuthenticatedUserData'))
  }
}