Skip to content

Commit

Permalink
Update information on background jobs post changes (#116)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4437

We have [recently migrated](DEFRA/water-abstraction-system#903) the **Licence not in charge version workflow** job from the [water-abstraction-service](https://github.com/DEFRA/water-abstraction-service) to a new job in [water-abstraction-system](https://github.com/DEFRA/water-abstraction-system).

Whilst we were at it we also arranged to get the [Time limited job](https://github.com/DEFRA/water-abstraction-team/blob/main/jobs/system.md#time-limited) scheduled in `production`.

This change updates our guides to reflect these changes.
  • Loading branch information
Cruikshanks authored May 2, 2024
1 parent 216cbee commit 95eefe3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
7 changes: 2 additions & 5 deletions jobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Using the information we have gathered about the background jobs running in the
|10:00|[Tracker](/jobs/import.md#tracker)|[water-abstraction-import](/jobs/import.md)|
|11:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|12:00|[Check for updated invoice accounts](/jobs/service.md#check-for-updated-invoice-accounts)|[water-abstraction-service](/jobs/service.md)|
| - |[Licence not in charge version workflow](/jobs/service.md#licence-not-in-charge-version-workflow)|[water-abstraction-service](/jobs/service.md)|
| - |[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|13:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|14:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
Expand All @@ -65,18 +64,15 @@ Using the information we have gathered about the background jobs running in the
|18:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
| - |[Digitise To Licence Gauging Stations](/jobs/service.md#digitise-to-licence-gauging-stations)|[water-abstraction-service](/jobs/service.md)|
| - |[Digitise to Licence Version Purpose (LVP) Sync](/jobs/service.md#digitise-to-licence-version-purpose-lvp-sync)|[water-abstraction-service](/jobs/service.md)|
| - |[Licence not in charge version workflow](/jobs/service.md#licence-not-in-charge-version-workflow)|[water-abstraction-service](/jobs/service.md)|
|19:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|20:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|20:15|[Time limited](/jobs/system.md#time-limited)|[water-abstraction-system](/jobs/system.md)|
|21:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|22:00|[Charge Categories Sync](/jobs/service.md#charge-categories-sync)|[water-abstraction-service](/jobs/service.md)|
| - |[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
| - |[Gauging Stations Sync](/jobs/service.md#gauging-stations-sync)|[water-abstraction-service](/jobs/service.md)|
|23:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|00:00|[Check for updated invoice accounts](/jobs/service.md#check-for-updated-invoice-accounts)|[water-abstraction-service](/jobs/service.md)|
| - |[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
| - |[Licence not in charge version workflow](/jobs/service.md#licence-not-in-charge-version-workflow)|[water-abstraction-service](/jobs/service.md)|
|01:00|[Charging import (data)](/jobs/import.md#charging-import-data)|[water-abstraction-import](/jobs/import.md)|
| - |[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
| - |[NALD import](/jobs/import.md#nald-import)|[water-abstraction-import](/jobs/import.md)|
Expand All @@ -88,7 +84,8 @@ Using the information we have gathered about the background jobs running in the
| - |[Licence import](/jobs/import.md#licence-import)|[water-abstraction-import](/jobs/import.md)|
|05:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|06:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
| - |[Licence not in charge version workflow](/jobs/service.md#licence-not-in-charge-version-workflow)|[water-abstraction-service](/jobs/service.md)|
|07:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|08:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
|08:05|[Licence updates](/jobs/system.md#licence-updates)|[water-abstraction-system](/jobs/system.md)|
|08:15|[Time limited](/jobs/system.md#time-limited)|[water-abstraction-system](/jobs/system.md)|
|09:00|[Customer file refresh](/jobs/service.md#customer-file-refresh)|[water-abstraction-service](/jobs/service.md)|
9 changes: 0 additions & 9 deletions jobs/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ The jobs appear to be grouped by what they are related to.
- [Charge Categories Sync](#charge-categories-sync)
- [Check for updated invoice accounts](#check-for-updated-invoice-accounts)
- [Customer file refresh](#customer-file-refresh)
- Charge versions
- [Licence not in charge version workflow](#licence-not-in-charge-version-workflow)
- Gauging stations
- [Digitise To Licence Gauging Stations](#digitise-to-licence-gauging-stations)
- [Digitise to Licence Version Purpose (LVP) Sync](#digitise-to-licence-version-purpose-lvp-sync)
Expand Down Expand Up @@ -147,13 +145,6 @@ There is a CSV file (`gauging-stations/gauging-stations.csv`) held in the `wabs3

Every 6 hours this job checks for changes and either inserts or updates the changes. It is also pointless for exactly the same reasons as [Charge Categories Sync](#charge-categories-sync)!

### Licence not in charge version workflow

- **request** N/A
- **Schedule** Every 6th hour of the day (00:00, 06:00, 12:00, and 18:00)

We _think_ this job looks for licences that do not have a charge version. For those it finds it creates a `water.charge_version_workflow` record. We as yet have had no need to interact with this table so we don't know what then happens with the information.

### Refresh event

- **request** N/A
Expand Down
21 changes: 19 additions & 2 deletions jobs/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,26 @@ This is a fallback option should the overnight refresh of our DB to a read-only

These schema `.tgz` files are then uploaded to AWS S3 where they can de downloaded. This was built to support the reporting needs of the service. It is not currently scheduled in `production`.

### Licence updates

- **request** `POST /jobs/licence-updates`
- **schedule** 08:15 every day

> Replaced a job in the legacy [water-abstraction-service](https://github.com/DEFRA/water-abstraction-service) which we had to replace when we found that BullMQ isn't reliably triggering scheduled jobs.
For context, putting a licence into workflow is a current practice to prevent them being billed until the Billing & Data team have had a chance to confirm all is well.

The job puts licences into 'workflow' that have a `licence_version` that was created in the last 2 months (from date the job is run). If the licence is already in 'workflow' or part of a PRESROC bill run it skips adding it. Hence, the 2 month window. This covers licences that, for example, were in a bill run that has now been 'sent', so can be added to workflow for checking.

Essentially, the current logic is premised that there is a 1-to-1 relationship between `licence_version` and `charge_version_workflows` where `deleted_date` is not null! This is what stops a licence continually being added back into workflow.

See [WATER-4437](https://eaflood.atlassian.net/browse/WATER-4437) for more details if needed.

### Time limited

- **request** `POST /jobs/time-limited`
- **schedule** 20:15 every day
- **schedule** 08:05 every day

> We intentionally run this job before [Licence updates](#licence-updates). Should a licence with a time limited purpose get updated, highlighting it is time-limited takes precedence over it also being an updated licence
Puts SROC licences into 'workflow' that have a related `purpose` that is due to expire in less than 50 days. See [WATER-3486](https://eaflood.atlassian.net/browse/WATER-3486) for more details if needed.
Puts SROC licences into 'workflow' that have a related `purpose` that is due to expire in less than 50 days. You'll see them listed on the **Charge information workflow** 'To setup' tab with the action link `Time limited`. See [WATER-3486](https://eaflood.atlassian.net/browse/WATER-3486) for more details if needed.

0 comments on commit 95eefe3

Please sign in to comment.