Search in sources :

Example 1 with ConfigFactory

use of org.apache.samza.config.ConfigFactory in project samza by apache.

the class SamzaTaskProxy method getCoordinatorSystemConfig.

/**
   * Builds coordinator system config for the {@param jobInstance}.
   * @param jobInstance the job instance to get the jobModel for.
   * @return the constructed coordinator system config.
   */
private Config getCoordinatorSystemConfig(JobInstance jobInstance) {
    try {
        InstallationRecord record = installFinder.getAllInstalledJobs().get(jobInstance);
        ConfigFactory configFactory = ClassLoaderHelper.fromClassName(taskResourceConfig.getJobConfigFactory());
        Config config = configFactory.getConfig(new URI(String.format("file://%s", record.getConfigFilePath())));
        Map<String, String> configMap = ImmutableMap.of(JobConfig.JOB_ID(), jobInstance.getJobId(), JobConfig.JOB_NAME(), jobInstance.getJobName());
        return Util.buildCoordinatorStreamConfig(new MapConfig(ImmutableList.of(config, configMap)));
    } catch (Exception e) {
        LOG.error(String.format("Failed to get coordinator stream config for job : %s", jobInstance), e);
        throw new SamzaException(e);
    }
}
Also used : JobConfig(org.apache.samza.config.JobConfig) MapConfig(org.apache.samza.config.MapConfig) StorageConfig(org.apache.samza.config.StorageConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) InstallationRecord(org.apache.samza.rest.proxy.installation.InstallationRecord) URI(java.net.URI) SamzaException(org.apache.samza.SamzaException) IOException(java.io.IOException) SamzaException(org.apache.samza.SamzaException) ConfigFactory(org.apache.samza.config.ConfigFactory)

Aggregations

IOException (java.io.IOException)1 URI (java.net.URI)1 SamzaException (org.apache.samza.SamzaException)1 Config (org.apache.samza.config.Config)1 ConfigFactory (org.apache.samza.config.ConfigFactory)1 JobConfig (org.apache.samza.config.JobConfig)1 MapConfig (org.apache.samza.config.MapConfig)1 StorageConfig (org.apache.samza.config.StorageConfig)1 InstallationRecord (org.apache.samza.rest.proxy.installation.InstallationRecord)1