@Test public void testAllowNoExecutorDockerTask() throws TaskDescriptionException { TaskConfig builder = CONFIG_WITH_CONTAINER.newBuilder(); builder.unsetExecutorConfig(); DOCKER_CONFIGURATION_MANAGER.validateAndPopulate(ITaskConfig.build(builder)); }
public IJobConfiguration validateAndPopulate(IJobConfiguration job) throws TaskDescriptionException { requireNonNull(job); if (!job.isSetTaskConfig()) { throw new TaskDescriptionException("Job configuration must have taskConfig set."); } if (job.getInstanceCount() <= 0) { throw new TaskDescriptionException("Instance count must be positive."); } JobConfiguration builder = job.newBuilder(); if (!JobKeys.isValid(job.getKey())) { throw new TaskDescriptionException("Job key " + job.getKey() + " is invalid."); } if (job.isSetOwner() && !UserProvidedStrings.isGoodIdentifier(job.getOwner().getUser())) { throw new TaskDescriptionException( "Job user contains illegal characters: " + job.getOwner().getUser()); } builder.setTaskConfig( validateAndPopulate(ITaskConfig.build(builder.getTaskConfig())).newBuilder()); if (!Strings.isNullOrEmpty(job.getCronSchedule()) && builder.getTaskConfig().isIsService()) { throw new TaskDescriptionException( "A service task may not be run on a cron schedule: " + builder); } return IJobConfiguration.build(builder); }
ConfigurationManager { public IJobConfiguration validateAndPopulate(IJobConfiguration job) throws TaskDescriptionException { requireNonNull(job); if (!job.isSetTaskConfig()) { throw new TaskDescriptionException("Job configuration must have taskConfig set."); } if (job.getInstanceCount() <= 0) { throw new TaskDescriptionException("Instance count must be positive."); } JobConfiguration builder = job.newBuilder(); if (!JobKeys.isValid(job.getKey())) { throw new TaskDescriptionException("Job key " + job.getKey() + " is invalid."); } if (job.isSetOwner() && !UserProvidedStrings.isGoodIdentifier(job.getOwner().getUser())) { throw new TaskDescriptionException( "Job user contains illegal characters: " + job.getOwner().getUser()); } builder.setTaskConfig( validateAndPopulate(ITaskConfig.build(builder.getTaskConfig())).newBuilder()); if (!Strings.isNullOrEmpty(job.getCronSchedule()) && builder.getTaskConfig().isIsService()) { throw new TaskDescriptionException( "A service task may not be run on a cron schedule: " + builder); } return IJobConfiguration.build(builder); } }
ConfigurationManager { public IJobConfiguration validateAndPopulate(IJobConfiguration job) throws TaskDescriptionException { requireNonNull(job); if (!job.isSetTaskConfig()) { throw new TaskDescriptionException("Job configuration must have taskConfig set."); } if (job.getInstanceCount() <= 0) { throw new TaskDescriptionException("Instance count must be positive."); } JobConfiguration builder = job.newBuilder(); if (!JobKeys.isValid(job.getKey())) { throw new TaskDescriptionException("Job key " + job.getKey() + " is invalid."); } if (job.isSetOwner() && !UserProvidedStrings.isGoodIdentifier(job.getOwner().getUser())) { throw new TaskDescriptionException( "Job user contains illegal characters: " + job.getOwner().getUser()); } builder.setTaskConfig( validateAndPopulate(ITaskConfig.build(builder.getTaskConfig())).newBuilder()); if (!Strings.isNullOrEmpty(job.getCronSchedule()) && builder.getTaskConfig().isIsService()) { throw new TaskDescriptionException( "A service task may not be run on a cron schedule: " + builder); } return IJobConfiguration.build(builder); } @Inject  ConfigurationManager(ConfigurationManagerSettings settings, TierManager tierManager); }
ConfigurationManager { public IJobConfiguration validateAndPopulate(IJobConfiguration job) throws TaskDescriptionException { requireNonNull(job); if (!job.isSetTaskConfig()) { throw new TaskDescriptionException("Job configuration must have taskConfig set."); } if (job.getInstanceCount() <= 0) { throw new TaskDescriptionException("Instance count must be positive."); } JobConfiguration builder = job.newBuilder(); if (!JobKeys.isValid(job.getKey())) { throw new TaskDescriptionException("Job key " + job.getKey() + " is invalid."); } if (job.isSetOwner() && !UserProvidedStrings.isGoodIdentifier(job.getOwner().getUser())) { throw new TaskDescriptionException( "Job user contains illegal characters: " + job.getOwner().getUser()); } builder.setTaskConfig( validateAndPopulate(ITaskConfig.build(builder.getTaskConfig())).newBuilder()); if (!Strings.isNullOrEmpty(job.getCronSchedule()) && builder.getTaskConfig().isIsService()) { throw new TaskDescriptionException( "A service task may not be run on a cron schedule: " + builder); } return IJobConfiguration.build(builder); } @Inject  ConfigurationManager(ConfigurationManagerSettings settings, TierManager tierManager); static boolean isDedicated(Iterable<IConstraint> taskConstraints); IJobConfiguration validateAndPopulate(IJobConfiguration job); ITaskConfig validateAndPopulate(ITaskConfig config); static Predicate<IConstraint> getConstraintByName(final String name); }
ConfigurationManager { public IJobConfiguration validateAndPopulate(IJobConfiguration job) throws TaskDescriptionException { requireNonNull(job); if (!job.isSetTaskConfig()) { throw new TaskDescriptionException("Job configuration must have taskConfig set."); } if (job.getInstanceCount() <= 0) { throw new TaskDescriptionException("Instance count must be positive."); } JobConfiguration builder = job.newBuilder(); if (!JobKeys.isValid(job.getKey())) { throw new TaskDescriptionException("Job key " + job.getKey() + " is invalid."); } if (job.isSetOwner() && !UserProvidedStrings.isGoodIdentifier(job.getOwner().getUser())) { throw new TaskDescriptionException( "Job user contains illegal characters: " + job.getOwner().getUser()); } builder.setTaskConfig( validateAndPopulate(ITaskConfig.build(builder.getTaskConfig())).newBuilder()); if (!Strings.isNullOrEmpty(job.getCronSchedule()) && builder.getTaskConfig().isIsService()) { throw new TaskDescriptionException( "A service task may not be run on a cron schedule: " + builder); } return IJobConfiguration.build(builder); } @Inject  ConfigurationManager(ConfigurationManagerSettings settings, TierManager tierManager); static boolean isDedicated(Iterable<IConstraint> taskConstraints); IJobConfiguration validateAndPopulate(IJobConfiguration job); ITaskConfig validateAndPopulate(ITaskConfig config); static Predicate<IConstraint> getConstraintByName(final String name); static final String DEDICATED_ATTRIBUTE; }