You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by ju...@apache.org on 2016/04/01 22:57:05 UTC
reef git commit: [REEF-1072] Add IDriverConnection as part of
evaluator configuration
Repository: reef
Updated Branches:
refs/heads/master 4ddbc29be -> 4088f3c73
[REEF-1072] Add IDriverConnection as part of evaluator configuration
This addressed the issue by
* Adds an IDriverReconnectionConfigurationProvider to replace IDriverConnection usage in DriverConfiguration.
JIRA:
[REEF-1072](https://issues.apache.org/jira/browse/REEF-1072)
This CLoses #914
Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/4088f3c7
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/4088f3c7
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/4088f3c7
Branch: refs/heads/master
Commit: 4088f3c7359cd35ba66f3a67faab744181413b3d
Parents: 4ddbc29
Author: Andrew Chung <af...@gmail.com>
Authored: Thu Mar 24 18:23:38 2016 -0700
Committer: Julia Wang <ju...@microsoft.com>
Committed: Fri Apr 1 13:40:17 2016 -0700
----------------------------------------------------------------------
.../DefaultDriverReconnConfigProvider.cs | 44 ++++++++++++++++
.../DynamicDriverReconnConfigProvider.cs | 55 ++++++++++++++++++++
.../IDriverReconnConfigProvider.cs | 31 +++++++++++
.../LocalHttpDriverReconnConfigProvider.cs | 41 +++++++++++++++
...YarnClusterHttpDriverReconnConfigProvider.cs | 41 +++++++++++++++
.../YarnOneBoxHttpDriverReconnConfigProvider.cs | 43 +++++++++++++++
.../Evaluator/IDriverConnection.cs | 2 +
.../Evaluator/MissingDriverConnection.cs | 38 ++++++++++++++
.../Org.Apache.REEF.Common.csproj | 7 +++
.../Bridge/DriverBridge.cs | 30 ++++++++++-
.../DriverConfiguration.cs | 13 +++++
.../DriverRestart.cs | 4 +-
12 files changed, 347 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DefaultDriverReconnConfigProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DefaultDriverReconnConfigProvider.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DefaultDriverReconnConfigProvider.cs
new file mode 100644
index 0000000..86babe3
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DefaultDriverReconnConfigProvider.cs
@@ -0,0 +1,44 @@
+// 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 Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders
+{
+ /// <summary>
+ /// The default driver reconnection configuration provider. Provides an empty configuration such
+ /// that <see cref="IDriverConnection"/> is bound to its default implementation,
+ /// and no conflicts are caused in TANG.
+ /// </summary>
+ internal sealed class DefaultDriverReconnConfigProvider : IDriverReconnConfigProvider
+ {
+ [Inject]
+ private DefaultDriverReconnConfigProvider()
+ {
+ }
+
+ /// <summary>
+ /// Return an empty configuration.
+ /// </summary>
+ public IConfiguration GetConfiguration()
+ {
+ return TangFactory.GetTang().NewConfigurationBuilder().Build();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DynamicDriverReconnConfigProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DynamicDriverReconnConfigProvider.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DynamicDriverReconnConfigProvider.cs
new file mode 100644
index 0000000..aa745ae
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/DynamicDriverReconnConfigProvider.cs
@@ -0,0 +1,55 @@
+// 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 Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders
+{
+ /// <summary>
+ /// A helper <see cref="IDriverReconnConfigProvider"/> that binds <see cref="IDriverConnection"/>
+ /// dynamically. This is used such that a <see cref="IDriverReconnConfigProvider"/> can
+ /// be used to provide the type of <see cref="IDriverConnection"/> to the Evaluator if the user only
+ /// binds the deprecated <see cref="IDriverConnection"/> optional implementation, instead of the
+ /// new <see cref="IDriverReconnConfigProvider"/> implementation.
+ /// TODO[JIRA REEF-1306]: Remove.
+ /// </summary>
+ internal sealed class DynamicDriverReconnConfigProvider : IDriverReconnConfigProvider
+ {
+ private readonly Type _driverReconnectionType;
+
+ internal DynamicDriverReconnConfigProvider(Type type)
+ {
+ _driverReconnectionType = type;
+ if (!typeof(IDriverConnection).IsAssignableFrom(type))
+ {
+ throw new ArgumentException("The type must be a subclass of IDriverConnection.");
+ }
+ }
+
+ /// <summary>
+ /// A configuration where the type of <see cref="IDriverConnection"/> is bound dynamically.
+ /// </summary>
+ public IConfiguration GetConfiguration()
+ {
+ return TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation(typeof(IDriverConnection), _driverReconnectionType)
+ .Build();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/IDriverReconnConfigProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/IDriverReconnConfigProvider.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/IDriverReconnConfigProvider.cs
new file mode 100644
index 0000000..4e09ebf
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/IDriverReconnConfigProvider.cs
@@ -0,0 +1,31 @@
+// 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 Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders
+{
+ /// <summary>
+ /// A configuration provider for the Evaluator to create the appropriate reconnection
+ /// object to reconnect to the Driver based on the environment.
+ /// </summary>
+ [DefaultImplementation(typeof(DefaultDriverReconnConfigProvider))]
+ public interface IDriverReconnConfigProvider : IConfigurationProvider
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/LocalHttpDriverReconnConfigProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/LocalHttpDriverReconnConfigProvider.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/LocalHttpDriverReconnConfigProvider.cs
new file mode 100644
index 0000000..ee16b1b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/LocalHttpDriverReconnConfigProvider.cs
@@ -0,0 +1,41 @@
+// 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 Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders
+{
+ /// <summary>
+ /// A driver reconnection configuration provider for the Local Driver based on HTTP connection.
+ /// </summary>
+ public sealed class LocalHttpDriverReconnConfigProvider : IDriverReconnConfigProvider
+ {
+ [Inject]
+ private LocalHttpDriverReconnConfigProvider()
+ {
+ }
+
+ public IConfiguration GetConfiguration()
+ {
+ return TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation<IDriverConnection, DefaultLocalHttpDriverConnection>()
+ .Build();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnClusterHttpDriverReconnConfigProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnClusterHttpDriverReconnConfigProvider.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnClusterHttpDriverReconnConfigProvider.cs
new file mode 100644
index 0000000..bfdae18
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnClusterHttpDriverReconnConfigProvider.cs
@@ -0,0 +1,41 @@
+// 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 Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders
+{
+ /// <summary>
+ /// A driver reconnection configuration provider for the YARN Driver based on HTTP connection.
+ /// </summary>
+ public sealed class YarnClusterHttpDriverReconnConfigProvider : IDriverReconnConfigProvider
+ {
+ [Inject]
+ private YarnClusterHttpDriverReconnConfigProvider()
+ {
+ }
+
+ public IConfiguration GetConfiguration()
+ {
+ return TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation<IDriverConnection, DefaultYarnClusterHttpDriverConnection>()
+ .Build();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnOneBoxHttpDriverReconnConfigProvider.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnOneBoxHttpDriverReconnConfigProvider.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnOneBoxHttpDriverReconnConfigProvider.cs
new file mode 100644
index 0000000..b88fd0e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/DriverConnectionConfigurationProviders/YarnOneBoxHttpDriverReconnConfigProvider.cs
@@ -0,0 +1,43 @@
+// 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 Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders
+{
+ /// <summary>
+ /// A driver reconnection configuration provider for the YARN OneBox Driver based on HTTP connection.
+ /// </summary>
+ public sealed class YarnOneBoxHttpDriverReconnConfigProvider : IDriverReconnConfigProvider
+ {
+ [Inject]
+ private YarnOneBoxHttpDriverReconnConfigProvider()
+ {
+ }
+
+ public IConfiguration GetConfiguration()
+ {
+ return
+ TangFactory.GetTang()
+ .NewConfigurationBuilder()
+ .BindImplementation<IDriverConnection, DefaultYarnOneBoxHttpDriverConnection>()
+ .Build();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/IDriverConnection.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/IDriverConnection.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/IDriverConnection.cs
index b46ea87..ade9621 100644
--- a/lang/cs/Org.Apache.REEF.Common/Evaluator/IDriverConnection.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/IDriverConnection.cs
@@ -15,10 +15,12 @@
// specific language governing permissions and limitations
// under the License.
+using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Utilities.Attributes;
namespace Org.Apache.REEF.Common.Evaluator
{
+ [DefaultImplementation(typeof(MissingDriverConnection))]
public interface IDriverConnection
{
[Private]
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Common/Evaluator/MissingDriverConnection.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Evaluator/MissingDriverConnection.cs b/lang/cs/Org.Apache.REEF.Common/Evaluator/MissingDriverConnection.cs
new file mode 100644
index 0000000..ffeacf9
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Common/Evaluator/MissingDriverConnection.cs
@@ -0,0 +1,38 @@
+// 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 Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Common.Evaluator
+{
+ /// <summary>
+ /// The default <see cref="IDriverConnection"/> that throws an Exception.
+ /// </summary>
+ internal sealed class MissingDriverConnection : IDriverConnection
+ {
+ [Inject]
+ private MissingDriverConnection()
+ {
+ }
+
+ public DriverInformation GetDriverInformation()
+ {
+ throw new NotImplementedException("IDriverConnection has not been bound, so cannot reconnect to Driver!");
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/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 307c558..b897f89 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
@@ -87,15 +87,22 @@ under the License.
<Compile Include="Context\IContextMessage.cs" />
<Compile Include="Context\IContextMessageHandler.cs" />
<Compile Include="Context\IContextMessageSource.cs" />
+ <Compile Include="Evaluator\DriverConnectionConfigurationProviders\DefaultDriverReconnConfigProvider.cs" />
<Compile Include="Evaluator\DefaultLocalHttpDriverConnection.cs" />
<Compile Include="Evaluator\DefaultYarnClusterHttpDriverConnection.cs" />
<Compile Include="Evaluator\DefaultYarnOneBoxHttpDriverConnection.cs" />
+ <Compile Include="Evaluator\DriverConnectionConfigurationProviders\DynamicDriverReconnConfigProvider.cs" />
+ <Compile Include="Evaluator\DriverConnectionConfigurationProviders\LocalHttpDriverReconnConfigProvider.cs" />
+ <Compile Include="Evaluator\DriverConnectionConfigurationProviders\YarnOneBoxHttpDriverReconnConfigProvider.cs" />
<Compile Include="Evaluator\DriverInformation.cs" />
<Compile Include="Evaluator\EvaluatorOperationState.cs" />
<Compile Include="Evaluator\EvaluatorRuntimeState.cs" />
<Compile Include="Evaluator\EvaluatorType.cs" />
<Compile Include="Evaluator\IDriverConnection.cs" />
+ <Compile Include="Evaluator\DriverConnectionConfigurationProviders\IDriverReconnConfigProvider.cs" />
+ <Compile Include="Evaluator\MissingDriverConnection.cs" />
<Compile Include="Evaluator\Parameters\EvaluatorConfigurationProviders.cs" />
+ <Compile Include="Evaluator\DriverConnectionConfigurationProviders\YarnClusterHttpDriverReconnConfigProvider.cs" />
<Compile Include="Events\IContextStart.cs" />
<Compile Include="Events\IContextStop.cs" />
<Compile Include="Exceptions\JobException.cs" />
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Driver/Bridge/DriverBridge.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/DriverBridge.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/DriverBridge.cs
index 64c32cf..baa8eb8 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Bridge/DriverBridge.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/DriverBridge.cs
@@ -20,6 +20,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using Org.Apache.REEF.Common.Context;
+using Org.Apache.REEF.Common.Evaluator;
+using Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders;
using Org.Apache.REEF.Driver.Context;
using Org.Apache.REEF.Driver.Evaluator;
using Org.Apache.REEF.Driver.Task;
@@ -30,6 +32,8 @@ using Org.Apache.REEF.Common.Evaluator.Parameters;
using Org.Apache.REEF.Driver.Bridge.Clr2java;
using Org.Apache.REEF.Driver.Bridge.Events;
using Org.Apache.REEF.Driver.Defaults;
+using Org.Apache.REEF.Tang.Implementations.InjectionPlan;
+using Org.Apache.REEF.Tang.Implementations.Tang;
namespace Org.Apache.REEF.Driver.Bridge
{
@@ -141,6 +145,7 @@ namespace Org.Apache.REEF.Driver.Bridge
[Parameter(Value = typeof(DriverBridgeConfigurationOptions.TraceListenersSet))] ISet<TraceListener> traceListeners,
[Parameter(Value = typeof(EvaluatorConfigurationProviders))] ISet<IConfigurationProvider> configurationProviders,
[Parameter(Value = typeof(DriverBridgeConfigurationOptions.TraceLevel))] string traceLevel,
+ IDriverReconnConfigProvider driverReconnConfigProvider,
HttpServerHandler httpServerHandler,
IProgressProvider progressProvider)
{
@@ -181,7 +186,13 @@ namespace Org.Apache.REEF.Driver.Bridge
_driverRestartCompletedHandlers = driverRestartCompletedHandlers;
_driverRestartFailedEvaluatorHandlers = driverRestartFailedEvaluatorHandlers;
_httpServerHandler = httpServerHandler;
- _configurationProviders = configurationProviders;
+
+ // TODO[JIRA REEF-1306]: Remove after it is bound directly into EvaluatorConfigurationProviders.
+ _configurationProviders = new HashSet<IConfigurationProvider>(configurationProviders)
+ {
+ GetDriverReconnectionProvider(driverReconnConfigProvider)
+ };
+
_progressProvider = progressProvider;
_allocatedEvaluatorSubscriber = new ClrSystemHandler<IAllocatedEvaluator>();
@@ -204,6 +215,23 @@ namespace Org.Apache.REEF.Driver.Bridge
_driverRestartFailedEvaluatorSubscriber = new ClrSystemHandler<IFailedEvaluator>();
}
+ private static IDriverReconnConfigProvider GetDriverReconnectionProvider(
+ IDriverReconnConfigProvider driverReconnConfigProvider)
+ {
+ // If not the default, this means that the user has bound the newer configuration. Return it.
+ if (!(driverReconnConfigProvider is DefaultDriverReconnConfigProvider))
+ {
+ return driverReconnConfigProvider;
+ }
+
+ // This is done as a stop gap for deprecation because we cannot bind an implementation
+ // of IDriverConnection to the driver CLRBridgeConfiguration if it is already bound
+ // by the user, since the driver configuration and Evaluator configuration will be combined
+ // at the Evaluator. We thus need to return the DriverReconnectionConfigurationProvider
+ // that does not bind IDriverConnection such that a TANG conflict does not occur.
+ return TangFactory.GetTang().NewInjector().GetInstance<DefaultDriverReconnConfigProvider>();
+ }
+
public BridgeHandlerManager Subscribe()
{
var bridgeHandlerManager = new BridgeHandlerManager();
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Driver/DriverConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/DriverConfiguration.cs b/lang/cs/Org.Apache.REEF.Driver/DriverConfiguration.cs
index 1827cbf..42254db 100644
--- a/lang/cs/Org.Apache.REEF.Driver/DriverConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/DriverConfiguration.cs
@@ -19,6 +19,8 @@ using System;
using System.Diagnostics;
using Org.Apache.REEF.Common.Context;
using Org.Apache.REEF.Common.Evaluator;
+using Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders;
+using Org.Apache.REEF.Common.Evaluator.Parameters;
using Org.Apache.REEF.Driver.Bridge;
using Org.Apache.REEF.Driver.Context;
using Org.Apache.REEF.Driver.Evaluator;
@@ -170,10 +172,18 @@ namespace Org.Apache.REEF.Driver
/// <summary>
/// The implemenation for (attempting to) re-establish connection to driver
+ /// TODO[JIRA REEF-1306]: Remove.
/// </summary>
+ [Obsolete("Deprecated in 0.15, will be removed. Please use DriverReconnectionConfigurationProvider instead.")]
public static readonly OptionalImpl<IDriverConnection> OnDriverReconnect = new OptionalImpl<IDriverConnection>();
/// <summary>
+ /// The configuration provider for driver reconnection.
+ /// </summary>
+ public static readonly OptionalImpl<IDriverReconnConfigProvider> DriverReconnectionConfigurationProvider =
+ new OptionalImpl<IDriverReconnConfigProvider>();
+
+ /// <summary>
/// Evaluator recovery timeout for driver restart in seconds. If value is greater than 0, restart is enabled. The default value is -1.
/// </summary>
public static readonly OptionalParameter<int> DriverRestartEvaluatorRecoverySeconds = new OptionalParameter<int>();
@@ -230,6 +240,9 @@ namespace Org.Apache.REEF.Driver
.BindNamedParameter(GenericType<DriverBridgeConfigurationOptions.TraceLevel>.Class, CustomTraceLevel)
.BindNamedParameter(GenericType<DriverBridgeConfigurationOptions.DriverRestartEvaluatorRecoverySeconds>.Class,
DriverRestartEvaluatorRecoverySeconds)
+
+ // TODO[JIRA REEF-1306]: Bind DriverReconnectionConfigurationProvider into EvaluatorConfigurationProviders.
+ .BindImplementation(GenericType<IDriverReconnConfigProvider>.Class, DriverReconnectionConfigurationProvider)
.BindImplementation(GenericType<IProgressProvider>.Class, ProgressProvider)
.Build();
}
http://git-wip-us.apache.org/repos/asf/reef/blob/4088f3c7/lang/cs/Org.Apache.REEF.Examples.DriverRestart/DriverRestart.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.DriverRestart/DriverRestart.cs b/lang/cs/Org.Apache.REEF.Examples.DriverRestart/DriverRestart.cs
index 7b0bdb6..fb27128 100644
--- a/lang/cs/Org.Apache.REEF.Examples.DriverRestart/DriverRestart.cs
+++ b/lang/cs/Org.Apache.REEF.Examples.DriverRestart/DriverRestart.cs
@@ -19,6 +19,7 @@ using System;
using Org.Apache.REEF.Client.API;
using Org.Apache.REEF.Client.Yarn;
using Org.Apache.REEF.Common.Evaluator;
+using Org.Apache.REEF.Common.Evaluator.DriverConnectionConfigurationProviders;
using Org.Apache.REEF.Driver;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations.Tang;
@@ -62,7 +63,8 @@ namespace Org.Apache.REEF.Examples.DriverRestart
.Set(DriverConfiguration.OnEvaluatorAllocated, GenericType<HelloRestartDriver>.Class)
.Set(DriverConfiguration.OnEvaluatorFailed, GenericType<HelloRestartDriver>.Class)
.Set(DriverConfiguration.OnDriverRestartEvaluatorFailed, GenericType<HelloRestartDriver>.Class)
- .Set(DriverConfiguration.OnDriverReconnect, GenericType<DefaultYarnClusterHttpDriverConnection>.Class)
+ .Set(DriverConfiguration.DriverReconnectionConfigurationProvider,
+ GenericType<YarnClusterHttpDriverReconnConfigProvider>.Class)
.Set(DriverConfiguration.DriverRestartEvaluatorRecoverySeconds, (5 * 60).ToString())
.Build();