Pull problems from the submission queue and submit them.

        Note:
            This method is always run inside of a daemon thread.
430044
def _do_submit_problems(self):
        
        try:
            while True:
                # Pull as many problems as we can, block on the first one,
                # but once we have one problem, switch to non-blocking then
                # submit without blocking again.

                # `None` task is used to signal thread termination
                item = self._submission_queue.get()
                if item is None:
                    break

                ready_problems = [item]
                while len(ready_problems) < self._SUBMIT_BATCH_SIZE:
                    try:
                        ready_problems.append(self._submission_queue.get_nowait())
                    except queue.Empty:
                        break

                # Submit the problems
                _LOGGER.debug("Submitting %d problems", len(ready_problems))
                body = '[' + ','.join(mess.body for mess in ready_problems) + ']'
                try:
                    try:
                        response = self.session.post(posixpath.join(self.endpoint, 'problems/'), body)
                        localtime_of_response = epochnow()
                    except requests.exceptions.Timeout:
                        raise RequestTimeout

                    if response.status_code == 401:
                        raise SolverAuthenticationError()
                    response.raise_for_status()

                    message = response.json()
                    _LOGGER.debug("Finished submitting %d problems", len(ready_problems))
                except BaseException as exception:
                    _LOGGER.debug("Submit failed for %d problems", len(ready_problems))
                    if not isinstance(exception, SolverAuthenticationError):
                        exception = IOError(exception)

                    for mess in ready_problems:
                        mess.future._set_error(exception, sys.exc_info())
                        self._submission_queue.task_done()
                    continue

                # Pass on the information
                for submission, res in zip(ready_problems, message):
                    submission.future._set_clock_diff(response, localtime_of_response)
                    self._handle_problem_status(res, submission.future)
                    self._submission_queue.task_done()

                # this is equivalent to a yield to scheduler in other threading libraries
                time.sleep(0)

        except BaseException as err:
            _LOGGER.exception(err)
66745
def do(self, arg):
    ""
    thread = self.get_thread_from_prefix()
    print "Exception handlers for thread %d" % thread.get_tid()
    print
    table = Table()
    table.addRow("Block", "Function")
    bits = thread.get_bits()
    for (seh, seh_func) in thread.get_seh_chain():
        if seh is not None:
            seh      = HexDump.address(seh, bits)
        if seh_func is not None:
            seh_func = HexDump.address(seh_func, bits)
        table.addRow(seh, seh_func)
    print table.getOutput()
805822
def _match_errors_queues(self, query):
        
        if query in self._error_queues:
            queue = self._error_queues[query]
            response = queue.value
            logger.debug('Found response in error queue: %s',
                         repr(response))

            return response
181472
public void submitSynchronous(Runnable task) {
        lock.writeLock().lock();
        try {
            awaitInner();
            task.run();
        } catch (InterruptedException e) {
            Log.error(e, "Task queue isolated submission interrupted");
            throw new RuntimeException(e);
        } catch (Exception e) {
            Log.error(e, "Task queue isolated submission failed");
            throw new RuntimeException(e);
        } finally {
            lock.writeLock().unlock();
        }
    }
268343
def submit(self, method, method_args=(), method_kwargs={}, done_callback=None, done_kwargs={}, loop=None):
        '''
        
        '''
        _future = self.pool.submit(method, *method_args, **method_kwargs)
        self.current_id += 1
        if done_callback:
            _future.add_done_callback(lambda _f:done_callback(_f,loop,**done_kwargs))#done kwargs, hardcoded kwargs
        self.request_pool[self.current_id] = _future
        return self.current_id, _future
713008
def handle(self, *args, **options):
        
        # Note that by taking last_id here, we're going to miss any submissions created *during* the command execution
        # But that's okay! All new entries have already been created using the new style, no acion needed there
        last_id = Submission._objects.all().aggregate(Max('id'))['id__max']
        log.info("Beginning uuid update")

        current = options['start']
        while current < last_id:
            end_chunk = current + options['chunk'] if last_id - options['chunk'] >= current else last_id
            log.info("Updating entries in range [{}, {}]".format(current, end_chunk))
            with transaction.atomic():
                for submission in Submission._objects.filter(id__gte=current, id__lte=end_chunk).iterator():
                    submission.save(update_fields=['uuid'])
            time.sleep(options['wait'])
            current = end_chunk + 1
327138
public void submit(Task task,Integer index) {
        task.activate(false);
        taskQueues[index].accept(task);
    }
