def invoke()

in source/idea/idea-administrator/src/ideaadministrator/app/deployment_helper.py [0:0]


    def invoke(self):
        if self.optimize_deployment and len(self.module_ids) > 1:
            optimized_deployment_order = self.get_optimized_deployment_order()
            if len(optimized_deployment_order) == 0:
                self.print_no_op_message()
                return

            print(f'optimized deployment order: {optimized_deployment_order}')
            for modules in optimized_deployment_order:
                threads = []
                for module_id in modules:
                    thread = threading.Thread(
                        name=f'Thread: {module_id}',
                        target=self.deploy_module,
                        kwargs={'module_id': module_id}
                    )
                    threads.append(thread)
                    thread.start()
                    # process the next entry after 10 seconds.
                    time.sleep(10)

                for thread in threads:
                    thread.join()

                # check for deployment status of previous modules
                # if any of them are not deployed, skip deployment of the next module set
                try:
                    self.initialize_cluster_modules()
                except botocore.exceptions.ClientError as e:
                    if e.response['Error']['Code'] == 'ExpiredTokenException':
                        # deployment can take sometimes more than an hour and
                        # credentials can expire for those generated hourly using STS. re-init ClusterConfigDB and boto session
                        self.cluster_config_db = ClusterConfigDB(
                            cluster_name=self.cluster_name,
                            aws_region=self.aws_region,
                            aws_profile=self.aws_profile
                        )
                        self.initialize_cluster_modules()
                    else:
                        raise e

                for module_id in modules:
                    module_info = self.cluster_modules[module_id]
                    if module_info['status'] != 'deployed':
                        raise exceptions.general_exception(f'deployment failed. could not deploy module: {module_id}')

        else:
            deployment_order = self.get_deployment_order()
            if len(deployment_order) == 0:
                self.print_no_op_message()
                return

            for module_id in deployment_order:
                self.deploy_module(module_id)