Repository: incubator-gobblin Updated Branches: refs/heads/master 99fcd7f3c -> de55592c6
[GOBBLIN-87] Fix runOnce not working correctly Closes #2096 from zxcware/runonce Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/de55592c Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/de55592c Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/de55592c Branch: refs/heads/master Commit: de55592c6760abfc0cdb371f1fb4ad734187704a Parents: 99fcd7f Author: zhchen <[email protected]> Authored: Fri Sep 22 12:59:43 2017 -0700 Committer: Abhishek Tiwari <[email protected]> Committed: Fri Sep 22 12:59:43 2017 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/gobblin/scheduler/JobScheduler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/de55592c/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java ---------------------------------------------------------------------- diff --git a/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java b/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java index 2313c13..7ef6d85 100644 --- a/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java +++ b/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java @@ -350,8 +350,6 @@ public class JobScheduler extends AbstractIdleService { } if (!jobProps.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) { - // A job without a cron schedule is considered a one-time job - jobProps.setProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "true"); // Submit the job to run this.jobExecutor.execute(new NonScheduledJobRunner(jobProps, jobListener)); return; @@ -486,6 +484,12 @@ public class JobScheduler extends AbstractIdleService { throws ConfigurationException, JobException, IOException { LOG.info("Scheduling configured jobs"); for (Properties jobProps : loadGeneralJobConfigs()) { + + if (!jobProps.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) { + // A job without a cron schedule is considered a one-time job + jobProps.setProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "true"); + } + boolean runOnce = Boolean.valueOf(jobProps.getProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "false")); scheduleJob(jobProps, runOnce ? new RunOnceJobListener() : new EmailNotificationJobListener()); this.listener.addToJobNameMap(jobProps);
