diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-11-01 12:02:36 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-11-01 12:09:40 +0800 |
commit | 635886dfc12300038ef096d08f8eb4c09ce075a4 (patch) | |
tree | 8fb785f0ca1485a1640efa6b39873417e72353ae | |
parent | 8ef8e0696d5e9598012363f780d722f90e9d06e2 (diff) |
Start buildin workflow By thread
Change-Id: Id0856b84aedfcfb543429cd8431cd06487198101
Issue-Id: VFC-573
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/ns/ns_instant.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lcm/ns/ns_instant.py b/lcm/ns/ns_instant.py index f73fbd94..52418085 100644 --- a/lcm/ns/ns_instant.py +++ b/lcm/ns/ns_instant.py @@ -16,6 +16,7 @@ import logging import time import traceback import uuid +from threading import Thread from rest_framework import status @@ -37,6 +38,15 @@ from lcm.workflows import build_in logger = logging.getLogger(__name__) +class BuildInWorkflowThread(Thread): + def __init__(self, plan_input): + Thread.__init__(self) + self.plan_input = plan_input + + def run(self): + build_in.run_ns_instantiate(self.plan_input) + + class InstantNSService(object): def __init__(self, ns_inst_id, plan_content): self.ns_inst_id = ns_inst_id @@ -187,7 +197,7 @@ class InstantNSService(object): def start_buildin_workflow(self, job_id, plan_input): JobUtil.add_job_status(job_id, 10, 'NS inst(%s) buildin workflow started.' % self.ns_inst_id) - build_in.run_ns_instantiate(plan_input) + BuildInWorkflowThread(plan_input).start() return dict(data={'jobId': job_id}, status=status.HTTP_200_OK) def get_vnf_vim_id(self, vim_id, location_constraints, vnfdid): |