MCPcopy
hub / github.com/opendevops-cn/opendevops / run

Method run

scripts/tornado_source_code/tornado/gen.py:710–762  ·  view source on GitHub ↗

Starts or resumes the generator, running until it reaches a yield point that is not ready.

(self)

Source from the content-addressed store, hash-verified

708 self.run()
709
710 def run(self) -> None:
711 """Starts or resumes the generator, running until it reaches a
712 yield point that is not ready.
713 """
714 if self.running or self.finished:
715 return
716 try:
717 self.running = True
718 while True:
719 future = self.future
720 if future is None:
721 raise Exception("No pending future")
722 if not future.done():
723 return
724 self.future = None
725 try:
726 exc_info = None
727
728 try:
729 value = future.result()
730 except Exception:
731 exc_info = sys.exc_info()
732 future = None
733
734 if exc_info is not None:
735 try:
736 yielded = self.gen.throw(*exc_info) # type: ignore
737 finally:
738 # Break up a reference to itself
739 # for faster GC on CPython.
740 exc_info = None
741 else:
742 yielded = self.gen.send(value)
743
744 except (StopIteration, Return) as e:
745 self.finished = True
746 self.future = _null_future
747 future_set_result_unless_cancelled(
748 self.result_future, _value_from_stopiteration(e)
749 )
750 self.result_future = None # type: ignore
751 return
752 except Exception:
753 self.finished = True
754 self.future = _null_future
755 future_set_exc_info(self.result_future, sys.exc_info())
756 self.result_future = None # type: ignore
757 return
758 if not self.handle_yield(yielded):
759 return
760 yielded = None
761 finally:
762 self.running = False
763
764 def handle_yield(self, yielded: _Yieldable) -> bool:
765 try:

Callers 3

__init__Method · 0.95
innerMethod · 0.95
handle_exceptionMethod · 0.95

Calls 6

handle_yieldMethod · 0.95
future_set_exc_infoFunction · 0.90
resultMethod · 0.80
doneMethod · 0.45

Tested by

no test coverage detected