[Issue] Task list is not cleared after complete task #45

Closed
opened 2026-02-16 01:15:21 -05:00 by yindo · 3 comments
Owner

Originally created by @jp-kh-kim on GitHub (Jul 16, 2024).

I'm currently working with server, I found that control plane does not clear task list after complete task.

Consequently, the server runs a task repeatedly after some delay.

Here is my test code for pytest.

import pytest
import time
import logging
from llama_agents import LlamaAgentsClient

_logger: logging.Logger = logging.getLogger(__name__)

client = LlamaAgentsClient(control_plane_url="http://127.0.0.1:8001")


def get_task_list():
    taskList = client.get_tasks()
    _logger.info(f"{taskList.keys()}")


def request_task(task: str):
    _logger.info(f"QUERY :: {task}")
    return client.create_task(task_def=task)


def get_task_results(task_id: str):
    retries = 3
    delay = 10
    initial_delay = 10

    _logger.info(f"Waiting for {initial_delay} seconds before the first request.")
    time.sleep(initial_delay)

    for attempt in range(retries):
        try:
            taskResult = client.get_task_result(task_id=task_id)
            _logger.info(taskResult)
            break
        except Exception as e:
            _logger.info(f"Attempt {attempt + 1} failed: {e}")
            if attempt < retries - 1:
                time.sleep(delay)
            else:
                _logger.info("All attempts failed")


def test_run_task():
    get_task_list() # returns [] as expected.

    task_id = request_task(task="<put your query here>")

    get_task_results(task_id=task_id)

    get_task_list() # returns [task_id],  task list is not cleared.
Originally created by @jp-kh-kim on GitHub (Jul 16, 2024). I'm currently working with server, I found that control plane does not clear task list after complete task. Consequently, the server runs a task repeatedly after some delay. Here is my test code for pytest. ```python import pytest import time import logging from llama_agents import LlamaAgentsClient _logger: logging.Logger = logging.getLogger(__name__) client = LlamaAgentsClient(control_plane_url="http://127.0.0.1:8001") def get_task_list(): taskList = client.get_tasks() _logger.info(f"{taskList.keys()}") def request_task(task: str): _logger.info(f"QUERY :: {task}") return client.create_task(task_def=task) def get_task_results(task_id: str): retries = 3 delay = 10 initial_delay = 10 _logger.info(f"Waiting for {initial_delay} seconds before the first request.") time.sleep(initial_delay) for attempt in range(retries): try: taskResult = client.get_task_result(task_id=task_id) _logger.info(taskResult) break except Exception as e: _logger.info(f"Attempt {attempt + 1} failed: {e}") if attempt < retries - 1: time.sleep(delay) else: _logger.info("All attempts failed") def test_run_task(): get_task_list() # returns [] as expected. task_id = request_task(task="<put your query here>") get_task_results(task_id=task_id) get_task_list() # returns [task_id], task list is not cleared. ```
yindo closed this issue 2026-02-16 01:15:21 -05:00
Author
Owner

@nerdai commented on GitHub (Jul 18, 2024):

Thanks @jp-kh-kim for submitting the issue! May I know more details about the control plane, specifically what type of orchestrator that you are using?

@nerdai commented on GitHub (Jul 18, 2024): Thanks @jp-kh-kim for submitting the issue! May I know more details about the control plane, specifically what type of orchestrator that you are using?
Author
Owner

@jp-kh-kim commented on GitHub (Jul 18, 2024):

@nerdai

Hi Andrei :)
I'm currently using gemini-1.5-flash. Here is a part of my pytest code.

from llama_index.llms.gemini import Gemini
from llama_index.core import Settings

Settings.cheap_llm = Gemini(
    model=config["LLM"]["CHEAP_LLM_MODEL_NAME"],  # which is gemini-flash-1.5
    api_key=config["API"]["GOOGLE_API_KEY"],
    temperature=0,
)

def create_control_plane_server(message_queue, port):
    return ControlPlaneServer(
        host="127.0.0.1",
        port=port,
        message_queue=message_queue,
        orchestrator=AgentOrchestrator(llm=Settings.cheap_llm),
        services_retrieval_threshold=1,
    )
@jp-kh-kim commented on GitHub (Jul 18, 2024): @nerdai Hi Andrei :) I'm currently using gemini-1.5-flash. Here is a part of my pytest code. ```python from llama_index.llms.gemini import Gemini from llama_index.core import Settings Settings.cheap_llm = Gemini( model=config["LLM"]["CHEAP_LLM_MODEL_NAME"], # which is gemini-flash-1.5 api_key=config["API"]["GOOGLE_API_KEY"], temperature=0, ) def create_control_plane_server(message_queue, port): return ControlPlaneServer( host="127.0.0.1", port=port, message_queue=message_queue, orchestrator=AgentOrchestrator(llm=Settings.cheap_llm), services_retrieval_threshold=1, ) ```
Author
Owner

@logan-markewich commented on GitHub (Sep 5, 2024):

We've done a major refactor, and I don't think this issue is relevant anymore

@logan-markewich commented on GitHub (Sep 5, 2024): We've done a major refactor, and I don't think this issue is relevant anymore
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_deploy#45