PQM Scheduler
Overview
This pqm scheduler is a cronjob scheduler for scheduling tests. It runs based on environment configuration. It triggers multiple the schedule API from PQM-Service to generate the Tests on the basis of Test Standards present in MDMS.
Dependency
MDMS
User
PQM-Service
Key Functionalities
It creates tests based on MDMS Test Standards using pqm-service /v1/_scheduler API.
MDMS Changes
Please add Test Standards in mdms v2 under your ULBs (pg.citya, pg.cityb)
Add RoleAction Mapping for the scheduler API
File Path -
File Path -
Make sure that ULBs are configured in tenants.json file
File Path - https://github.com/egovernments/egov-mdms-data/blob/UNIFIED-QA/data/pg/tenant/tenants.json
Configuration
Create a role in ACCESSCONTROL-ROLES/roles.json MDMS like this.
Create a SYSTEM user with PQM_CRONJOB_SCHEDULER and SYSTEM roles. Find the curl below.
The same username will be used to generate bills PQM_SERVICE_CRONJOB, it’s defined in the environment config.
Cron job duration will be configured using environment variables from here
curl --location 'http://localhost:8082/user/users/_createnovalidate' --header 'Content-Type: application/json' --data-raw '{ "RequestInfo": { "api_id": "1", "ver": "1", "ts": null, "action": "create", "did": "", "key": "", "msg_id": "", "requester_id": "", "userInfo": { "userName": "BillCreator", "name": "BillCreator", "gender": "male", "mobileNumber": "9999999999", "active": true, "type": "EMPLOYEE", "tenantId": "{STATE_TANENT_ID}", "password": "eGov@123", "roles": [ { "code": "SUPERUSER", "tenantId": "{STATE_TANENT_ID}" } ] } }, "User": { "userName": "PQM_SERVICE_CRONJOB", "name": "PQM Service Cronjob", "gender": "male", "mobileNumber": "9999999999", "active": true, "type": "SYSTEM", "tenantId": "pg", "password": "eGov@123", "roles": [ { "code": "SYSTEM", "tenantId": "pg" }, { "code": "PQM_CRONJOB_SCHEDULER", "name": "PQM_CRONJOB_SCHEDULER", "tenantId": "pg" } ] } }'.
Deployment
Update Scheduler
There are two ways to update the configuration of the scheduler:
Add the config in the DevOps environment file, and restart the service. This will trigger the scheduler based on the updated environment configuration and restart the pqm-service.
Pqm-scheduler:
cron: schedule: "*/10 * * * *"
Use the commands given below:
Change schedule - kubectl patch cronjobs pqm-scheduler -p '{"spec" : {"schedule": "*/10 * * * *" }}' Pause cron job - kubectl patch cronjobs pqm-scheduler -p '{"spec" : {"suspend" : true }}'
Resume cron job - kubectl patch cronjobs pqm-scheduler -p '{"spec" : {"suspend" : false}}'
Create a new cronjob scheduler - kubectl create job --from=cronjob/pqm-scheduler pqm-scheduler
Sequence Diagram
Create Lab Test (CronJob)
Last updated