Run the UDF single-threaded, optionally with progress bar
191866
def _apply_st(self, doc_loader, **kwargs):
        """"""
        udf = self.udf_class(**self.udf_init_kwargs)

        # Run single-thread
        for doc in doc_loader:
            if self.pb is not None:
                self.pb.update(1)

            udf.session.add_all(y for y in udf.apply(doc, **kwargs))

        # Commit session and close progress bar if applicable
        udf.session.commit()
1299329
def run(self, stdscr):
        
        self.win = stdscr
        curses.curs_set(0)
        stdscr.timeout(0)
        curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_RED, curses.COLOR_BLACK)
        while True:
            self.refresh(True)
            now = time.time()
            while time.time() - now < self._refresh_rate:
                time.sleep(0.1)
                self.refresh(False)
468087
function Runnable(title, fn) {
  this.title = title;
  this.fn = fn;
  this.async = fn && fn.length;
  this.sync = ! this.async;
  this._timeout = 2000;
  this._slow = 75;
  this.timedOut = false;
}
657574
def init_progress_bar(self):
        """"""
        # Forked worker processes can't show progress bars.
        disable = MapReduce._forked or not config.PROGRESS_BARS

        # Don't materialize iterable unless we have to: huge iterables
        # (e.g. of `KCuts`) eat memory.
        if disable:
            total = None
        else:
            self.iterable = list(self.iterable)
            total = len(self.iterable)

        return tqdm(total=total, disable=disable, leave=False,
                    desc=self.description)
523804
def _thread_worker_fn(samples, batchify_fn, dataset):
    """"""
    if isinstance(samples[0], (list, tuple)):
        batch = [batchify_fn([dataset[i] for i in shard]) for shard in samples]
    else:
        batch = batchify_fn([dataset[i] for i in samples])
    return batch
1233101
def run_after_async(seconds, func, *args, **kwargs):
    """"""
    t = Timer(seconds, func, args, kwargs)
    t.daemon = True
    t.start()
    return t
114355
function runSync (fn, repeatTest = 0, args = []) {
    return (resolve, reject) =>
        Fiber(() => executeSync.call(this, fn, repeatTest, args).then(() => resolve(), reject)).run()
}
203099
def progressbar(
		iterable=None, length=None, label=None,
		show_eta=True, show_percent=None, show_pos=False, item_show_func=None,
		fill_char='#', empty_char='-', bar_template='%(label)s [%(bar)s] %(info)s', info_sep=' ',
		width=36, file=None, color=None):
	""""""
	
	try:
		return IPyBackend(iterable, length, label=label,
			show_eta=show_eta, show_percent=show_percent, show_pos=show_pos,
			item_show_func=item_show_func, info_sep=info_sep)
	except (ImportError, RuntimeError): #fall back if ipython is not installed or no notebook is running
		return click.progressbar(
			iterable, length, label,
			show_eta, show_percent, show_pos, item_show_func,
			fill_char, empty_char, bar_template, info_sep,
			width, file, color)
1108822
def run(cmd, filename=None, threads=True, verbose=False):
    """"""
    _run(threads, verbose, 'run', filename, cmd)
419160
def run_pyvcf(args):
    """"""
    # open VCF reader
    reader = vcf.Reader(filename=args.input_vcf)
    # optionally, open VCF writer
    writer = None
    # read through input VCF file, optionally also writing out
    start = time.clock()
    num = 0
    for num, r in enumerate(reader):
        if num % 10000 == 0:
            print(num, "".join(map(str, [r.CHROM, ":", r.POS])), sep="\t", file=sys.stderr)
        if writer:
            writer.write_record(r)
        if args.max_records and num >= args.max_records:
            break
    end = time.clock()
    print("Read {} records in {} seconds".format(num, (end - start)), file=sys.stderr)
703392
def request_finished(key):
    
    with event_lock:
        threads[key] = threads[key][1:]

        if threads[key]:
            threads[key][0].run()
1157129
def run_locally(self):
        """"""
        self.thread = threading.Thread(target=self.execute_locally)
        self.thread.daemon = True # So that they die when we die
        self.thread.start()
1007631
def run(self):
        """"""
        event_handler = Handler()
        threads = []
        paths = [os.path.join(cwd, "content"), os.path.join(cwd, "templates")]

        for i in paths:
            targetPath = str(i)
            self.observer.schedule(event_handler, targetPath, recursive=True)
            threads.append(self.observer)

        self.observer.start()

        try:
            while True:
                time.sleep(5)
        except:
            self.observer.stop()
            print("\nObserver stopped.")

        self.observer.join()
726564
async def _thread_coro(self, *args):
        
        return await self._loop.run_in_executor(
            self._executor, self._function, *args)
142335
private void updateProgressBar(Progress prog, JProgressBar pbar) {
    if(prog instanceof FiniteProgress) {
      pbar.setValue(((FiniteProgress) prog).getProcessed());
      pbar.setString(((FiniteProgress) prog).toString());
    }
    else if(prog instanceof IndefiniteProgress) {
      pbar.setValue(((IndefiniteProgress) prog).getProcessed());
      pbar.setString(((IndefiniteProgress) prog).toString());
    }
    else if(prog instanceof MutableProgress) {
      pbar.setValue(((MutableProgress) prog).getProcessed());
      pbar.setMaximum(((MutableProgress) prog).getProcessed());
      pbar.setString(((MutableProgress) prog).toString());
    }
    else {
      throw new RuntimeException("Unsupported progress record");
    }
  }
710164
def run(self, data_cb):
        """"""
        if self._error:
            err = self._error
            if isinstance(self._error, KeyboardInterrupt):
                # KeyboardInterrupt is not destructive(it may be used in
                # the REPL).
                # After throwing KeyboardInterrupt, cleanup the _error field
                # so the loop may be started again
                self._error = None
            raise err
        self._on_data = data_cb
        if threading.current_thread() == main_thread:
            self._setup_signals([signal.SIGINT, signal.SIGTERM])
        debug('Entering event loop')
        self._run()
        debug('Exited event loop')
        if threading.current_thread() == main_thread:
            self._teardown_signals()
            signal.signal(signal.SIGINT, default_int_handler)
        self._on_data = None
1003575
def run_single_with_display(wf, display):
    """"""
    S = Scheduler(error_handler=display.error_handler)
    W = Queue() \
        >> branch(log_job_start.to(sink_map(display))) \
        >> worker \
        >> branch(sink_map(display))

    return S.run(W, get_workflow(wf))