def producer()

in ees_sharepoint/base_command.py [0:0]


    def producer(thread_count, func, args, items, wait=False):
        """Apply async calls using multithreading to the targeted function
        :param thread_count: Total number of threads to be spawned
        :param func: The target function on which the async calls would be made
        :param args: Arguments for the targeted function
        :param items: iterator of partition
        :param wait: wait until job completes if true, otherwise returns immediately
        """
        with ThreadPoolExecutor(max_workers=thread_count) as executor:
            futures = (executor.submit(func, *args, item) for item in items)
            if wait:
                result = [future.result() for future in as_completed(futures)]
                return result