Starts a Gevent pool and run a map. Takes care of setting current_job and cleaning up.
519280
def subpool_map(pool_size, func, iterable):
    

    from .context import get_current_job, set_current_job, log

    if not pool_size:
        return [func(*args) for args in iterable]

    counter = itertools_count()

    current_job = get_current_job()

    def inner_func(*args):
        """ As each call to 'func' will be done in a random greenlet of the subpool, we need to
            register their IDs with set_current_job() to make get_current_job() calls work properly
            inside 'func'.
        """
        next(counter)
        if current_job:
            set_current_job(current_job)

        try:
          ret = func(*args)
        except Exception as exc:
          trace = traceback.format_exc()
          exc.subpool_traceback = trace
          raise

        if current_job:
            set_current_job(None)
        return ret

    def inner_iterable():
        """ This will be called inside the pool's main greenlet, which ID also needs to be registered """
        if current_job:
            set_current_job(current_job)

        for x in iterable:
            yield x

        if current_job:
            set_current_job(None)

    start_time = time.time()
    pool = gevent.pool.Pool(size=pool_size)
    ret = pool.map(inner_func, inner_iterable())
    pool.join(raise_error=True)
    total_time = time.time() - start_time

    log.debug("SubPool ran %s greenlets in %0.6fs" % (counter, total_time))

    return ret
611511
def start_thread
      begin
        @logger.info("New pool thread is starting (#{self})")
        until(@kill) do
          begin
            @action = nil
            if(@pool.size > @pool.min && !@thread_timeout.zero?)
              Timeout::timeout(@thread_timeout) do
                @action = @pool.action
              end
            else
              @action = @pool.action
            end
            run(@action[0], @action[1]) unless @action.nil?
          rescue Timeout::Error
            @kill = true
          rescue Wakeup
            @logger.info("Thread #{::Thread.current} was woken up.")
          rescue Retimeout
            @logger.warn('Thread was woken up to reset thread timeout')
          rescue Exception => boom
            @logger.error("Pool thread caught an exception: #{boom}\n#{boom.backtrace.join("\n")}")
            @respond_to.raise boom
          end
        end
      rescue Retimeout
        @logger.warn('Thread was woken up to reset thread timeout')
        retry
      rescue Wakeup
        @logger.info("Thread #{::Thread.current} was woken up.")
      rescue Exception => boom
        @logger.error("Pool thread caught an exception: #{boom}\n#{boom.backtrace.join("\n")}")
        @respond_to.raise boom
      ensure
        @logger.info("Pool thread is shutting down (#{self})")
        @pool.remove(self)
      end
    end
1055393
@Override
	public void run() {

		final long currentTime = System.currentTimeMillis();

		synchronized (this.collectedEvents) {

			final Iterator<JobID> it = this.collectedEvents.keySet().iterator();
			while (it.hasNext()) {

				final JobID jobID = it.next();
				final List<AbstractEvent> eventList = this.collectedEvents.get(jobID);
				if (eventList == null) {
					continue;
				}

				final Iterator<AbstractEvent> it2 = eventList.iterator();
				while (it2.hasNext()) {

					final AbstractEvent event = it2.next();
					// If the event is older than TIMERTASKINTERVAL, remove it
					if ((event.getTimestamp() + this.timerTaskInterval) < currentTime) {
						archiveEvent(jobID, event);
						it2.remove();
					}
				}

				if (eventList.isEmpty()) {
					it.remove();
				}
			}
		}

		synchronized (this.recentJobs) {

			final Iterator<Map.Entry<JobID, RecentJobEvent>> it = this.recentJobs.entrySet().iterator();
			while (it.hasNext()) {

				final Map.Entry<JobID, RecentJobEvent> entry = it.next();
				final JobStatus jobStatus = entry.getValue().getJobStatus();

				// Only remove jobs from the list which have stopped running
				if (jobStatus != JobStatus.FINISHED && jobStatus != JobStatus.CANCELED
					&& jobStatus != JobStatus.FAILED) {
					continue;
				}

				// Check time stamp of last job status update
				if ((entry.getValue().getTimestamp() + this.timerTaskInterval) < currentTime) {
					archiveJobevent(entry.getKey(), entry.getValue());
					it.remove();
					synchronized (this.recentManagementGraphs) {
						archiveManagementGraph(entry.getKey(), this.recentManagementGraphs.get(entry.getKey()));
						this.recentManagementGraphs.remove(entry.getValue());
					}
					synchronized (this.recentNetworkTopologies) {
						archiveNetworkTopology(entry.getKey(), this.recentNetworkTopologies.get(entry.getKey()));
						this.recentNetworkTopologies.remove(entry.getValue());
					}
				}
			}
		}
	}