966152
void submit() {

        CmsResource target = m_context.getResources().get(0);
        String resPath = m_context.getCms().getSitePath(target);
        try {
            m_context.getCms().copyResourceToProject(resPath);

            m_context.finish(Collections.singletonList(target.getStructureId()));
        } catch (CmsException e) {
            m_context.error(e);
        }
    }
291821
def wait(self):
        
        self.thread.join()
        if self.error is not None:
            return self.error
        return self.result
797217
def submit(self):
        """"""
        if self._dirty:
            self.save()

        self._connection.run(['submit', '-c', str(self._change)], marshal_output=False)
57709
def _do_load_results(self):
        
        try:
            while True:
                # Select a problem
                future = self._load_queue.get()
                # `None` task signifies thread termination
                if future is None:
                    break
                _LOGGER.debug("Loading results of: %s", future.id)

                # Submit the query
                query_string = 'problems/{}/'.format(future.id)
                try:
                    try:
                        response = self.session.get(posixpath.join(self.endpoint, query_string))
                    except requests.exceptions.Timeout:
                        raise RequestTimeout

                    if response.status_code == 401:
                        raise SolverAuthenticationError()
                    response.raise_for_status()

                    message = response.json()
                except BaseException as exception:
                    if not isinstance(exception, SolverAuthenticationError):
                        exception = IOError(exception)

                    future._set_error(IOError(exception), sys.exc_info())
                    continue

                # Dispatch the results, mark the task complete
                self._handle_problem_status(message, future)
                self._load_queue.task_done()

                # this is equivalent to a yield to scheduler in other threading libraries
                time.sleep(0)

        except Exception as err:
            _LOGGER.error('Load result error: ' + str(err))
1089012
def fetch_issues_and_pr
      issues, pull_requests = @fetcher.fetch_closed_issues_and_pr

      @pull_requests = options[:pulls] ? get_filtered_pull_requests(pull_requests) : []

      @issues = options[:issues] ? get_filtered_issues(issues) : []

      fetch_events_for_issues_and_pr
      detect_actual_closed_dates(@issues + @pull_requests)
      add_first_occurring_tag_to_prs(@sorted_tags, @pull_requests)
      nil
    end
563170
public void submit(Runnable task)
    {
        queue.add(task);
        while(true)
        {
            long cur = combinedState.get();
            int shutdown = (int)(cur >> 63) & 1;
            if (shutdown != 0)
            {
                throw new RejectedExecutionException("ThreadExecutor is already shutdown");
            }
            int currentThreads = ((int) (cur >> 32)) & 0x7FFFFFFF;
            int sizeMinusIdle = (int)(cur & 0xFFFFFFFFL);
            if (currentThreads < maxThreads && sizeMinusIdle >= 0)
            {
                currentThreads++;
                long next = combineStates(currentThreads, sizeMinusIdle, shutdown);
                if (combinedState.compareAndSet(cur, next))
                {
                    ThreadGroup localThreadGroup = threadGroup;
                    if (localThreadGroup.isDestroyed())
                    {
                        synchronized (this)
                        {
                            if (this.threadGroup.isDestroyed())
                            {
                                localThreadGroup = new ThreadGroup(this.name);
                                this.threadGroup = localThreadGroup;
                            }
                        }
                    }
                    new ExecutorThread(name + "-" + poolNumber + "-" + threadId.incrementAndGet()).start();
                    break;
                }
            }
            else
            {
                sizeMinusIdle++;
                if (trySettingState(cur, currentThreads, sizeMinusIdle, shutdown)) break;
            }
        }
    }
1345146
def main(self):
        
        self.manage_submissions()
        out_string = self.options['format']

        # Pop until we get something which len(title) <= max-chars
        length = float('inf')
        while length > self.options['max_chars']:
            self.selected_submission = self.submissions.pop()
            length = len(self.selected_submission['title'])

        for k, v in self.selected_submission.items():
            out_string = out_string.replace(k, self.h.unescape(str(v)))
        return self.output(out_string, out_string)
426306
def submit(self, fn, *args, **kwargs):
        """"""
        if not self.asynchronous:
            return fn(*args, **kwargs)
        raise NotImplementedError
1165458
def start(self):
        
        super().start()
        submissions_thread = BotThread(name='{}-submissions-stream-thread'.format(self._name),
                                       target=self._listen_submissions)
        submissions_thread.start()
        self._threads.append(submissions_thread)
        self.log.info('Starting submissions stream ...')
727575
def process_request_thread(self, request, client_address):
        

        try:
            self.finish_request(request, client_address)
            self.shutdown_request(request)
        except Exception as e:
            self.logger.error(e)
            self.handle_error(request, client_address)
            self.shutdown_request(request)