Adapt Watcher to Python3.7

There are some issues with bundle of eventlet, taskflow and
apscheduler on Python 3.7.
According to [0], replace ThreadPoolExecutor with
GreenThreadPoolExecutor

[0]: http://lists.openstack.org/pipermail/openstack-dev/2018-July/132481.html

Co-Authored-By: Canwei Li <li.canwei2@zte.com.cn>

Change-Id: I989d7155eb8764088f91b3ca0d1f47ac6332bf11
This commit is contained in:
Alexander Chadin
2018-10-16 18:13:15 +03:00
committed by licanwei
parent ab03bf9bb0
commit 6dfeeb7359
7 changed files with 35 additions and 6 deletions

View File

@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from concurrent import futures
import futurist
from oslo_config import cfg
from oslo_log import log
@@ -31,7 +31,7 @@ class TriggerActionPlan(object):
def __init__(self, applier_manager):
self.applier_manager = applier_manager
workers = CONF.watcher_applier.workers
self.executor = futures.ThreadPoolExecutor(max_workers=workers)
self.executor = futurist.GreenThreadPoolExecutor(max_workers=workers)
def do_launch_action_plan(self, context, action_plan_uuid):
try:

View File

@@ -106,7 +106,7 @@ class DefaultWorkFlowEngine(base.BaseWorkFlowEngine):
decider=self.decider)
e = engines.load(
flow, engine='parallel',
flow, executor='greenthreaded', engine='parallel',
max_workers=self.config.max_workers)
e.run()