MCPcopy Index your code
hub / github.com/python/cpython / submit

Method submit

Lib/concurrent/futures/process.py:810–832  ·  view source on GitHub ↗
(self, fn, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

808 self._processes[p.pid] = p
809
810 def submit(self, fn, /, *args, **kwargs):
811 with self._shutdown_lock:
812 if self._broken:
813 raise BrokenProcessPool(self._broken)
814 if self._shutdown_thread:
815 raise RuntimeError('cannot schedule new futures after shutdown')
816 if _global_shutdown:
817 raise RuntimeError('cannot schedule new futures after '
818 'interpreter shutdown')
819
820 f = _base.Future()
821 w = _WorkItem(f, fn, args, kwargs)
822
823 self._pending_work_items[self._queue_count] = w
824 self._work_ids.put(self._queue_count)
825 self._queue_count += 1
826 # Wake up queue management thread
827 self._executor_manager_thread_wakeup.wakeup()
828
829 if self._safe_to_dynamically_spawn_children:
830 self._adjust_process_count()
831 self._start_executor_manager_thread()
832 return f
833 submit.__doc__ = _base.Executor.submit.__doc__
834
835 def map(self, fn, *iterables, timeout=None, chunksize=1, buffersize=None):

Callers 1

Calls 6

_adjust_process_countMethod · 0.95
BrokenProcessPoolClass · 0.85
_WorkItemClass · 0.70
putMethod · 0.45
wakeupMethod · 0.45

Tested by 1