async def aschedule(self, task_queue: asyncio.Queue) -> None:
        """Asynchronously listen to task_queue and schedule tasks as they arrive."""
        no_more_tasks = False  # Flag to check if all tasks are received

        while True:
            if not no_more_tasks:
                # Wait for a new task to be added to the queue
                task = await task_queue.get()

                # Check for sentinel value indicating end of tasks
                if task is None:
                    no_more_tasks = True
                else:
                    # Parse and set the new tasks
                    self.set_tasks({task.idx: task})

            # Schedule and run executable tasks
            executable_tasks = self._get_all_executable_tasks()

            if executable_tasks:
                for task_id in executable_tasks:
                    asyncio.create_task(self._run_task(self.tasks[task_id]))
                    self.remaining_tasks.remove(task_id)
            elif no_more_tasks and self._all_tasks_done():
                # Exit the loop if no more tasks are expected and all tasks are done
                break
            else:
                # If no executable tasks are found, sleep for the SCHEDULING_INTERVAL
                await asyncio.sleep(SCHEDULING_INTERVAL)
Asynchronously listen to task_queue and schedule tasks as they arrive.
llama-index-packs/llama-index-packs-agents-llm-compiler/llama_index/packs/agents_llm_compiler/task_fetching_unit.py