Pauses the execution if sevenbridges api is under maintenance.
    :param api: Api instance.
    :param response: requests.Response object.
    :param sleep: Time to sleep in between the requests.
359710
def maintenance_sleeper(api, response, sleep=300):
    
    while response.status_code == 503:
        logger.info('Service unavailable: Response=[%s]',
                    six.text_type(response.__dict__))
        response_body = response.json()
        if 'code' in response_body:
            if response_body['code'] == 0:
                logger.warning('API Maintenance in progress!'
                               ' Waiting for [%s]s', sleep)
                time.sleep(sleep)
                response = api.session.send(response.request)
            else:
                return response
        else:
            return response
    return response
243109
def pause(self, container):
        
        url = self._url('/containers/{0}/pause', container)
        res = self._post(url)
        self._raise_for_status(res)
645550
function pause(req, res) {
  res.send(null, Constants.OK);
  this.state.pause(req.args[0]);
}
593777
def interruptible_sleep(t, event=None):
    
    log.info("sleeping %s", t)

    if event is None:
        time.sleep(t)
        return False
    else:
        return not event.wait(t)
1063348
def wait_response(self):
        ''''''
        responses = self.read()
        while not responses:
            responses = self.read()
        return responses
1242044
def pause(self):
		
		if self.status == RUNNING:
			self.status = PAUSED
			self.previous_intervals.append(time.time() - self.interval_start)
			self.current_interval_duration = 0.0
		elif self.status == PAUSED:
			self.interval_start = time.time()
			self.status = RUNNING
829710
private function _process_paused() {

        // copy all requests to another variable
        $urls = $this->_requests;

        // while there are URLs to process
        while (!empty($urls)) {

            // get from the entire list of requests as many as specified by the "threads" property
            $this->_requests = array_splice($urls, 0, $this->threads, array());

            // process those requests
            $this->_process();

            // wait for as many seconds as specified by the "pause_interval" property
            if (!empty($urls)) sleep($this->pause_interval);

        }

    }
1216773
def pause(self, message=None, verbose=False):
        

        PARAMS=set_param(["message"],[message])
        response=api(url=self.__url+"/pause", PARAMS=PARAMS, verbose=verbose)
        return response
1357047
def debug_sleep(self, timeout):
        """"""
        fut = self.execute(b'DEBUG', b'SLEEP', timeout)
        return wait_ok(fut)
132815
def wait_for_service_available(container, url, timeout):
    
    start = time.time()
    remaining = timeout
    while True:
        remaining = start + timeout - time.time()
        if remaining < 0:
            raise ServiceTimeout
        try:
            response = get(url,
                timeout=min(remaining, REQUEST_TIMEOUT_SECONDS))
            if 500 <= response.status_code < 600:
                return False
            return True
        except (ConnectionError, Timeout):
            pass
        if not inspect_container(container)['State']['Running']:
            return False

        remaining = start + timeout - time.time()
        delay = max(0, min(RETRY_DELAY_SECONDS, remaining))
        time.sleep(delay)

    raise ServiceTimeout
1312168
def on_pause_request(self, py_db, request):
        '''
        
        '''
        arguments = request.arguments  # : :type arguments: PauseArguments
        thread_id = arguments.threadId

        self.api.request_suspend_thread(py_db, thread_id=thread_id)

        response = pydevd_base_schema.build_response(request)
        return NetCommand(CMD_RETURN, 0, response, is_json=True)
115129
def resume(self):
        
        if self._status != TransferState.PAUSED:
            self._running.set()
            self._status = TransferState.RUNNING
        else:
            raise SbgError('Can not pause. Download not in PAUSED state.')
1068868
def delay(self):
        """"""
        if self.next_request_timestamp is None:
            return
        sleep_seconds = self.next_request_timestamp - time.time()
        if sleep_seconds <= 0:
            return
        message = "Sleeping: {:0.2f} seconds prior to" " call".format(
            sleep_seconds
        )
        log.debug(message)
        time.sleep(sleep_seconds)
757967
def execute(self, ignore_cache=False):
        
        if ignore_cache or not hasattr(self, '_response'):
            es = connections.get_connection(self._using)

            self._response = self._response_class(
                self,
                es.search(
                    index=self._index,
                    body=self.to_dict(),
                    **self._params
                )
            )
        return self._response
675316
def run_after_response(seconds, *command)
      logger.debug "Power API scheduling in #{seconds} seconds: #{command.inspect}"
      Thread.start do
        begin
          sleep seconds
          logger.debug "Power API executing: #{command.inspect}"
          if (sudo = which('sudo'))
            status = system(sudo, *command)
          else
            logger.warn "sudo binary was not found"
          end
          # only report errors
          logger.warn "The attempted command failed with code #{$?.exitstatus}" unless status
        rescue Exception => e
          logger.error "Error during command execution: #{e}"
        end
      end
    end
634247
async def sleep_async(self, seconds):
        
        try:
            await self.lock_async()
            await asyncio.sleep(seconds)
        except asyncio.TimeoutError:
            _logger.debug("Connection %r timed out while waiting for lock acquisition.", self.container_id)
        finally:
            self.release_async()
1186845
def pause(self, id, when=None): # pylint: disable=invalid-name,redefined-builtin
        
        return self.service.post(self.base+str(id)+'/pause/', params={'when': when})