/** * Create a {@link Trigger} from the given {@link JobSpec} */ private Trigger createTrigger(JobKey jobKey, JobSpec jobSpec) { // Build a trigger for the job with the given cron-style schedule return TriggerBuilder.newTrigger() .withIdentity("Cron for " + jobSpec.getUri()) .forJob(jobKey) .withSchedule(CronScheduleBuilder.cronSchedule( jobSpec.getConfig().getString(ConfigurationKeys.JOB_SCHEDULE_KEY))) .build(); }
jobSpec.setConfig(jobSpec.getConfig().withoutPath(ConfigurationKeys.JOB_SCHEDULE_KEY)); jobSpec.setConfig(jobSpec.getConfig() .withValue(ConfigurationKeys.JOB_NAME_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY))); jobSpec.setConfig(jobSpec.getConfig() .withValue(ConfigurationKeys.JOB_GROUP_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_GROUP_KEY))); jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, ConfigValueFactory.fromAnyRef(flowExecutionId))); jobSpec.setConfigAsProperties(ConfigUtils.configToProperties(jobSpec.getConfig()));
private static Config resolveConfig(JobSpec jobSpec, JobCatalog catalog) throws SpecNotFoundException, JobTemplate.TemplateException { Optional<URI> templateURIOpt = jobSpec.getTemplateURI(); if (templateURIOpt.isPresent()) { JobCatalogWithTemplates catalogWithTemplates = new PackagedTemplatesJobCatalogDecorator(catalog); JobTemplate template = catalogWithTemplates.getTemplate(templateURIOpt.get()); return template.getResolvedConfig(jobSpec.getConfig()).resolve(); } else { return jobSpec.getConfig().resolve(); } }
String renderedConfig = ConfigFactory.parseMap(injectedKeys).withFallback(jobSpec.getConfig()) .root().render(ConfigRenderOptions.defaults()); try (DataOutputStream os = fs.create(shadowFilePath);
ConfigUtils.getBoolean(state.getJobSpec().getConfig(), ConfigurationKeys.ALERT_EMAIL_ENABLED_KEY, false); boolean notificationEmailEnabled = ConfigUtils.getBoolean(state.getJobSpec().getConfig(), ConfigurationKeys.NOTIFICATION_EMAIL_ENABLED_KEY, false); EmailUtils.sendJobFailureAlertEmail(state.getJobSpec().toShortString(), getEmailBody(state, previousStatus, newStatus), 1, ConfigUtils.configToState(state.getJobSpec().getConfig())); } catch (EmailException ee) { LOGGER.error("Failed to send job failure alert email for job " + state.getJobSpec().toShortString(), ee); EmailUtils.sendJobCompletionEmail(state.getJobSpec().toShortString(), getEmailBody(state, previousStatus, newStatus), newStatus.toString(), ConfigUtils.configToState(state.getJobSpec().getConfig())); } catch (EmailException ee) { LOGGER.error("Failed to send job completion notification email for job "