AA-2629 : GUI - Administrator should be able to schedule and download the LLB statistics Reports

Review Request #729 — Created March 19, 2025 and submitted

pmurugaiyan
AMP
amp_3_7
AA-2629
apoorva.sn, prajesh, shuinvy

Problem Statement:
We have added the backend implementation to create the LLB reports but the implementation not gets along with the current report regeneration flow and unable to integrate with the GUI.

Solution/Approach:
Use the existing flow for listing the reports and report logs so that the users will not notify any differences at the GUI. To achieve this I have made changes to change the Flow at the task execution level, meaning the task creating, listing tasks, listing reports and downing follows the existing approach whereas the report generation will use our newly added report generation scripts, this way the user will notify the flow differences easily.

The changes are tested locally.


Description From Last Updated

is there not a repo layer?

prajeshprajesh

can we separate db logic in a separate module?

prajeshprajesh

The part where the report entry is created in report table is part of the existing flow ?

apoorva.snapoorva.sn

can we make it status=200 if query_output["code"] == 0 else query_output["code"]

apoorva.snapoorva.sn

May be in the future we should maintain single connection to the db.

prajeshprajesh

this might not throw error in correct format. have you checked whether it is displaying the error correctly in response …

apoorva.snapoorva.sn

So if we put the report under this path the existing logic will pick up the report and display it …

apoorva.snapoorva.sn
prajesh
  1. 
      
  2. can we separate db logic in a separate module?

    1. Sure Praveen, updated the logic to have DB logic in seperate module.

  3. 
      
pmurugaiyan
prajesh
  1. 
      
  2. May be in the future we should maintain single connection to the db.

    1. Sure Praveen, we can implement the locking mechanism (for write) as well. Since, the composer also uses the composer.db file I haven't performed any of those.

    2. Can we create a ticket for this and you can close this comment.

    3. https://arraynetworks.atlassian.net/browse/AA-2673

  3. 
      
apoorva.sn
  1. 
      
  2. The part where the report entry is created in report table is part of the existing flow ?

    1. Yes, here we are reusing the existing flow.

  3. this might not throw error in correct format. have you checked whether it is displaying the error correctly in response ?

    1. I didn't get it. This raises the exception and will be handled in the caller function and returns with 500 error.

    2. yes.. but error message will be very unintelligeable to user.. it will usually throw internal server error. we usual must show some meaningful message. Exception class usually does not handle this.

  4. So if we put the report under this path the existing logic will pick up the report and display it in the UI ?

    1. Yes, also I have created the entries in the DB

  5. 
      
apoorva.sn
  1. Is the cron for the PDF working correctly with these changes only? No additional changes needed?

    1. CRON I haven't test it.Can you please explain how its implemented? I can check and confirm, or make the changes accordingly.

  2. 
      
pmurugaiyan
pmurugaiyan
apoorva.sn
  1. 
      
  2. can we make it
    status=200 if query_output["code"] == 0 else query_output["code"]

    1. I think lets not mix the error code with the http status code. Currently only 500 & 200 are the possible responses in this scenario.

    2. 500 and 200 are also HTTP Status code itself. It is better to actually set the status code for the response itself. But since in this case we dont have the full control because of composer we could print the error code as part of response

  3. 
      
shuinvy
  1. 
      
  2. Just suggest that maybe we should use Prepared Statements , such as ("where id = ?;" (report_id)) instead of Concatenation in the future.

    1. Sure Shuinvy, we have created a story on the DB related improvements. Will fix it as part of that.

  3. 
      
shuinvy
  1. Ship It!
  2. 
      
prajesh
  1. Ship It!
  2. 
      
pmurugaiyan
Review request changed

Status: Closed (submitted)

Loading...