Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance/custom export documentation #3

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions API/custom_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,17 @@ async def process_custom_requests(
),
):
"""
Process data based on dynamic categories, Fully flexible on filtering and select
Process data based on dynamic categories, Fully flexible on filtering and selection.

Args:
request: FastAPI Request object.
request (Request): FastAPI Request object.
params (DynamicCategoriesModel): Input parameters including ISO3 country code and dynamic categories.

Returns:
dict: Result message.
dict: Dictionary containing the result message and task information.

Raises:
HTTPException: Raised when there are insufficient permissions or empty categories.
"""
queue_name = params.queue
if params.queue != DEFAULT_QUEUE_NAME and user.role != UserRole.ADMIN.value:
Expand Down
25 changes: 25 additions & 0 deletions API/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,31 @@ def get_list_details(
description="Includes arguments of task",
),
):
"""
Retrieve details of tasks in the specified queue.
This endpoint retrieves a list of task details from the specified queue. The details include the index,
task ID, and optionally, the task arguments if the `args` parameter is set to True.

Args:
queue_name (str): The name of the queue to retrieve task details from.
args (bool, optional): If True, includes the task arguments in the response. Defaults to False.

Returns:
A JSON response containing a list of dictionaries, where each dictionary represents a task and
contains the following keys:
- index (int): The index of the task in the queue.
- id (str): The ID of the task.
- args (str, optional): The arguments of the task, if `args` is True.

Raises:
HTTPException: If the specified `queue_name` is not found.

Example response (with `args=False`):
[
{"index": 0, "id": "abcd1234-efgh-5678-ijkl-mnopqrstuvwx"},
{"index": 1, "id": "zyxw9876-vuts-5432-rqpo-nmlkjihgfedcba"},
]
"""
if queue_name not in queues:
raise HTTPException(status_code=404, detail=f"Queue '{queue_name}' not found")
redis_client = redis.StrictRedis.from_url(CELERY_BROKER_URL)
Expand Down