From 17cc6222786015eac06d770db7b0a2df2f725fa3 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 21 Apr 2023 16:23:33 -0300 Subject: [PATCH] Call VNF workflows concurrently Change-Id: I798841c1368f45dc242f71fae52ef691c7e29c99 Signed-off-by: Daniel Arndt --- osm_lcm/temporal/ns_workflows.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osm_lcm/temporal/ns_workflows.py b/osm_lcm/temporal/ns_workflows.py index f76e31f..9a4e0ee 100644 --- a/osm_lcm/temporal/ns_workflows.py +++ b/osm_lcm/temporal/ns_workflows.py @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import asyncio + from osm_common.dataclasses.temporal_dataclasses import ( GetVnfRecordIdsInput, GetVnfRecordIdsOutput, @@ -72,13 +74,18 @@ class NsInstantiateWorkflow(LcmOperationWorkflow): retry_policy=LcmOperationWorkflow.no_retry_policy, ), ) - - for vnfr_uuid in vnf_record_ids_output.vnfr_ids: - await workflow.execute_child_workflow( - workflow=WORKFLOW_VNF_INSTANTIATE, - arg=VnfInstantiateInput(vnfr_uuid=vnfr_uuid, model_name=model_name), - id=f"{WORKFLOW_VNF_INSTANTIATE}-{vnfr_uuid}", + await asyncio.gather( + *( + workflow.execute_child_workflow( + workflow=WORKFLOW_VNF_INSTANTIATE, + arg=VnfInstantiateInput( + vnfr_uuid=vnfr_uuid, model_name=model_name + ), + id=f"{WORKFLOW_VNF_INSTANTIATE}-{vnfr_uuid}", + ) + for vnfr_uuid in vnf_record_ids_output.vnfr_ids ) + ) except ActivityError as e: await self.update_ns_state(ns_uuid, NsState.INSTANTIATED, e.cause.message) -- 2.25.1