async def initiate_and_manage_iterators(self):
        """Initiate the iterators if first run and start the normal execution."""
        __method_name = inspect.currentframe().f_code.co_name
        try:
            applogger.debug(
                "{}(method={}) : {} ({}) : Starting execution.".format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    consts.NETSKOPE_TO_AZURE_STORAGE,
                    self.nskp_data_type_for_logging,
                )
            )
            iterators_state_manager_obj = StateManager(consts.CONNECTION_STRING, "iteratorsname", self.share_name)
            self.iterators = iterators_state_manager_obj.get(consts.NETSKOPE_TO_AZURE_STORAGE)
            if self.iterators is None:
                await self.initiate_iterators()
            else:
                self.iterators = json.loads(self.iterators)
            start_epochs_list = []
            iterator_initialize_successful = False
            retry_initiate_iterators = 0
            while not iterator_initialize_successful and retry_initiate_iterators < 3:
                iterator_initialize_successful = True
                for index in self.iterators:
                    start_epoch_obj = StateManager(
                        consts.CONNECTION_STRING,
                        self.start_epoch_filename.format(index),
                        self.share_name,
                    )
                    start_epoch_raw = start_epoch_obj.get(consts.NETSKOPE_TO_AZURE_STORAGE)
                    if start_epoch_raw is None:
                        applogger.error(
                            "{}(method={}) : {} ({}) : None returned in the start epoch for iterator-{}.".format(
                                consts.LOGS_STARTS_WITH,
                                __method_name,
                                consts.NETSKOPE_TO_AZURE_STORAGE,
                                self.nskp_data_type_for_logging,
                                index,
                            )
                        )
                        iterator_initialize_successful = False
                        break
                    start_epochs_list.append(int(start_epoch_raw))
                if not iterator_initialize_successful:
                    applogger.info(
                        "{}(method={}) : {} ({}) : Initialization Failed, Deleting the file share and Retrying.".format(
                            consts.LOGS_STARTS_WITH,
                            __method_name,
                            consts.NETSKOPE_TO_AZURE_STORAGE,
                            self.nskp_data_type_for_logging,
                        )
                    )
                    self.delete_file_share()
                    await self.initiate_iterators()
                    retry_initiate_iterators += 1
            if not iterator_initialize_successful:
                applogger.error(
                    "{}(method={}) : {} ({}) : Iterator initialization was not successful."
                    "Try execution after sometime.".format(
                        consts.LOGS_STARTS_WITH,
                        __method_name,
                        consts.NETSKOPE_TO_AZURE_STORAGE,
                        self.nskp_data_type_for_logging,
                    )
                )
                raise NetskopeException()
            tasks = await self.create_tasks(start_epochs_list)
            await asyncio.gather(*tasks, return_exceptions=True)
        except NetskopeException:
            applogger.error(
                "{}(method={}) : {} ({}) : Error occurred in Netskope to azure storage.".format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    consts.NETSKOPE_TO_AZURE_STORAGE,
                    self.nskp_data_type_for_logging,
                )
            )
            raise NetskopeException()
        except Exception as error:
            applogger.error(
                "{}(method={}) : {} ({}) : Error occurred in Netskope to azure storage, Error-{}.".format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    consts.NETSKOPE_TO_AZURE_STORAGE,
                    self.nskp_data_type_for_logging,
                    error,
                )
            )
            raise NetskopeException()
Initiate the iterators if first run and start the normal execution.
Solutions/Netskopev2/Data Connectors/NetskopeDataConnector/NetskopeToAzureStorage/netskope_to_azure_storage.py