Skip to content

Commit

Permalink
Put UTC info in prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Urmi Mustafi committed Sep 19, 2023
1 parent 9683a9e commit 00ae0ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ protected Trigger createAndScheduleReminder(JobKey origJobKey, MultiActiveLeaseA
triggerEventTimeMillis);
Trigger reminderTrigger = JobScheduler.createTriggerForJob(reminderJobKey, getJobPropertiesFromJobDetail(jobDetail),
Optional.of(reminderSuffix));
log.debug("Flow Trigger Handler - [{}, eventTimestamp: {}] - attempting to schedule reminder for event {} with"
log.debug("Flow Trigger Handler - [{}, eventTimestamp: {}] - attempting to schedule reminder for event {} with "
+ "reminderJobKey {} and reminderTriggerKey {}", status.getFlowAction(), triggerEventTimeMillis,
status.getEventTimeMillis(), reminderJobKey, reminderTrigger.getKey());
this.schedulerService.getScheduler().scheduleJob(jobDetail, reminderTrigger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,12 @@ public synchronized void scheduleJob(Properties jobProps, JobListener jobListene
@Override
protected void logNewlyScheduledJob(JobDetail job, Trigger trigger) {
Properties jobProps = (Properties) job.getJobDataMap().get(PROPERTIES_KEY);
log.info(jobSchedulerTracePrefixBuilder(jobProps) + "nextTriggerTime (in UTC): {} - Job newly "
+ "scheduled", utcDateAsUTCEpochMillis(trigger.getNextFireTime()));
log.info(jobSchedulerTracePrefixBuilder(jobProps) + "nextTriggerTime: {} - Job newly scheduled",
utcDateAsUTCEpochMillis(trigger.getNextFireTime()));
}

protected static String jobSchedulerTracePrefixBuilder(Properties jobProps) {
return String.format("Scheduler trigger tracing: [flowName: %s flowGroup: %s] - ",
return String.format("Scheduler trigger tracing (in epoch-ms UTC): [flowName: %s flowGroup: %s] - ",
jobProps.getProperty(ConfigurationKeys.FLOW_NAME_KEY, "<<no flow name>>"),
jobProps.getProperty(ConfigurationKeys.FLOW_GROUP_KEY, "<<no flow group>>"));
}
Expand Down Expand Up @@ -760,17 +760,16 @@ public void executeImpl(JobExecutionContext context) throws JobExecutionExceptio
ConfigurationKeys.SCHEDULER_PRESERVED_CONSENSUS_EVENT_TIME_MILLIS_KEY, "0");
String expectedReminderTime = jobProps.getProperty(
ConfigurationKeys.SCHEDULER_EXPECTED_REMINDER_TIME_MILLIS_KEY, "0");
_log.info(jobSchedulerTracePrefixBuilder(jobProps) + "triggerTime (in UTC): {} expectedReminderTime (in "
+ "UTC): {} - Reminder job triggered by scheduler at {}", preservedConsensusEventTime,
expectedReminderTime, triggerTimeMillis);
_log.info(jobSchedulerTracePrefixBuilder(jobProps) + "triggerTime: {} expectedReminderTime: {} - Reminder job"
+ " triggered by scheduler at {}", preservedConsensusEventTime, expectedReminderTime,
triggerTimeMillis);
// TODO: add a metric if expected reminder time far exceeds system time
jobProps.setProperty(ConfigurationKeys.ORCHESTRATOR_TRIGGER_EVENT_TIME_MILLIS_KEY, preservedConsensusEventTime);
} else {
jobProps.setProperty(ConfigurationKeys.ORCHESTRATOR_TRIGGER_EVENT_TIME_MILLIS_KEY,
String.valueOf(triggerTimeMillis));
_log.info(jobSchedulerTracePrefixBuilder(jobProps) + "triggerTime (in UTC): {} nextTriggerTime (in UTC): {} -"
+ " Job triggered by scheduler", triggerTimeMillis,
utcDateAsUTCEpochMillis(trigger.getNextFireTime()));
_log.info(jobSchedulerTracePrefixBuilder(jobProps) + "triggerTime: {} nextTriggerTime: {} - Job triggered by "
+ "scheduler", triggerTimeMillis, utcDateAsUTCEpochMillis(trigger.getNextFireTime()));
}
jobScheduler.runJob(jobProps, jobListener);
} catch (Throwable t) {
Expand Down

0 comments on commit 00ae0ea

Please sign in to comment.