AA-2487: Backend - Enable Scheduled Backups

Review Request #743 — Created March 26, 2025 and updated

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

Problem

Define backup schedules (e.g., daily, weekly, monthly, yearly).

Solution

Have made changes to schedule backup daily, weekly, monthly, yearly
Introduced new API's
POST backup/schedule - To schedule backup
GET backup/schedule - Get schedule backup info
DEL backup/schedule - Removes schedule backup

POST https://192.168.162.162:8888/backup/schedule
request:
{
"frequency": "daily",
"time": "09:20"
}

Response:
{
"cron_time": "20 09 * ",
"message": "Backup schedule updated successfully!"
}

GET https://192.168.162.162:8888/backup/schedule
Response:
{
"month": null,
"day_of_the_month": "09:20",
"day_of_the_week": null,
"frequency": 2,
"time": "daily"
}

DELETE https://192.168.162.162:8888/backup/schedule
Response:
{
"message": "Successfully removed the backup schedule!"
}

Description From Last Updated

this can be a dict and dicts - that way you can avoid if - else if chain logic. scehd_handlers …

prajeshprajesh

This the same request approach we have for the Report Generation Cron Jobs? if not can we adopt that.

pmurugaiyanpmurugaiyan

These HttpResponse will return the http status code as 200 and within the response body shows the content with error …

pmurugaiyanpmurugaiyan

Do we need a main()?

pmurugaiyanpmurugaiyan

typo: specifies =? specified.

prajeshprajesh

same here..

prajeshprajesh

same here..

prajeshprajesh
prajesh
  1. 
      
  2. this can be a dict and dicts - that way you can avoid if - else if chain logic.

    scehd_handlers = {"GET", get_schedule_backup_info, "DELETE",remove_backup_cron_job}

    handlers = {"schedule", sched_handlers }

    then use the path and method to get the function handlers.

  3. 
      
apoorva.sn
pmurugaiyan
  1. 
      
  2. This the same request approach we have for the Report Generation Cron Jobs? if not can we adopt that.

    1. Since we dont have the composer code better to have our own implementation for this

    2. Can you please share how we are sharing the request payload for the composer requests for the Cron. Can we compare and take a call?

      Just wanted to keep the changes in line with the existing approach. If it adds values functionally, yes we can use a better model.

  3. These HttpResponse will return the http status code as 200 and within the response body shows the content with error code 405 is this fine? or we cand use the code at the HTTP level also?

    1. Yes.. calling this script from schedule_backup so will need a main method

  4. 
      
apoorva.sn
prajesh
apoorva.sn
Review request changed
prajesh
  1. Ship It!
  2. 
      
shuinvy
  1. Ship It!
  2. 
      
Loading...