Project-OMOTES / orchestrator

GNU General Public License v3.0
0 stars 0 forks source link

Orchestrator should up job rows in database older than 48 hours #38

Closed lfse-slafleur closed 4 months ago

lfse-slafleur commented 4 months ago

In erronuous situations it may happen that rows in the database get left. There is currently no mechanism that cleans them up. A sync or async thread (up to the developer) in the orchestrator should loop through the database checking if a row is older than 48 hours. In case the row is older than 48 hours, the row may be deleted outright.

This component should safe (in memory) the datetime when the component was initialized. This time may be used to check how long the orchestrator has been active for. Only after the orchestrator has been online for the time period for which is checked (48 hours) should the orchestrator be confident the job/row is actually 48 hours without successful completion. Otherwise, the orchestrator may have been offline for 48 hours or longer and the rows would be removed erronuously.

The component should receive the PostgresInterface as a constructor argument. The component MUST be isolated from other components in the orchestrator.

Please make sure to put any constants in logical places and make the 48 hours timeframe configurable. We use .env files as configuration files so please extend .env-template with any new configuration parameters.

Where to add to orchestrator:

Relevant functions:

The following logic may be used to determine if a job too old:

At least the function to determine if a job is too old must be unit tested. Other functions may be unit tested when possible or effective.