You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by mo...@apache.org on 2017/09/08 23:01:05 UTC
reef git commit: [REEF-1873] Driver side interfaces: service set up
and failures
Repository: reef
Updated Branches:
refs/heads/master e0634a48d -> 6489d43d0
[REEF-1873] Driver side interfaces: service set up and failures
This addressed the issue by
* adding Driver interfaces for the service, subscriptions and task sets.
* adding Failures interfaces.
JIRA: [REEF-1873](https://issues.apache.org/jira/browse/REEF-1873)
Pull request:
This closes #1374
Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/6489d43d
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/6489d43d
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/6489d43d
Branch: refs/heads/master
Commit: 6489d43d00722c8406353772fccd18fbee30479d
Parents: e0634a4
Author: Matteo Interlandi <ma...@microsoft.com>
Authored: Sun Sep 3 17:27:28 2017 -0700
Committer: Sergiy Matusevych <mo...@apache.com>
Committed: Fri Sep 8 16:00:04 2017 -0700
----------------------------------------------------------------------
.../Elastic/Driver/IElasticTaskSetService.cs | 95 ++++++++++++++
.../Driver/IElasticTaskSetSubscription.cs | 94 ++++++++++++++
.../Elastic/Driver/ITaskSetManager.cs | 127 +++++++++++++++++++
.../Elastic/Failures/IFailureEvent.cs | 39 ++++++
.../Elastic/Failures/IFailureResponse.cs | 44 +++++++
.../Elastic/Failures/IFailureState.cs | 43 +++++++
.../Elastic/Failures/IFailureStateMachine.cs | 91 +++++++++++++
.../Org.Apache.REEF.Network.csproj | 7 +
8 files changed, 540 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetService.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetService.cs
new file mode 100644
index 0000000..dfd87b3
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetService.cs
@@ -0,0 +1,95 @@
+// 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.Network.Elastic.Failures;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Utilities.Attributes;
+
+namespace Org.Apache.REEF.Network.Elastic.Driver
+{
+ /// <summary>
+ /// Used to create Subscriptions for fault tolerant Task Sets.
+ /// Also manages configurations for Group Communication operators/services.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface IElasticTaskSetService : IFailureResponse
+ {
+ /// <summary>
+ /// Creates a Subscription with the default settings.
+ /// The subscription lifecicle is managed by the service.
+ /// </summary>
+ /// <returns>A new Task Set Subscription with default parameters</returns>
+ IElasticTaskSetSubscription DefaultTaskSetSubscription();
+
+ /// <summary>
+ /// Creates a new Task Set Subscription.
+ /// The subscription lifecicle is managed by the service.
+ /// </summary>
+ /// <param name="subscriptionName">The name of the subscription</param>
+ /// <param name="numTasks">The number of tasks required by the subscription</param>
+ /// <param name="failureMachine">An optional failure machine governing the subscription</param>
+ /// <returns>The new Task Set Subscrption</returns>
+ IElasticTaskSetSubscription NewTaskSetSubscription(string subscriptionName, int numTasks, IFailureStateMachine failureMachine = null);
+
+ /// <summary>
+ /// Remove a Task Set Subscription from the service.
+ /// </summary>
+ /// <param name="subscriptionName">The name of the subscription</param>
+ void RemoveTaskSetSubscription(string subscriptionName);
+
+ /// <summary>
+ /// Generate the service configuration object.
+ /// This method is used to properly configure the Context with the service.
+ /// </summary>
+ /// <returns>The Service Configuration</returns>
+ IConfiguration GetServiceConfiguration();
+
+ /// <summary>
+ /// At task submission time the following steps are executed:
+ /// 1) Each subscription the task is registered to generates a task subscription
+ /// 2) Internally each configuration generated by subscriptions contains a configuration entry for each
+ /// operator defining the subscription. Such operator configurations are serialized using
+ /// {@link Org.Apache.REEF.Network.Elastic.Driver.IElasticTaskSetService#SerializeOperatorConfiguration}
+ /// 3) Tasks subscriptions are serialized into a configuration
+ /// 4) The service Task configuration is added to the configuration object containing the serialized subscription confs
+ /// 5) the Task configuration is merged with the configuraiton object of 4) to generate the final task configuration
+ /// </summary>
+ ///
+ /// <summary>
+ /// Creates a generic Task Configuration object for the tasks registering to the service.
+ /// </summary>
+ /// <param name="subscriptionsConf">The configuration of the subscription the task will register to</param>
+ /// <returns>The configuration for the Task with added service parameters</returns>
+ IConfiguration GetTaskConfiguration(ICsConfigurationBuilder subscriptionsConf);
+
+ /// <summary>
+ /// Appends a subscription configuration to a configuration builder object.
+ /// </summary>
+ /// <param name="confBuilder">The configuration where the subscription configuration will be appended to</param>
+ /// <param name="subscriptionConf">The subscription configuration at hand</param>
+ /// <returns>The configuration containing the serialized subscription configuration</returns>
+ void SerializeSubscriptionConfiguration(ref ICsConfigurationBuilder confBuilder, IConfiguration subscriptionConf);
+
+ /// <summary>
+ /// Append an operator configuration to a configuration builder object.
+ /// </summary>
+ /// <param name="confBuilder">The configuration where the operator configuration will be appended to</param>
+ /// <param name="subscriptionConf">The operator configuration at hand</param>
+ /// <returns>The configuration containing the serialized operator configuration</returns>
+ void SerializeOperatorConfiguration(ref ICsConfigurationBuilder confBuilder, IConfiguration operatorConf);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetSubscription.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetSubscription.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetSubscription.cs
new file mode 100644
index 0000000..fbc1c48
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/IElasticTaskSetSubscription.cs
@@ -0,0 +1,94 @@
+// 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.Interface;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Network.Elastic.Failures;
+using Org.Apache.REEF.Utilities.Attributes;
+
+namespace Org.Apache.REEF.Network.Elastic.Driver
+{
+ /// <summary>
+ /// Used to group operators in logical units.
+ /// All operators in the same Subscription share similar semantics
+ /// and behaviour under failures.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface IElasticTaskSetSubscription : IFailureResponse
+ {
+ /// <summary>
+ /// The name of the Subscription.
+ /// </summary>
+ string SubscriptionName { get; }
+
+ /// <summary>
+ /// The Failure State of the target Subscription.
+ /// </summary>
+ IFailureState FailureStatus { get; }
+
+ /// <summary>
+ /// The Service managing the Subscription.
+ /// </summary>
+ IElasticTaskSetService Service { get; }
+
+ /// <summary>
+ /// Generates an id to uniquely identify operators in the Subscription.
+ /// </summary>
+ /// <returns>A new unique id</returns>
+ int GetNextOperatorId();
+
+ /// <summary>
+ /// Finalizes the Subscription.
+ /// After the Subscription has been finalized, no more operators may
+ /// be added to the group.
+ /// </summary>
+ /// <returns>The same finalized Subscription</returns>
+ IElasticTaskSetSubscription Build();
+
+ /// <summary>
+ /// Add a task to the Subscription.
+ /// The Subscription must have called Build() before adding tasks.
+ /// </summary>
+ /// <param name="taskId">The id of the task to add</param>
+ /// <returns>True if the task is added to the Subscription</returns>
+ bool AddTask(string taskId);
+
+ /// <summary>
+ /// Decides if the tasks added to the Subscription can be scheduled for execution
+ /// or not. Method used for implementing different policies for
+ /// triggering the scheduling of tasks.
+ /// </summary>
+ /// <returns>True if the added tasks can be scheduled for execution</returns>
+ bool ScheduleSubscription();
+
+ /// <summary>
+ /// Whether the input activeContext is the one of the master Task.
+ /// </summary>
+ /// <param name="activeContext">The active context for the task</param>
+ /// <returns>True if the parameter is the master task's active context</returns>
+ bool IsMasterTaskContext(IActiveContext activeContext);
+
+ /// <summary>
+ /// Creates the Configuration for the input task.
+ /// Must be called only after all tasks have been added to the Subscription.
+ /// </summary>
+ /// <param name="builder">The configuration builder the configuration will be appended to</param>
+ /// <param name="taskId">The task id of the task that belongs to this Subscription</param>
+ /// <returns>The configuration for the Task with added Subscription informations</returns>
+ void GetTaskConfiguration(ref ICsConfigurationBuilder builder, int taskId);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/ITaskSetManager.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/ITaskSetManager.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/ITaskSetManager.cs
new file mode 100644
index 0000000..4d4e806
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Driver/ITaskSetManager.cs
@@ -0,0 +1,127 @@
+// 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.Collections.Generic;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Network.Elastic.Failures;
+using Org.Apache.REEF.Utilities.Attributes;
+using System;
+
+namespace Org.Apache.REEF.Network.Elastic.Driver
+{
+ /// <summary>
+ /// Class defining how groups of tasks sharing similar scheduling semantics are managed.
+ /// TaskSets subscribe to Subscriptions in order to define tasks logic.
+ /// TaskSets schedule and manage group of tasks running in the cluster.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface ITaskSetManager : IFailureResponse, IDisposable
+ {
+ /// <summary>
+ /// An identifier for the set of Subscriptions the Task Manager is subscribed to.
+ /// The Task Set has to be built before retrieving its subscriptions id.
+ /// </summary>
+ string SubscriptionsId { get; }
+
+ /// <summary>
+ /// Subscribe the current Task Set to a new Subscription.
+ /// </summary>
+ /// <param name="subscription">The subscription to subscribe to</param>
+ void AddTaskSetSubscription(IElasticTaskSetSubscription subscription);
+
+ /// <summary>
+ /// Decides whether more contexts have to be added to this Task Manger or not.
+ /// </summary>
+ /// <returns>True if the number of added contexts is less than the available slots</returns>
+ bool HasMoreContextToAdd();
+
+ /// <summary>
+ /// Method used to generate unique context ids.
+ /// </summary>
+ /// <param name="evaluator">The evaluator the context will run on</param>
+ /// <returns>A new unique context id</returns>
+ int GetNextTaskContextId(IAllocatedEvaluator evaluator = null);
+
+ /// <summary>
+ /// Method used to generate unique task ids.
+ /// </summary>
+ /// <param name="context">The context the task will run on</param>
+ /// <returns>A new task id</returns>
+ int GetNextTaskId(IActiveContext context = null);
+
+ /// <summary>
+ /// Finalizes the Task Set.
+ /// After the Task set has been finalized, no more Subscriptions can be added.
+ /// </summary>
+ /// <returns>The same finalized Task Set</returns>
+ ITaskSetManager Build();
+
+ /// <summary>
+ /// Retrieves all Subscriptions having the context passed as a parameter
+ /// as master task context.
+ /// </summary>
+ /// <param name="context">The target context</param>
+ /// <returns>A list of Subscriptions having the master task running on context</returns>
+ IEnumerable<IElasticTaskSetSubscription> IsMasterTaskContext(IActiveContext context);
+
+ /// <summary>
+ /// Add a task to the Task Set.
+ /// The Task Set must have called Build() before adding tasks.
+ /// </summary>
+ /// <param name="taskId">The id of the task to add</param>
+ /// <param name="taskConfig">The current configuration of the task</param>
+ /// <param name="context">The context the task will run on</param>
+ void AddTask(string taskId, IConfiguration taskConfig, IActiveContext context);
+
+ /// <summary>
+ /// Actions to execute when a notification that a task is running is received.
+ /// </summary>
+ /// <param name="task">The running task</param>
+ void OnTaskRunning(IRunningTask task);
+
+ /// <summary>
+ /// Actions to execute when a notification that a task is completed is received.
+ /// </summary>
+ /// <param name="task">The completed task</param>
+ void OnTaskCompleted(ICompletedTask task);
+
+ /// <summary>
+ /// Actions to execute when a task message is received.
+ /// </summary>
+ /// <param name="task">A message from a task</param>
+ void OnTaskMessage(ITaskMessage message);
+
+ /// <summary>
+ /// This method contains the logic to trigger when the Task Set execution is completed
+ /// </summary>
+ bool Done();
+
+ /// <summary>
+ /// Used to react of a failure event occurred on an evaluator.
+ /// </summary>
+ /// <param name="evaluator">The failed evaluator</param>
+ void OnEvaluatorFailure(IFailedEvaluator evaluator);
+
+ /// <summary>
+ /// Contains the logic to trigger when the execution fails.
+ /// </summary>
+ void OnFail();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureEvent.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureEvent.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureEvent.cs
new file mode 100644
index 0000000..61cc8ba
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureEvent.cs
@@ -0,0 +1,39 @@
+// 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.Utilities.Attributes;
+using System;
+
+namespace Org.Apache.REEF.Network.Elastic.Failures
+{
+ /// <summary>
+ /// Interface wrapping an event rised by a transition to a new failure
+ /// state. The event speicifies which action have to be executed in response
+ /// to the change in the failure state.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface IFailureEvent
+ {
+ /// <summary>
+ /// The event / action rised by the transition to a new failure state.
+ /// It is assumed that the result encodes the magnituted of the action,
+ /// e.g., smaller number, less demanding action.
+ /// </summary>
+ /// <returns>A value identifing the magnitued of the event</returns>
+ int FailureEvent { get; }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureResponse.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureResponse.cs
new file mode 100644
index 0000000..b31f118
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureResponse.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.Driver.Task;
+using Org.Apache.REEF.Utilities.Attributes;
+
+namespace Org.Apache.REEF.Network.Elastic.Failures
+{
+ /// <summary>
+ /// Entry point for classes expected to be aware and act over failres.
+ /// Used to propagate failures through operators, subscriptions and the service.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface IFailureResponse
+ {
+ /// <summary>
+ /// Used to react on a failure occurred on a task.
+ /// </summary>
+ /// <param name="info">The failed task</param>
+ /// <returns>The failure state after the notification of the failed task</returns>
+ IFailureState OnTaskFailure(IFailedTask task);
+
+ /// <summary>
+ /// When a new failure state is rised, this method is used to dispatch
+ /// such event to the proper failure mitigation logic.
+ /// </summary>
+ /// <param name="event">Notification specifiying the updated failure state</param>
+ void EventDispatcher(IFailureEvent @event);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureState.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureState.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureState.cs
new file mode 100644
index 0000000..447dfaf
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureState.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.Utilities.Attributes;
+
+namespace Org.Apache.REEF.Network.Elastic.Failures
+{
+ /// <summary>
+ /// Base interface defining both the possible failure states and the current status.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface IFailureState
+ {
+ /// <summary>
+ /// The current failure state. It is assumed that bigger values mean worst
+ /// failure state.
+ /// </summary>
+ /// <returns>A value identifing the failure state</returns>
+ int FailureState { get; set; }
+
+ /// <summary>
+ /// A utility method to merge the current failure states and a new one passed as
+ /// parameter. The merging is based on user defined semantic.
+ /// </summary>
+ /// <param name="that">A new failure state</param>
+ /// <returns>The merge of the two failure states</returns>
+ IFailureState Merge(IFailureState that);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureStateMachine.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureStateMachine.cs b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureStateMachine.cs
new file mode 100644
index 0000000..e5a3b44
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Elastic/Failures/IFailureStateMachine.cs
@@ -0,0 +1,91 @@
+// 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;
+
+namespace Org.Apache.REEF.Network.Elastic.Failures
+{
+ /// <summary>
+ /// Where the decision is made on what to do when a failure happen.
+ /// A decision is made based on the ration between the initial data points
+ /// and how many data points are lost.
+ /// </summary>
+ [Unstable("0.16", "API may change")]
+ public interface IFailureStateMachine
+ {
+ /// <summary>
+ /// The Machine current failure state.
+ /// </summary>
+ IFailureState State { get; }
+
+ /// <summary>
+ /// The total number of data points the machine was initialized with.
+ /// </summary>
+ int NumOfDataPoints { get; }
+
+ /// <summary>
+ /// The current number of data points data not reachable because of failures.
+ /// </summary>
+ int NumOfFailedDataPoints { get; }
+
+ /// <summary>
+ /// Method used to set or update the current threshold connected with
+ /// a target failure state. The assumption is that higher failure states
+ /// have higher thresholds.
+ /// </summary>
+ /// <param name="level">The failure state we want to change</param>
+ /// <param name="threshold">A [0, 1] value specifying when the failure level is reached</param>
+ void SetThreashold(IFailureState level, float threshold);
+
+ /// <summary>
+ /// A utility method for setting multiple threshould at once.
+ /// </summary>
+ /// <param name="weights">Pairs of failure states with realted new threshold</param>
+ void SetThreasholds(Tuple<IFailureState, float>[] weights);
+
+ /// <summary>
+ /// Add new data point(s) to the Failure Machine.
+ /// This method can be called either at initialization, or when
+ /// new data points becomes available at runtime e.g., after a failure
+ /// is resolved.
+ /// </summary>
+ /// <param name="points">How many data point to add</param>
+ /// <returns>The failure state resulting from the addition of the data points</returns>
+ IFailureState AddDataPoints(int points);
+
+ /// <summary>
+ /// Remove data point(s) from the Failure Machine as a result of a runtime failure.
+ /// </summary>
+ /// <param name="points">How many data point to remove</param>
+ /// <returns>The failure state resulting from the removal of the data points</returns>
+ IFailureState RemoveDataPoints(int points);
+
+ /// <summary>
+ /// Finalizes the Failure Machine.
+ /// Once finalized, each newly added data point is considered as resolving a failure.
+ /// </summary>
+ /// <returns>The same finalized Failure Machine</returns>
+ IFailureStateMachine Build();
+
+ /// <summary>
+ /// Utility method used to clone the target failure machine.
+ /// Only the thresholds are cloned, while the machine state is not.
+ /// </summary>
+ /// <returns>A new failure machine with the same settings</returns>
+ IFailureStateMachine Clone();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/reef/blob/6489d43d/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj b/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
index 5faff4b..30bc685 100644
--- a/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
+++ b/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
@@ -78,6 +78,13 @@ under the License.
<Compile Include="$(SolutionDir)\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="Elastic\Driver\ITaskSetManager.cs" />
+ <Compile Include="Elastic\Driver\IElasticTaskSetSubscription.cs" />
+ <Compile Include="Elastic\Driver\IElasticTaskSetService.cs" />
+ <Compile Include="Elastic\Failures\IFailureStateMachine.cs" />
+ <Compile Include="Elastic\Failures\IFailureState.cs" />
+ <Compile Include="Elastic\Failures\IFailureEvent.cs" />
+ <Compile Include="Elastic\Failures\IFailureResponse.cs" />
<Compile Include="Group\Config\CodecToStreamingCodecConfiguration.cs" />
<Compile Include="Group\Config\StreamingCodecConfigurationMinusMessage.cs" />
<Compile Include="Group\Driver\Impl\GeneralGroupCommunicationMessage.cs" />