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

F/277 api getting job tree #870

Closed

Conversation

ahnwarez
Copy link
Contributor

@ahnwarez ahnwarez commented Jan 4, 2025

Issue: #277
This PR is a small PR that supports BullMQ Flow and it focuses on the backened api.

The endpoint /api/queues/:queuename/:jobId now includes a new property called jobTree, and this property contains all children jobs to the related job. Here is what the response looks like when the endpoint is called:

 {
    "job": {
        "id": "46a7c114-3390-4d23-9ca6-aa70a8dddba8",
        "timestamp": 1735957798661,
        "processedOn": 1735957832167,
        "finishedOn": 1735957832168,
        "progress": 0,
        // ...
     },
    "status": "completed",
    "jobTree": [
        {
            "name": "B",
            "id": "6f6f5fe7-8f65-48e7-9bb5-7386bd9b8fa2",
            "jobTree": [
                {
                    "name": "C",
                    "id": "c09cf2b7-f9c9-47ab-9777-699a9c9d8d38",
                    "jobTree": [
                        {
                            "name": "D",
                            "id": "69d4d27c-321d-462c-a484-c59db54183fa",
                            "jobTree": [
                                {
                                    "name": "E",
                                    "id": "62d1e7d8-6b42-485f-ae85-db27b0da9353"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

The FE should be able to consume jobTree (NOT in this PR) and display something like this:
image

A future PR will handle the FE once this is merged.

Please let me know if I missed something. Any feedback is welcomed.

- Implemented `getJobTree` method in `BaseAdapter` for retrieving job tree structure.
- Added empty implementation in `BullAdapter` to return an empty array.
- Developed full functionality in `BullMQAdapter` to fetch and map job tree nodes from the queue.

This enhances the API for better job management and visualization.
…dren

Modified the JobTreeNode interface in app.ts to replace the optional children property with jobTree, enhancing the structure for representing job hierarchies in the API.
Updated the getJobState function to extract jobId from the request parameters and retrieve the job tree structure using the new getJobTree method. The response now includes the job tree, improving job management and visualization capabilities in the API.
@ahnwarez ahnwarez closed this Jan 6, 2025
@ahnwarez ahnwarez deleted the f/277-api-getting-job-tree branch January 6, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant