Run only once at the start of the pass.
961374
function init (dirname, done) {
    dirname = path.join(basedir, dirname)
    fs.access(dirname, function (err) {
      if (err) return done()
      readdir(dirname, function (err, _list) {
        if (err) return done(err)
        list = list.concat(_list)
        done()
      })
    })
  }
381330
def run(self, once=False):
        """"""
        self._once = once
        self.start()
        while self.running:
            try:
                time.sleep(1.0)
            except KeyboardInterrupt:
                self.stop()
                self.join()
618205
def skip(self, steps=1):
        """"""
        for _ in six.moves.range(steps):
            self.next_token()
1213933
def run_once(self):
        """"""
        while self._topics_to_add:
            self._client.add_topic(self._topics_to_add.pop())

        # get the list of partitions with data ready to send
        result = self._accumulator.ready(self._metadata)
        ready_nodes, next_ready_check_delay, unknown_leaders_exist = result

        # if there are any partitions whose leaders are not known yet, force
        # metadata update
        if unknown_leaders_exist:
            log.debug('Unknown leaders exist, requesting metadata update')
            self._metadata.request_update()

        # remove any nodes we aren't ready to send to
        not_ready_timeout = float('inf')
        for node in list(ready_nodes):
            if not self._client.is_ready(node):
                log.debug('Node %s not ready; delaying produce of accumulated batch', node)
                self._client.maybe_connect(node, wakeup=False)
                ready_nodes.remove(node)
                not_ready_timeout = min(not_ready_timeout,
                                        self._client.connection_delay(node))

        # create produce requests
        batches_by_node = self._accumulator.drain(
            self._metadata, ready_nodes, self.config['max_request_size'])

        if self.config['guarantee_message_order']:
            # Mute all the partitions drained
            for batch_list in six.itervalues(batches_by_node):
                for batch in batch_list:
                    self._accumulator.muted.add(batch.topic_partition)

        expired_batches = self._accumulator.abort_expired_batches(
            self.config['request_timeout_ms'], self._metadata)
        for expired_batch in expired_batches:
            self._sensors.record_errors(expired_batch.topic_partition.topic, expired_batch.record_count)

        self._sensors.update_produce_request_metrics(batches_by_node)
        requests = self._create_produce_requests(batches_by_node)
        # If we have any nodes that are ready to send + have sendable data,
        # poll with 0 timeout so this can immediately loop and try sending more
        # data. Otherwise, the timeout is determined by nodes that have
        # partitions with data that isn't yet sendable (e.g. lingering, backing
        # off). Note that this specifically does not include nodes with
        # sendable data that aren't ready to send since they would cause busy
        # looping.
        poll_timeout_ms = min(next_ready_check_delay * 1000, not_ready_timeout)
        if ready_nodes:
            log.debug("Nodes with data ready to send: %s", ready_nodes) # trace
            log.debug("Created %d produce requests: %s", len(requests), requests) # trace
            poll_timeout_ms = 0

        for node_id, request in six.iteritems(requests):
            batches = batches_by_node[node_id]
            log.debug('Sending Produce Request: %r', request)
            (self._client.send(node_id, request, wakeup=False)
                 .add_callback(
                     self._handle_produce_response, node_id, time.time(), batches)
                 .add_errback(
                     self._failed_produce, batches, node_id))

        # if some partitions are already ready to be sent, the select time
        # would be 0; otherwise if some partition already has some data
        # accumulated but not ready yet, the select time will be the time
        # difference between now and its linger expiry time; otherwise the
        # select time will be the time difference between now and the
        # metadata expiry time
        self._client.poll(poll_timeout_ms)
1330411
def stop(self):
        
        if not self.is_running():
            raise RuntimeError('Not started')
        running, self._running = self._running, None
        try:
            next(running)
        except StopIteration:
            # expected.
            pass
        else:
            raise TypeError('run() must yield just one time')
794818
def on_train_begin(self, **kwargs:Any)->None:
        ""
        self.wait, self.opt = 0, self.learn.opt
        super().on_train_begin(**kwargs)
560478
protected function beforeRun()
    {
        $this->reset();
        $pass = $this->callHookHandler('beforeRun');
        if ($pass) {
            $this->status = static::RUNNING; 
            $this->time['started_at'] = microtime();
        }

        return $pass;
    }
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
102887
def reset(self):
        
        self._start = 0
        self._first_start = 0
        self._stop = time.perf_counter()
        self._array = None
        self._array_len = 0
        self.intervals = []
        self._intervals_len = 0
1347370
def run(self):
        """"""
        self._logger.info('starting all runners')
        try:
            with self._lock:
                assert not self.running.set(), 'cannot re-run: %s' % self
                self.running.set()
            thread_runner = self.runners[threading]
            for runner in self.runners.values():
                if runner is not thread_runner:
                    thread_runner.register_payload(runner.run)
            if threading.current_thread() == threading.main_thread():
                asyncio_main_run(root_runner=thread_runner)
            else:
                thread_runner.run()
        except Exception as err:
            self._logger.exception('runner terminated: %s', err)
            raise RuntimeError from err
        finally:
            self._stop_runners()
            self._logger.info('stopped all runners')
            self.running.clear()
268342
void startPass(String passName) {
    checkState(currentTracer == null);
    currentPassName = passName;
    currentTracer = newTracer(passName);
    beforePass(passName);
  }
148573
void copyFrom(BidiRun run)
    {
        this.start = run.start;
        this.limit = run.limit;
        this.level = run.level;
        this.insertRemove = run.insertRemove;
    }
962736
def execute_once(self):
        """"""
        symbol = self.tape.get(self.head, self.EMPTY_SYMBOL)

        index = self.alphabet.index(symbol)
        rule = self.states[self.state][index]

        if rule is None:
            raise RuntimeError('Unexpected symbol: ' + symbol)

        self.tape[self.head] = rule[0]

        if rule[1] == 'L':
            self.head -= 1
        elif rule[1] == 'R':
            self.head += 1

        self.state = rule[2]
642887
def handle_one_request(self):
        """"""
        self.raw_requestline = self.rfile.readline()
        if not self.raw_requestline:
            self.close_connection = 1
        elif self.parse_request():
            return self.run_wsgi()
713840
def run_once(function, state={}, errors={}):
    """"""
    @six.wraps(function)
    def _wrapper(*args, **kwargs):
        if function in errors:
            # Deliberate use of LBYL.
            six.reraise(*errors[function])

        try:
            return state[function]
        except KeyError:
            try:
                state[function] = result = function(*args, **kwargs)
                return result
            except Exception:
                errors[function] = sys.exc_info()
                raise
    return _wrapper
110627
function onceify(f) {
  var ran, ret;
  return function() {
    return ran ? ret : (ran=true, ret=f.apply(this,arguments));
  };
}
66525
function onetime() {
        if (called) return value;

        called = 1;
        value = fn.apply(this, arguments);
        fn = null;

        return value;
      }