private Class<? extends ExecutorManagerAdapter> resolveExecutorManagerAdaptorClassType() { return this.props.getBoolean(ConfigurationKeys.AZKABAN_POLL_MODEL, false) ? ExecutionController.class : ExecutorManager.class; }
@Deprecated private void checkMultiExecutorMode() { if (!this.azkProps.getBoolean(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, false)) { throw new IllegalArgumentException( Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS + " must be true. Single executor mode is not supported any more."); } }
private void setStatsOnConnectors(final Server server) { final boolean isStatsOn = this.props.getBoolean("jetty.connector.stats", true); logger.info("Setting up connector with stats on: " + isStatsOn); for (final Connector connector : server.getConnectors()) { connector.setStatsOn(isStatsOn); } }
@Override public void run() { try { if (webServer.props.getBoolean(ConfigurationKeys.ENABLE_QUARTZ, false)) { logger.info("Shutting down flow trigger scheduler..."); webServer.scheduler.shutdown(); } } catch (final Exception e) { logger.error("Exception while shutting down flow trigger service.", e); } try { if (webServer.props.getBoolean(ConfigurationKeys.ENABLE_QUARTZ, false)) { logger.info("Shutting down flow trigger service..."); webServer.flowTriggerService.shutdown(); } } catch (final Exception e) { logger.error("Exception while shutting down flow trigger service.", e); } try { logger.info("Logging top memory consumers..."); logTopMemoryConsumers(); logger.info("Shutting down http server..."); webServer.close(); } catch (final Exception e) { logger.error("Exception while shutting down web server.", e); } logger.info("kk thx bye."); }
private void validateDatabaseVersion() throws IOException, SQLException { final boolean checkDB = this.props .getBoolean(AzkabanDatabaseSetup.DATABASE_CHECK_VERSION, false); if (checkDB) { final AzkabanDatabaseSetup setup = new AzkabanDatabaseSetup(this.props); setup.loadTableInfo(); if (setup.needsUpdating()) { logger.error("Database is out of date."); setup.printUpgradePlan(); logger.error("Exiting with error."); System.exit(-1); } } }
/** * prints the current Job props to the Job log. */ protected void logJobProperties() { if (this.jobProps != null && this.jobProps.getBoolean(JOB_DUMP_PROPERTIES_IN_LOG, false)) { try { final Map<String, String> flattenedProps = this.jobProps.getFlattened(); this.info("****** Job properties ******"); this.info(String.format("- Note : value is masked if property name ends with '%s'.", SENSITIVE_JOB_PROP_NAME_SUFFIX)); for (final Map.Entry<String, String> entry : flattenedProps.entrySet()) { final String key = entry.getKey(); final String value = key.endsWith(SENSITIVE_JOB_PROP_NAME_SUFFIX) ? SENSITIVE_JOB_PROP_VALUE_PLACEHOLDER : entry.getValue(); this.info(String.format("%s=%s", key, value)); } this.info("****** End Job properties ******"); } catch (final Exception ex) { this.log.error("failed to log job properties ", ex); } } }
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); final AzkabanWebServer server = (AzkabanWebServer) getApplication(); this.userManager = server.getUserManager(); this.lockdownCreateProjects = server.getServerProps().getBoolean(LOCKDOWN_CREATE_PROJECTS_KEY, false); if (this.lockdownCreateProjects) { logger.info("Creation of projects is locked down"); } }
private void prepareAndStartServer() throws Exception { validateDatabaseVersion(); createThreadPool(); configureRoutes(); // Todo jamiesjc: enable web metrics for azkaban poll model later if (this.props.getBoolean(Constants.ConfigurationKeys.IS_METRICS_ENABLED, false) && !this.props.getBoolean(ConfigurationKeys.AZKABAN_POLL_MODEL, false)) { startWebMetrics(); } if (this.props.getBoolean(ConfigurationKeys.ENABLE_QUARTZ, false)) { // flowTriggerService needs to be started first before scheduler starts to schedule // existing flow triggers logger.info("starting flow trigger service"); this.flowTriggerService.start(); logger.info("starting flow trigger scheduler"); this.scheduler.start(); } try { this.server.start(); logger.info("Server started"); } catch (final Exception e) { logger.warn(e); Utils.croak(e.getMessage(), 1); } }
@Inject public ProjectManager(final AzkabanProjectLoader azkabanProjectLoader, final ProjectLoader loader, final StorageManager storageManager, final Props props) { this.projectLoader = requireNonNull(loader); this.props = requireNonNull(props); this.azkabanProjectLoader = requireNonNull(azkabanProjectLoader); this.creatorDefaultPermissions = props.getBoolean("creator.default.proxy", true); // The prop passed to XmlValidatorManager is used to initialize all the // validators // Each validator will take certain key/value pairs from the prop to // initialize itself. final Props prop = new Props(props); prop.put(ValidatorConfigs.PROJECT_ARCHIVE_FILE_PATH, "initialize"); // By instantiating an object of XmlValidatorManager, this will verify the // config files for the validators. new XmlValidatorManager(prop); loadAllProjects(); loadProjectWhiteList(); }
private QueueProcessorThread setupQueueProcessor() { return new QueueProcessorThread( this.azkProps.getBoolean(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, true), this.azkProps.getLong(Constants.ConfigurationKeys.ACTIVE_EXECUTOR_REFRESH_IN_MS, 50000), this.azkProps.getInt( Constants.ConfigurationKeys.ACTIVE_EXECUTOR_REFRESH_IN_NUM_FLOW, 5), this.azkProps.getInt( Constants.ConfigurationKeys.MAX_DISPATCHING_ERRORS_PERMITTED, this.activeExecutors.getAll().size()), this.sleepAfterDispatchFailure); }
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); this.multipartParser = new MultipartParser(DEFAULT_UPLOAD_DISK_SPOOL_SIZE); this.shouldLogRawUserAgent = getApplication().getServerProps().getBoolean("accesslog.raw.useragent", false); }
@Inject public QuartzScheduler(final Props azProps) throws SchedulerException { if (!azProps.getBoolean(ConfigurationKeys.ENABLE_QUARTZ, false)) { return; } // TODO kunkun-tang: Many quartz properties should be defaulted such that not necessarily being // checked into azkaban.properties. Also, we need to only assemble Quartz related properties // here, which should be done in Azkaban WebServer Guice Module. final StdSchedulerFactory schedulerFactory = new StdSchedulerFactory(azProps.toAllProperties()); this.scheduler = schedulerFactory.getScheduler(); // Currently Quartz only support internal job schedules. When we migrate to User Production // flows, we need to construct a Guice-Free JobFactory for use. this.scheduler.setJobFactory(SERVICE_PROVIDER.getInstance(SchedulerJobFactory.class)); }
@Inject public EmailMessageCreator(final Props props) { this.mailHost = props.getString("mail.host", "localhost"); this.mailPort = props.getInt("mail.port", DEFAULT_SMTP_PORT); this.mailUser = props.getString("mail.user", ""); this.mailPassword = props.getString("mail.password", ""); this.mailSender = props.getString("mail.sender", ""); this.tls = props.getString("mail.tls", "false"); this.usesAuth = props.getBoolean("mail.useAuth", true); }
private static void updateDerivedConfigs(final Props azkabanSettings) { final boolean isSslEnabled = azkabanSettings.getBoolean("jetty.use.ssl", true); final int port = isSslEnabled ? azkabanSettings.getInt("jetty.ssl.port", DEFAULT_SSL_PORT_NUMBER) : azkabanSettings.getInt("jetty.port", DEFAULT_PORT_NUMBER); // setting stats configuration for connectors final String hostname = azkabanSettings.getString("jetty.hostname", "localhost"); azkabanSettings.put("server.hostname", hostname); azkabanSettings.put("server.port", port); azkabanSettings.put("server.useSSL", String.valueOf(isSslEnabled)); }
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); final AzkabanWebServer server = (AzkabanWebServer) getApplication(); this.projectManager = server.getProjectManager(); this.executorManagerAdapter = server.getExecutorManager(); this.scheduleManager = server.getScheduleManager(); this.userManager = server.getUserManager(); this.scheduler = server.getScheduler(); this.lockdownCreateProjects = server.getServerProps().getBoolean(LOCKDOWN_CREATE_PROJECTS_KEY, false); this.enableQuartz = server.getServerProps().getBoolean(ConfigurationKeys.ENABLE_QUARTZ, false); if (this.lockdownCreateProjects) { logger.info("Creation of projects is locked down"); } this.lockdownUploadProjects = server.getServerProps().getBoolean(LOCKDOWN_UPLOAD_PROJECTS_KEY, false); if (this.lockdownUploadProjects) { logger.info("Uploading of projects is locked down"); } this.downloadBufferSize = server.getServerProps().getInt(PROJECT_DOWNLOAD_BUFFER_SIZE_IN_BYTES, 8192); logger.info("downloadBufferSize: " + this.downloadBufferSize); }
if (prop.getBoolean(CommonJobProperties.ROOT_NODE, false)) { this.rootNodes.add(jobName);
@Override public Server get() { requireNonNull(this.props); final int maxThreads = this.props .getInt("jetty.maxThreads", Constants.DEFAULT_JETTY_MAX_THREAD_COUNT); final boolean useSsl = this.props.getBoolean("jetty.use.ssl", true); final int port; final Server server = new Server(); if (useSsl) { final int sslPortNumber = this.props .getInt("jetty.ssl.port", Constants.DEFAULT_SSL_PORT_NUMBER); port = sslPortNumber; server.addConnector(getSslSocketConnector(sslPortNumber)); } else { port = this.props.getInt("jetty.port", Constants.DEFAULT_PORT_NUMBER); server.addConnector(getSocketConnector(port)); } // setting stats configuration for connectors setStatsOnConnectors(server); logger.info(String.format( "Starting %sserver on port: %d # Max threads: %d", useSsl ? "SSL " : "", port, maxThreads)); return server; }
@Inject public Emailer(final Props props, final CommonMetrics commonMetrics, final EmailMessageCreator messageCreator, final ExecutorLoader executorLoader) { super(props, messageCreator); this.executorLoader = requireNonNull(executorLoader, "executorLoader is null."); this.commonMetrics = requireNonNull(commonMetrics, "commonMetrics is null."); this.azkabanName = props.getString("azkaban.name", "azkaban"); final int mailTimeout = props.getInt("mail.timeout.millis", 30000); EmailMessage.setTimeout(mailTimeout); final int connectionTimeout = props.getInt("mail.connection.timeout.millis", 30000); EmailMessage.setConnectionTimeout(connectionTimeout); EmailMessage.setTotalAttachmentMaxSize(getAttachmentMaxSize()); this.clientHostname = props.getString(ConfigurationKeys.AZKABAN_WEBSERVER_EXTERNAL_HOSTNAME, props.getString("jetty.hostname", "localhost")); if (props.getBoolean("jetty.use.ssl", true)) { this.scheme = HTTPS; this.clientPortNumber = Integer.toString(props .getInt(ConfigurationKeys.AZKABAN_WEBSERVER_EXTERNAL_SSL_PORT, props.getInt("jetty.ssl.port", Constants.DEFAULT_SSL_PORT_NUMBER))); } else { this.scheme = HTTP; this.clientPortNumber = Integer.toString( props.getInt(ConfigurationKeys.AZKABAN_WEBSERVER_EXTERNAL_PORT, props.getInt("jetty.port", Constants.DEFAULT_PORT_NUMBER))); } }
@Provides public VelocityEngine createVelocityEngine(final Props props) { final boolean devMode = props.getBoolean(VELOCITY_DEV_MODE_PARAM, false);
page.add( "validatorFixPrompt", this.projectManager.getProps().getBoolean( ValidatorConfigs.VALIDATOR_AUTO_FIX_PROMPT_FLAG_PARAM, ValidatorConfigs.DEFAULT_VALIDATOR_AUTO_FIX_PROMPT_FLAG));