Repository: reef
Updated Branches:
  refs/heads/master df79b80e0 -> 12daaba3b


[REEF-1173] Remove EvaluatorConfigurations

JIRA:
  [REEF-1173](https://issues.apache.org/jira/browse/REEF-1173)

This closes #807


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/12daaba3
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/12daaba3
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/12daaba3

Branch: refs/heads/master
Commit: 12daaba3b5cec6903754cf700c46a089af5e55d3
Parents: df79b80
Author: Andrew Chung <[email protected]>
Authored: Fri Jan 29 15:11:52 2016 -0800
Committer: Julia Wang <[email protected]>
Committed: Sat Jan 30 01:02:58 2016 -0800

----------------------------------------------------------------------
 .../Org.Apache.REEF.Common.csproj               |   1 -
 .../Evaluator/Utils/EvaluatorConfigurations.cs  | 224 -------------------
 .../EvaluatorConfigurationsTests.cs             |  28 ---
 3 files changed, 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/12daaba3/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj 
b/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
index ebaa513..65c85e3 100644
--- a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
+++ b/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj
@@ -154,7 +154,6 @@ under the License.
     <Compile Include="Runtime\Evaluator\Task\TaskState.cs" />
     <Compile Include="Runtime\Evaluator\Task\TaskStatus.cs" />
     <Compile Include="Runtime\Evaluator\Task\TaskStopImpl.cs" />
-    <Compile Include="Runtime\Evaluator\Utils\EvaluatorConfigurations.cs" />
     <Compile Include="Runtime\Evaluator\Utils\NamedparameterAlias.cs" />
     <Compile Include="runtime\MachineStatus.cs" />
     <Compile Include="Services\IService.cs" />

http://git-wip-us.apache.org/repos/asf/reef/blob/12daaba3/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs
 
b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs
deleted file mode 100644
index 4bbe178..0000000
--- 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Globalization;
-using System.IO;
-using Org.Apache.REEF.Common.Runtime.Evaluator.Context;
-using Org.Apache.REEF.Common.Services;
-using Org.Apache.REEF.Common.Tasks;
-using Org.Apache.REEF.Tang.Exceptions;
-using Org.Apache.REEF.Tang.Formats;
-using Org.Apache.REEF.Tang.Implementations.Tang;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Utilities.Logging;
-
-namespace Org.Apache.REEF.Common.Runtime.Evaluator.Utils
-{
-    internal sealed class EvaluatorConfigurations
-    {
-        private static readonly Logger LOGGER = 
Logger.GetLogger(typeof(EvaluatorConfigurations));
-
-        private readonly string _applicationId;
-
-        private readonly string _evaluatorId;
-
-        private readonly string _taskConfiguration;
-
-        private readonly string _rootContextConfiguration;
-
-        private readonly string _rootServiceConfiguration;
-
-        private readonly string _errorHandlerRid;
-
-        private readonly string _remoteId;
-
-        private readonly string _launchId;
-
-        public EvaluatorConfigurations(string configFile)
-        {
-            using 
(LOGGER.LogFunction("EvaluatorConfigurations::EvaluatorConfigurations"))
-            {
-                if (string.IsNullOrWhiteSpace(configFile))
-                {
-                    Utilities.Diagnostics.Exceptions.Throw(new 
ArgumentNullException("configFile"), LOGGER);
-                }
-                if (!File.Exists(configFile))
-                {
-                    Utilities.Diagnostics.Exceptions.Throw(new 
FileNotFoundException("cannot find file " + configFile), LOGGER);
-                }
-
-                AvroConfigurationSerializer serializer = new 
AvroConfigurationSerializer();
-                var classHierarchy = TangFactory.GetTang()
-                    .GetClassHierarchy(new string[] { 
typeof(ApplicationIdentifier).Assembly.GetName().Name });
-                var evaluatorConfiguration = serializer.FromFile(configFile, 
classHierarchy);
-
-                IInjector evaluatorInjector = 
TangFactory.GetTang().NewInjector(evaluatorConfiguration);
-
-                LOGGER.Log(Level.Info, 
-                    string.Format(CultureInfo.CurrentCulture, "Evaluator 
Configuration is deserialized from file {0}:", configFile));
-                try
-                {
-                    _taskConfiguration = 
evaluatorInjector.GetNamedInstance<InitialTaskConfiguration, string>();
-                }
-                catch (InjectionException)
-                {
-                    LOGGER.Log(Level.Info, "InitialTaskConfiguration is not 
set in Evaluator.config.");
-                }
-
-                try
-                {
-                    _rootContextConfiguration = 
evaluatorInjector.GetNamedInstance<RootContextConfiguration, string>();
-                }
-                catch (InjectionException)
-                {
-                    LOGGER.Log(Level.Warning, "RootContextConfiguration is not 
set in Evaluator.config.");
-                }
-
-                try
-                {
-                    _rootServiceConfiguration = 
evaluatorInjector.GetNamedInstance<RootServiceConfiguration, string>();
-                }
-                catch (InjectionException)
-                {
-                    LOGGER.Log(Level.Info, "RootServiceConfiguration is not 
set in Evaluator.config.");
-                }
-
-                _applicationId = 
evaluatorInjector.GetNamedInstance<ApplicationIdentifier, string>();
-                _remoteId = 
evaluatorInjector.GetNamedInstance<DriverRemoteIdentifier, string>();
-                _evaluatorId = 
evaluatorInjector.GetNamedInstance<EvaluatorIdentifier, string>();
-                _errorHandlerRid = 
evaluatorInjector.GetNamedInstance<ErrorHandlerRid, string>();
-                _launchId = evaluatorInjector.GetNamedInstance<LaunchId, 
string>();
-            }
-        }
-
-        public string TaskConfigurationString
-        {
-            get
-            {
-                return _taskConfiguration;
-            }
-        }
-
-        /// <summary>
-        /// The TaskConfiguration submitted with the evaluator configuration, 
if any.
-        /// </summary>
-        public Optional<TaskConfiguration> TaskConfiguration
-        {
-            get
-            {
-                var taskConfig = TaskConfigurationString;
-                return string.IsNullOrEmpty(taskConfig)
-                    ? Optional<TaskConfiguration>.Empty()
-                    : Optional<TaskConfiguration>.Of(
-                        new TaskConfiguration(taskConfig));
-            }
-        } 
-
-        public string EvaluatorId
-        {
-            get
-            {
-                return _evaluatorId;
-            }
-        }
-
-        public string ApplicationId
-        {
-            get
-            {
-                return _applicationId;
-            }
-        }
-
-        public string ErrorHandlerRid
-        {
-            get
-            {
-                return _errorHandlerRid;
-            }
-        }
-
-        public string RemoteId
-        {
-            get
-            {
-                return _remoteId;
-            }
-        }
-
-        public string LaunchId
-        {
-            get
-            {
-                return _launchId;
-            }
-        }
-
-        public string RootContextConfigurationString
-        {
-            get
-            {
-                return _rootContextConfiguration;
-            }
-        }
-
-        /// <summary>
-        /// The ContextConfiguration for the root context.
-        /// </summary>
-        /// <exception cref="ArgumentException">If the underlying string 
parameter isn't set.</exception>
-        public ContextConfiguration RootContextConfiguration
-        {
-            get
-            {
-                string rootContextConfigString = 
RootContextConfigurationString;
-                if (string.IsNullOrWhiteSpace(rootContextConfigString))
-                {
-                    Utilities.Diagnostics.Exceptions.Throw(
-                        new ArgumentException("empty or null 
rootContextConfigString"), LOGGER);
-                }
-                return new ContextConfiguration(rootContextConfigString);
-            }
-        }
-
-        public string RootServiceConfigurationString
-        {
-            get
-            {
-                return _rootServiceConfiguration;
-            }
-        }
-
-        /// <summary>
-        /// The ServiceConfiguration for the root context.
-        /// </summary>
-        /// <exception cref="ArgumentException">If the underlying string 
parameter isn't set.</exception>
-        public Optional<ServiceConfiguration> RootServiceConfiguration
-        {
-            get
-            {
-                var rootServiceConfigString = RootServiceConfigurationString;
-                return string.IsNullOrEmpty(rootServiceConfigString)
-                    ? Optional<ServiceConfiguration>.Empty()
-                    : Optional<ServiceConfiguration>.Of(
-                        new ServiceConfiguration(
-                            rootServiceConfigString));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/reef/blob/12daaba3/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs 
b/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs
index 8b2a5ab..410a1dc 100644
--- a/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs
+++ b/lang/cs/Org.Apache.REEF.Evaluator.Tests/EvaluatorConfigurationsTests.cs
@@ -23,7 +23,6 @@ using Org.Apache.REEF.Examples.HelloREEF;
 using Org.Apache.REEF.Tang.Formats;
 using Org.Apache.REEF.Tang.Implementations.Tang;
 using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tang.Types;
 using Org.Apache.REEF.Tang.Util;
 using Org.Apache.REEF.Utilities.Logging;
 using Org.Apache.REEF.Wake.Remote.Parameters;
@@ -43,33 +42,6 @@ namespace Org.Apache.REEF.Evaluator.Tests
         [Fact]
         [Trait("Priority", "0")]
         [Trait("Category", "Unit")]
-        public void TestEvaluatorConfigurations()
-        {
-            EvaluatorConfigurations evaluatorConfigurations = new 
EvaluatorConfigurations("evaluator.conf");
-
-            var eId = evaluatorConfigurations.EvaluatorId;
-            var aId = evaluatorConfigurations.ApplicationId;
-            var rId = evaluatorConfigurations.ErrorHandlerRid;
-
-            Logger.Log(Level.Info, "EvaluatorId = " + eId);
-            Logger.Log(Level.Info, "ApplicationId = " + aId);
-            Logger.Log(Level.Info, "ErrorHandlerRID = " + rId);
-
-            Assert.True(eId.StartsWith(EvaluatorIdPrefix));
-            Assert.True(aId.Equals(AppIdForTest));
-            Assert.True(rId.StartsWith(RemoteIdPrefix));
-
-            var contextConfigString = 
evaluatorConfigurations.RootContextConfigurationString;
-            var serviceConfigString = 
evaluatorConfigurations.RootServiceConfigurationString;
-            var taskConfigString = 
evaluatorConfigurations.TaskConfigurationString;
-
-            Assert.False(string.IsNullOrWhiteSpace(contextConfigString));
-            Assert.False(string.IsNullOrWhiteSpace(taskConfigString));
-        }
-
-        [Fact]
-        [Trait("Priority", "0")]
-        [Trait("Category", "Unit")]
         public void TestEvaluatorConfigurationFile()
         {
             AvroConfigurationSerializer serializer = new 
AvroConfigurationSerializer();

Reply via email to