Skip to content

Commit

Permalink
Add log for when retention job starts (#2551)
Browse files Browse the repository at this point in the history
* Add log for when retention job starts

Signed-off-by: wslulciuc <willy@datakin.com>

---------

Signed-off-by: wslulciuc <willy@datakin.com>
  • Loading branch information
wslulciuc authored Jul 25, 2023
1 parent 3aa0b5b commit 8a61feb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions api/src/main/java/marquez/jobs/DbRetentionJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
public class DbRetentionJob extends AbstractScheduledService implements Managed {
private static final Duration NO_DELAY = Duration.ofMinutes(0);

/* The retention policy frequency. */
private final int frequencyMins;

/* The number of rows deleted per batch. */
private final int numberOfRowsPerBatch;

Expand All @@ -42,10 +45,11 @@ public class DbRetentionJob extends AbstractScheduledService implements Managed
*/
public DbRetentionJob(
@NonNull final Jdbi jdbi, @NonNull final DbRetentionConfig dbRetentionConfig) {
this.frequencyMins = dbRetentionConfig.getFrequencyMins();
this.numberOfRowsPerBatch = dbRetentionConfig.getNumberOfRowsPerBatch();
this.retentionDays = dbRetentionConfig.getRetentionDays();

// Open connection.
// Connection to database retention policy will be applied.
this.jdbi = jdbi;

// Define fixed schedule with no delay.
Expand All @@ -61,8 +65,12 @@ protected Scheduler scheduler() {

@Override
public void start() throws Exception {
log.info("Starting db retention job...");
startAsync().awaitRunning();
log.info(
"Started db retention job with retention policy of '{}' days, "
+ "scheduled to be applied every '{}' mins.",
retentionDays,
frequencyMins);
}

@Override
Expand Down

0 comments on commit 8a61feb

Please sign in to comment.