public ContextConfiguration(string configString) { using (LOGGER.LogFunction("ContextConfiguration::ContextConfigurationn")) { ContainerDirectory = Directory.GetCurrentDirectory(); _settings = new Dictionary <string, string>(); AvroConfiguration avroConfiguration = AvroConfiguration.GetAvroConfigurationFromEmbeddedString(configString); foreach (ConfigurationEntry config in avroConfiguration.Bindings) { if (config.key.Contains(Reef.Evaluator.Constants.ContextIdentifier)) { config.key = Reef.Evaluator.Constants.ContextIdentifier; LOGGER.Log(Level.Verbose, string.Format(CultureInfo.InvariantCulture, "{0} detected for context id with value {1}", config.key, config.value)); } _settings.Add(config.key, config.value); } if (!_settings.ContainsKey(Reef.Evaluator.Constants.ContextIdentifier)) { string msg = "Required parameter ContextIdentifier not provided."; LOGGER.Log(Level.Error, msg); Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException(msg), LOGGER); } } }
public TaskConfiguration(string configString) { TangConfig = new AvroConfigurationSerializer().FromString(configString); AvroConfiguration avroConfiguration = AvroConfiguration.GetAvroConfigurationFromEmbeddedString(configString); foreach (ConfigurationEntry config in avroConfiguration.Bindings) { if (config.key.Contains(TaskIdentifier)) { TaskId = config.value; } } if (string.IsNullOrWhiteSpace(TaskId)) { string msg = "Required parameter TaskId not provided."; LOGGER.Log(Level.Error, msg); Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException(msg), LOGGER); } }