1230218
def start(self, *args, **kwargs):
    
    

    self.runArgs = args
    self.runKwargs = kwargs
    Thread.start(self)
949072
@GwtIncompatible
    public static void start() {
        computation().start();
        io().start();
        newThread().start();
        single().start();
        trampoline().start();
        SchedulerPoolFactory.start();
    }
1005943
def run(self, **kwargs):
        
        if not (self.input and self.output and self.exe):
            raise RuntimeError("setup incomplete, can't run")
        self.logger.info("running MapReduce application")
        run_pipes(self.exe, self.input, self.output, **kwargs)
186645
public void run() {
//    todo    if (logger.isDebugEnabled()) {
//            logger.debug("start running PooledDataSourceCleaner");
//        }

        state = STATE_CLEANER.RUNNING;
        while (state != STATE_CLEANER.SHUTDOWN) {
            try {
                Thread.sleep(interval * 1000);
            } catch (InterruptedException e) {
//              todo  if (logger.isDebugEnabled()) {
//                    logger.debug("Get interrupted, shutdown the PooledDataSourceCleaner");
//                }
                break;//get out if anyone interrupt
            }
            this.manager.cleanDataSources();

            //if no pool at all, going to stop itself
            if (this.manager.getDbmsPoolSize() == 0) {
//             todo   if (logger.isDebugEnabled()) {
//                    logger.debug("Empty pools, shutdown the PooledDataSourceCleaner");
//                }
                state = STATE_CLEANER.SHUTDOWN;//stop spinning
                break; //get out
            }
        }
    }
166480
def run(self):
        
        while not self.stopped:
            now = datetime.utcnow()
            for job in self.parent.jobs:
                if not job.next_run:
                    continue
                if job.next_run >= self.last_check and job.next_run <= now:
                    if job.state.allow_start:
                        job.start()
                    else:
                        job.next_run = job.cron_iter.get_next(datetime)
            self.last_checked = now
            time.sleep(1)
514103
public void start() {
        if (!raftIntegration.isReady()) {
            raftIntegration.schedule(new Runnable() {
                @Override
                public void run() {
                    start();
                }
            }, RAFT_NODE_INIT_DELAY_MILLIS, MILLISECONDS);
            return;
        }

        if (logger.isFineEnabled()) {
            logger.fine("Starting raft node: " + localMember + " for " + groupId
                    + " with " + state.memberCount() + " members: " + state.members());
        }
        raftIntegration.execute(new PreVoteTask(this, 0));

        scheduleLeaderFailureDetection();
    }
607089
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)

        # init things that need to be done after the process is forked
        self._post_fork_init()

        # Make Start Times
        last = int(time.time())

        old_present = set()
        while True:
            now = int(time.time())
            if (now - last) >= self.loop_interval:
                salt.daemons.masterapi.clean_old_jobs(self.opts)
                salt.daemons.masterapi.clean_expired_tokens(self.opts)
                salt.daemons.masterapi.clean_pub_auth(self.opts)
                salt.daemons.masterapi.clean_proc_dir(self.opts)
            self.handle_git_pillar()
            self.handle_schedule()
            self.handle_key_cache()
            self.handle_presence(old_present)
            self.handle_key_rotate(now)
            salt.utils.verify.check_max_open_files(self.opts)
            last = now
            time.sleep(self.loop_interval)
375584
def start(self, **kwargs):
        

        pty_stdin, pty_stdout, pty_stderr = self.sockets()
        pumps = []

        if pty_stdin and self.interactive:
            pumps.append(io.Pump(io.Stream(self.stdin), pty_stdin, wait_for_output=False))

        if pty_stdout:
            pumps.append(io.Pump(pty_stdout, io.Stream(self.stdout), propagate_close=False))

        if pty_stderr:
            pumps.append(io.Pump(pty_stderr, io.Stream(self.stderr), propagate_close=False))

        if not self.container_info()['State']['Running']:
            self.client.start(self.container, **kwargs)

        flags = [p.set_blocking(False) for p in pumps]

        try:
            with WINCHHandler(self):
                self._hijack_tty(pumps)
        finally:
            if flags:
                for (pump, flag) in zip(pumps, flags):
                    io.set_blocking(pump, flag)
