MCPcopy Create free account
hub / github.com/brmmm3/fastthreadpool / _map_child

Method _map_child

fastthreadpool/fastthreadpool.py:568–607  ·  view source on GitHub ↗
(self, fn, itr, done_callback, unpack_args)

Source from the content-addressed store, hash-verified

566
567 #c def _map_child(self, fn, itr, done_callback, bint unpack_args):
568 def _map_child(self, fn, itr, done_callback, unpack_args): #p
569 #c cdef bint append_done
570 self._busy_lock_inc()
571 _done_append = self._done.append
572 _failed_append = self._failed.append
573 if done_callback is False:
574 for args in itr:
575 if self._shutdown_children:
576 break
577 try:
578 if unpack_args:
579 fn(*args)
580 else:
581 fn(args)
582 except Exception as exc:
583 self._append_failed(0, exc, args, {})
584 elif done_callback is True:
585 for args in itr:
586 if self._shutdown_children:
587 break
588 try:
589 if unpack_args:
590 _done_append(fn(*args))
591 else:
592 _done_append(fn(args))
593 self._done_cnt_inc()
594 except Exception as exc:
595 self._append_failed(0, exc, args, {})
596 elif callable(done_callback):
597 for args in itr:
598 if self._shutdown_children:
599 break
600 try:
601 if unpack_args:
602 done_callback(fn(*args))
603 else:
604 done_callback(fn(args))
605 except Exception as exc:
606 self._append_failed(0, exc, args, {})
607 self._cleanup_child()
608
609 #c def _imap_child(self, fn, itr, done_callback, bint unpack_args):
610 def _imap_child(self, fn, itr, done_callback, unpack_args): #p

Callers

nothing calls this directly

Calls 4

_busy_lock_incMethod · 0.95
_append_failedMethod · 0.95
_done_cnt_incMethod · 0.95
_cleanup_childMethod · 0.95

Tested by

no test coverage detected