From d52f07604d04b590494fa5735ecda9a1dceacff3 Mon Sep 17 00:00:00 2001 From: W Chan Date: Thu, 7 Feb 2019 13:06:01 -0800 Subject: [PATCH] Add sleep in while loop of composer to yield cpu Add sleep in while loop of composer to yield cpu to other threads/processes. --- orquesta/composers/native.py | 4 ++++ requirements.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/orquesta/composers/native.py b/orquesta/composers/native.py index 218e6906..ad0f1761 100644 --- a/orquesta/composers/native.py +++ b/orquesta/composers/native.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import eventlet import logging from six.moves import queue @@ -224,4 +225,7 @@ def _create_task_ex_name(task_name, split_id): ref=prev_seq[3]['ref'] ) + # Add sleep here to yield to other threads/processes. + eventlet.sleep(0.001) + return wf_ex_graph diff --git a/requirements.txt b/requirements.txt index 8d1a99e8..b761826d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ chardet +eventlet Jinja2>=2.8 # BSD License (3 clause) jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT networkx>=1.10,<2.0