444987
protected void startPurge() {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        if (bTrace && tc.isEventEnabled()) {
            Tr.event(tc, "Running purge of expired sessions");
        }
        try {
            List<SessionImpl> toPurge = new ArrayList<SessionImpl>();
            for (Map<String, SessionImpl> sessions : this.groupings.values()) {
                synchronized (sessions) {
                    // scan for all expired sessions
                    for (SessionImpl session : sessions.values()) {
                        if (session.checkExpiration(false)) {
                            toPurge.add(session);
                        }
                    }
                    // now remove those sessions from the map (outside the
                    // iteration loop)
                    for (SessionImpl session : toPurge) {
                        sessions.remove(session.getId());
                    }
                } // end-sync

                // now iterate that list outside the lock (involves calling
                // session listeners)
                for (SessionImpl session : toPurge) {
                    // if the session is still "valid" then we need to call
                    // invalidate now
                    if (bTrace && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Purging session; " + session);
                    }
                    if (!session.isInvalid()) {
                        session.invalidate();
                    }
                }
                toPurge.clear();
            } // end-grouping-loop
        } catch (Throwable t) {
            FFDCFilter.processException(t, getClass().getName(), "purge");
            if (bTrace && tc.isDebugEnabled()) {
                Tr.debug(tc, "Error while running purge scan; " + t);
            }
        }
    }
1041342
@Override
    public void start(Map<String, String> options) throws Exception {
        // This must be done before starting "RebuildServer"
        // rather than after, so any application caches
        // (in particular the hash map held by PIDGenerator)
        // don't get out of sync with the database.
        blankExistingTables();
        try {
            m_server = Rebuild.getServer();
            // now get the connectionpool
            ConnectionPoolManager cpm =
                    (ConnectionPoolManager) m_server
                            .getModule("org.fcrepo.server.storage.ConnectionPoolManager");
            if (cpm == null) {
                throw new ModuleInitializationException("ConnectionPoolManager not loaded.",
                                                        "ConnectionPoolManager");
            }
            m_connectionPool = cpm.getPool();
            ensureFedoraTables();
            // set m_now, which is both when we are starting this job and the flag
            // that it was started
            m_now = System.currentTimeMillis();
            startStatus(m_now);
            m_context =
                    ReadOnlyContext.getContext("utility", "fedoraAdmin", "", /* null, */
                    ReadOnlyContext.DO_OP);

            ILowlevelStorage llstore =
                    (ILowlevelStorage) m_server
                            .getModule("org.fcrepo.server.storage.lowlevel.ILowlevelStorage");
            try {
                llstore.rebuildObject();
                llstore.rebuildDatastream();
            } catch (LowlevelStorageException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        } catch (InitializationException ie) {
            logger.error("Error initializing", ie);
            throw ie;
        }
    }
357414
def start(self):
        """"""
        if self.num_workers:
            self.queue = Queue(maxsize=self.num_workers)
            self.workers = [_Worker(self) for _ in range(self.num_workers)]
            for worker in self.workers:
                worker.start()
        self.running = True
431281
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)
        self.event = get_event('master', opts=self.opts, listen=True)
        events = self.event.iter_events(full=True)
        self.event.fire_event({}, 'salt/event_listen/start')
        try:
            for event in events:
                if event['tag'] == 'salt/event/exit':
                    self.stop = True
                if self._filter(event):
                    self.event_queue.append(event)
                if len(self.event_queue) >= self.event_return_queue:
                    self.flush_events()
                if self.stop:
                    break
        finally:  # flush all we have at this moment
            if self.event_queue:
                self.flush_events()
295161
public void start() {
        stop();  // Make sure any currently running dispatchers are stopped.
        // Create the cache dispatcher and start it.


        if (cacheDispatcher == null) {
            cacheDispatcher = new CacheDispatcher(cacheQueue, networkQueue, cache, delivery);
        }
        cacheDispatcher.start();
        addMarker(EVENT_CACHE_DISPATCHER_START, cacheDispatcher);

        // Create network dispatchers (and corresponding threads) up to the pool size.
        setUpNetworkDispatchers();
    }
536990
public void run() {
        try {
            ReceivePump.this.receiveAndProcess();
        } catch (final Exception exception) {
            if (TRACE_LOGGER.isErrorEnabled()) {
                TRACE_LOGGER.error(
                        String.format(Locale.US, "Receive pump for eventHub (%s), consumerGroup (%s), partition (%s) "
                                + "encountered unrecoverable error and exited with exception %s.",
                                this.eventHubName, this.consumerGroupName, this.receiver.getPartitionId(), exception.toString()));
            }

            throw exception;
        }
    }