http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ActiveContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ActiveContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ActiveContext.cs deleted file mode 100644 index fd7f826..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ActiveContext.cs +++ /dev/null @@ -1,117 +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 Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Formats; -using Org.Apache.Reef.Tang.Interface; -using System; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class ActiveContext : IActiveContext - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(ActiveContext)); - - private readonly AvroConfigurationSerializer _serializer; - - public ActiveContext(IActiveContextClr2Java clr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - Clr2Java = clr2Java; - _serializer = new AvroConfigurationSerializer(); - } - - [DataMember] - public string InstanceId { get; set; } - - public string Id - { - get - { - return Clr2Java.GetId(); - } - - set - { - } - } - - public string EvaluatorId - { - get - { - return Clr2Java.GetEvaluatorId(); - } - - set - { - } - } - - public Optional<string> ParentId { get; set; } - - public IEvaluatorDescriptor EvaluatorDescriptor - { - get - { - return Clr2Java.GetEvaluatorDescriptor(); - } - - set - { - } - } - - private IActiveContextClr2Java Clr2Java { get; set; } - - public void SubmitTask(IConfiguration taskConfiguration) - { - LOGGER.Log(Level.Info, "ActiveContext::SubmitTask"); - string task = _serializer.ToString(taskConfiguration); - LOGGER.Log(Level.Info, "serialized taskConfiguration: " + task); - Clr2Java.SubmitTask(task); - } - - public void Dispose() - { - LOGGER.Log(Level.Info, "ActiveContext::Dispose"); - Clr2Java.Close(); - } - - public void SubmitContext(IConfiguration contextConfiguration) - { - throw new NotImplementedException(); - } - - public void SubmitContextAndService(IConfiguration contextConfiguration, IConfiguration serviceConfiguration) - { - throw new NotImplementedException(); - } - - public void SendMessage(byte[] message) - { - throw new NotImplementedException(); - } - } -}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/AllocatedEvaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/AllocatedEvaluator.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/AllocatedEvaluator.cs deleted file mode 100644 index 8ef9928..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/AllocatedEvaluator.cs +++ /dev/null @@ -1,175 +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 Org.Apache.Reef.Common.Catalog; -using Org.Apache.Reef.Common.Evaluator; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Formats; -using Org.Apache.Reef.Tang.Interface; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Net; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class AllocatedEvaluator : IAllocatedEvaluator - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(AllocatedEvaluator)); - - private readonly AvroConfigurationSerializer _serializer; - - private IEvaluatorDescriptor _evaluatorDescriptor; - - public AllocatedEvaluator(IAllocatedEvaluaotrClr2Java clr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - _serializer = new AvroConfigurationSerializer(); - Clr2Java = clr2Java; - Id = Clr2Java.GetId(); - ProcessNewEvaluator(); - - NameServerInfo = Clr2Java.GetNameServerInfo(); - } - - [DataMember] - public string InstanceId { get; set; } - - public string Id { get; set; } - - public string EvaluatorBatchId { get; set; } - - public EvaluatorType Type { get; set; } - - public string NameServerInfo { get; set; } - - [DataMember] - private IAllocatedEvaluaotrClr2Java Clr2Java { get; set; } - - public void SubmitContext(IConfiguration contextConfiguration) - { - LOGGER.Log(Level.Info, "AllocatedEvaluator::SubmitContext"); - string context = _serializer.ToString(contextConfiguration); - LOGGER.Log(Level.Info, "serialized contextConfiguration: " + context); - Clr2Java.SubmitContext(context); - } - - public void SubmitContextAndTask(IConfiguration contextConfiguration, IConfiguration taskConfiguration) - { - LOGGER.Log(Level.Info, "AllocatedEvaluator::SubmitContextAndTask"); - - string context = _serializer.ToString(contextConfiguration); - string task = _serializer.ToString(taskConfiguration); - - LOGGER.Log(Level.Info, "serialized contextConfiguration: " + context); - LOGGER.Log(Level.Info, "serialized taskConfiguration: " + task); - - Clr2Java.SubmitContextAndTask(context, task); - } - - public void SubmitContextAndService(IConfiguration contextConfiguration, IConfiguration serviceConfiguration) - { - LOGGER.Log(Level.Info, "AllocatedEvaluator::SubmitContextAndService"); - - string context = _serializer.ToString(contextConfiguration); - string service = _serializer.ToString(serviceConfiguration); - - LOGGER.Log(Level.Info, "serialized contextConfiguration: " + context); - LOGGER.Log(Level.Info, "serialized serviceConfiguration: " + service); - - Clr2Java.SubmitContextAndService(context, service); - } - - public void SubmitContextAndServiceAndTask(IConfiguration contextConfiguration, IConfiguration serviceConfiguration, IConfiguration taskConfiguration) - { - LOGGER.Log(Level.Info, "AllocatedEvaluator::SubmitContextAndServiceAndTask"); - - string context = _serializer.ToString(contextConfiguration); - string service = _serializer.ToString(serviceConfiguration); - string task = _serializer.ToString(taskConfiguration); - - LOGGER.Log(Level.Info, "serialized contextConfiguration: " + context); - LOGGER.Log(Level.Info, "serialized serviceConfiguration: " + service); - LOGGER.Log(Level.Info, "serialized taskConfiguration: " + task); - - Clr2Java.SubmitContextAndServiceAndTask(context, service, task); - } - - public IEvaluatorDescriptor GetEvaluatorDescriptor() - { - return _evaluatorDescriptor; - } - - public void Dispose() - { - Clr2Java.Close(); - } - - public INodeDescriptor GetNodeDescriptor() - { - throw new NotImplementedException(); - } - - public void AddFile(string file) - { - throw new NotImplementedException(); - } - - public void AddLibrary(string file) - { - throw new NotImplementedException(); - } - - public void AddFileResource(string file) - { - throw new NotImplementedException(); - } - - private void ProcessNewEvaluator() - { - _evaluatorDescriptor = Clr2Java.GetEvaluatorDescriptor(); - lock (EvaluatorRequestor.Evaluators) - { - foreach (KeyValuePair<string, IEvaluatorDescriptor> pair in EvaluatorRequestor.Evaluators) - { - if (pair.Value.Equals(_evaluatorDescriptor)) - { - string key = pair.Key; - EvaluatorRequestor.Evaluators.Remove(key); - string assignedId = key.Substring(0, key.LastIndexOf('_')); - string message = string.Format( - CultureInfo.InvariantCulture, - "Received evalautor [{0}] of memory {1}MB that matches request of {2}MB with batch id [{3}].", - Id, - _evaluatorDescriptor.Memory, - pair.Value.Memory, - assignedId); - - LOGGER.Log(Level.Verbose, message); - EvaluatorBatchId = assignedId; - break; - } - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ClosedContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ClosedContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ClosedContext.cs deleted file mode 100644 index a643578..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ClosedContext.cs +++ /dev/null @@ -1,98 +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 Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities; -using System; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - public class ClosedContext : IClosedContext - { - private string _id; - - private string _evaluatorId; - - public ClosedContext(IClosedContextClr2Java clr2java) - { - InstanceId = Guid.NewGuid().ToString("N"); - _id = clr2java.GetId(); - _evaluatorId = clr2java.GetEvaluatorId(); - } - - [DataMember] - public string InstanceId { get; set; } - - public string Id - { - get - { - return _id; - } - - set - { - } - } - - public string EvaluatorId - { - get - { - return _evaluatorId; - } - - set - { - } - } - - public Optional<string> ParentId { get; set; } - - public IEvaluatorDescriptor EvaluatorDescriptor - { - get - { - return ClosedContextClr2JavaClr2Java.GetEvaluatorDescriptor(); - } - - set - { - } - } - - public IActiveContext ParentContext - { - get - { - return new ActiveContext(ParentContextClr2Java); - } - - set - { - } - } - - private IActiveContextClr2Java ParentContextClr2Java { get; set; } - - private IClosedContextClr2Java ClosedContextClr2JavaClr2Java { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedEvaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedEvaluator.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedEvaluator.cs deleted file mode 100644 index 0815ee1..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedEvaluator.cs +++ /dev/null @@ -1,60 +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 Org.Apache.Reef.Driver.Evaluator; -using System; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class CompletedEvaluator : ICompletedEvaluator - { - private string _instanceId; - - public CompletedEvaluator(ICompletedEvaluatorClr2Java clr2Java) - { - _instanceId = Guid.NewGuid().ToString("N"); - CompletedEvaluatorClr2Java = clr2Java; - } - - [DataMember] - public string InstanceId - { - get { return _instanceId; } - set { _instanceId = value; } - } - - [DataMember] - public string Id - { - get - { - return CompletedEvaluatorClr2Java.GetId(); - } - - set - { - } - } - - [DataMember] - public ICompletedEvaluatorClr2Java CompletedEvaluatorClr2Java { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedTask.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedTask.cs deleted file mode 100644 index 30799db..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/CompletedTask.cs +++ /dev/null @@ -1,75 +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 Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Task; -using Org.Apache.Reef.Utilities.Logging; -using System; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class CompletedTask : ICompletedTask - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(CompletedTask)); - - internal CompletedTask(ICompletedTaskClr2Java completedTaskClr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - CompletedTaskClr2Java = completedTaskClr2Java; - ActiveContextClr2Java = completedTaskClr2Java.GetActiveContext(); - } - - [DataMember] - public string InstanceId { get; set; } - - public byte[] Message { get; set; } - - public string Id - { - get - { - return CompletedTaskClr2Java.GetId(); - } - - set - { - } - } - - public IActiveContext ActiveContext - { - get - { - return new ActiveContext(ActiveContextClr2Java); - } - - set - { - } - } - - [DataMember] - private ICompletedTaskClr2Java CompletedTaskClr2Java { get; set; } - - [DataMember] - private IActiveContextClr2Java ActiveContextClr2Java { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ContextMessage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ContextMessage.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ContextMessage.cs deleted file mode 100644 index 890cc77..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/ContextMessage.cs +++ /dev/null @@ -1,53 +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 Org.Apache.Reef.Common.Context; - -namespace Org.Apache.Reef.Driver.Bridge -{ - public class ContextMessage : IContextMessage - { - private readonly string _messageSourcId; - private readonly byte[] _bytes; - private readonly string _id; - - public ContextMessage(IContextMessageClr2Java clr2Java) - { - _messageSourcId = clr2Java.GetMessageSourceId(); - _bytes = clr2Java.Get(); - _id = clr2Java.GetId(); - } - - public string Id - { - get { return _id; } - set { } - } - - public string MessageSourceId - { - get { return _messageSourcId; } - } - - public byte[] Message - { - get { return _bytes; } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/EvaluatorRequstor.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/EvaluatorRequstor.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/EvaluatorRequstor.cs deleted file mode 100644 index 3f7da32..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/EvaluatorRequstor.cs +++ /dev/null @@ -1,95 +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 Org.Apache.Reef.Common.Catalog; -using Org.Apache.Reef.Common.Evaluator; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class EvaluatorRequestor : IEvaluatorRequestor - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(EvaluatorRequestor)); - - private static Dictionary<string, IEvaluatorDescriptor> _evaluators; - - public EvaluatorRequestor(IEvaluatorRequestorClr2Java clr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - Clr2Java = clr2Java; - } - - public static Dictionary<string, IEvaluatorDescriptor> Evaluators - { - get - { - if (_evaluators == null) - { - _evaluators = new Dictionary<string, IEvaluatorDescriptor>(); - } - return _evaluators; - } - } - - public IResourceCatalog ResourceCatalog { get; set; } - - [DataMember] - public string InstanceId { get; set; } - - [DataMember] - private IEvaluatorRequestorClr2Java Clr2Java { get; set; } - - public void Submit(IEvaluatorRequest request) - { - LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Submitting request for {0} evaluators and {1} MB memory and {2} core to rack {3}.", request.Number, request.MemoryMegaBytes, request.VirtualCore, request.Rack)); - - lock (Evaluators) - { - for (int i = 0; i < request.Number; i++) - { - EvaluatorDescriptorImpl descriptor = new EvaluatorDescriptorImpl(new NodeDescriptorImpl(), EvaluatorType.CLR, request.MemoryMegaBytes, request.VirtualCore); - descriptor.Rack = request.Rack; - string key = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", request.EvaluatorBatchId, i); - try - { - _evaluators.Add(key, descriptor); - } - catch (ArgumentException e) - { - Exceptions.Caught(e, Level.Error, string.Format(CultureInfo.InvariantCulture, "EvaluatorBatchId [{0}] already exists.", key), LOGGER); - Exceptions.Throw(new InvalidOperationException("Cannot use evaluator id " + key, e), LOGGER); - } - } - } - - Clr2Java.Submit(request); - } - - public void Dispose() - { - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedContext.cs deleted file mode 100644 index 8f0a8e3..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedContext.cs +++ /dev/null @@ -1,110 +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 Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities; - -namespace Org.Apache.Reef.Driver.Bridge -{ - public class FailedContext : IFailedContext - { - private string _id; - - private string _evaluatorId; - - private string _parentId; - - public FailedContext(IFailedContextClr2Java clr2Java) - { - _id = clr2Java.GetId(); - _evaluatorId = clr2Java.GetEvaluatorId(); - _parentId = clr2Java.GetParentId(); - FailedContextClr2Java = clr2Java; - } - - public string Id - { - get - { - return _id; - } - - set - { - } - } - - public string EvaluatorId - { - get - { - return _evaluatorId; - } - - set - { - } - } - - public Optional<string> ParentId - { - get - { - return string.IsNullOrEmpty(_parentId) ? - Optional<string>.Empty() : - Optional<string>.Of(_parentId); - } - - set - { - } - } - - public IEvaluatorDescriptor EvaluatorDescriptor - { - get - { - return FailedContextClr2Java.GetEvaluatorDescriptor(); - } - - set - { - } - } - - public Optional<IActiveContext> ParentContext - { - get - { - IActiveContextClr2Java context = FailedContextClr2Java.GetParentContext(); - if (context != null) - { - return Optional<IActiveContext>.Of(new ActiveContext(context)); - } - else - { - return Optional<IActiveContext>.Empty(); - } - } - } - - private IFailedContextClr2Java FailedContextClr2Java { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedEvaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedEvaluator.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedEvaluator.cs deleted file mode 100644 index 8c12dee..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedEvaluator.cs +++ /dev/null @@ -1,72 +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 Org.Apache.Reef.Common.Exceptions; -using Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Driver.Task; -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class FailedEvaluator : IFailedEvaluator - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(FailedEvaluator)); - - public FailedEvaluator(IFailedEvaluatorClr2Java clr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - FailedEvaluatorClr2Java = clr2Java; - EvaluatorRequestorClr2Java = FailedEvaluatorClr2Java.GetEvaluatorRequestor(); - Id = FailedEvaluatorClr2Java.GetId(); - } - - [DataMember] - public string InstanceId { get; set; } - - public string Id { get; set; } - - public EvaluatorException EvaluatorException { get; set; } - - public List<FailedContext> FailedContexts { get; set; } - - public Optional<IFailedTask> FailedTask { get; set; } - - [DataMember] - private IFailedEvaluatorClr2Java FailedEvaluatorClr2Java { get; set; } - - [DataMember] - private IEvaluatorRequestorClr2Java EvaluatorRequestorClr2Java { get; set; } - - public IEvaluatorRequestor GetEvaluatorRequetor() - { - if (EvaluatorRequestorClr2Java == null) - { - Exceptions.Throw(new InvalidOperationException("EvaluatorRequestorClr2Java not initialized."), LOGGER); - } - return new EvaluatorRequestor(EvaluatorRequestorClr2Java); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedTask.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedTask.cs deleted file mode 100644 index 5b34349..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/FailedTask.cs +++ /dev/null @@ -1,140 +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 Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Task; -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - public class FailedTask : IFailedTask - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(FailedTask)); - - public FailedTask(IFailedTaskClr2Java failedTaskClr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - Parse(failedTaskClr2Java); - FailedTaskClr2Java = failedTaskClr2Java; - ActiveContextClr2Java = failedTaskClr2Java.GetActiveContext(); - } - - public Optional<string> Reason { get; set; } - - [DataMember] - public string InstanceId { get; set; } - - public string Id { get; set; } - - public string Message { get; set; } - - public Optional<string> Description { get; set; } - - public Optional<Exception> Cause { get; set; } - - public Optional<byte[]> Data { get; set; } - - [DataMember] - private IFailedTaskClr2Java FailedTaskClr2Java { get; set; } - - [DataMember] - private IActiveContextClr2Java ActiveContextClr2Java { get; set; } - - /// <summary> - /// Access the context the task ran (and crashed) on, if it could be recovered. - /// An ActiveContext is given when the task fails but the context remains alive. - /// On context failure, the context also fails and is surfaced via the FailedContext event. - /// Note that receiving an ActiveContext here is no guarantee that the context (and evaluator) - /// are in a consistent state. Application developers need to investigate the reason available - /// via getCause() to make that call. - /// return the context the Task ran on. - /// </summary> - public Optional<IActiveContext> GetActiveContext() - { - IActiveContext activeContext = new ActiveContext(ActiveContextClr2Java); - return ActiveContextClr2Java == null ? Optional<IActiveContext>.Empty() : Optional<IActiveContext>.Of(activeContext); - } - - public Exception AsError() - { - throw new NotImplementedException(); - } - - private void Parse(IFailedTaskClr2Java failedTaskClr2Java) - { - string serializedInfo = failedTaskClr2Java.GetString(); - LOGGER.Log(Level.Verbose, "serialized failed task: " + serializedInfo); - Dictionary<string, string> settings = new Dictionary<string, string>(); - string[] components = serializedInfo.Split(','); - foreach (string component in components) - { - string[] pair = component.Trim().Split('='); - if (pair == null || pair.Length != 2) - { - Exceptions.Throw(new ArgumentException("invalid component to be used as key-value pair:", component), LOGGER); - } - settings.Add(pair[0], pair[1]); - } - - string id; - if (!settings.TryGetValue("Identifier", out id)) - { - Exceptions.Throw(new ArgumentException("cannot find Identifier entry."), LOGGER); - } - Id = id; - - string msg; - if (!settings.TryGetValue("Message", out msg)) - { - LOGGER.Log(Level.Verbose, "no Message in Failed Task."); - msg = string.Empty; - } - Message = msg; - - string description; - if (!settings.TryGetValue("Description", out description)) - { - LOGGER.Log(Level.Verbose, "no Description in Failed Task."); - description = string.Empty; - } - Description = string.IsNullOrWhiteSpace(description) ? Optional<string>.Empty() : Optional<string>.Of(description); - - string cause; - if (!settings.TryGetValue("Cause", out cause)) - { - LOGGER.Log(Level.Verbose, "no Cause in Failed Task."); - cause = string.Empty; - } - Reason = string.IsNullOrWhiteSpace(cause) ? Optional<string>.Empty() : Optional<string>.Of(cause); - - string rawData; - if (!settings.TryGetValue("Data", out rawData)) - { - LOGGER.Log(Level.Verbose, "no Data in Failed Task."); - rawData = string.Empty; - } - Data = string.IsNullOrWhiteSpace(rawData) ? Optional<byte[]>.Empty() : Optional<byte[]>.Of(ByteUtilities.StringToByteArrays(rawData)); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/RunningTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/RunningTask.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/RunningTask.cs deleted file mode 100644 index a9efa29..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/RunningTask.cs +++ /dev/null @@ -1,97 +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 Org.Apache.Reef.Driver.Task; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Driver.Bridge -{ - public class RunningTask : IRunningTask - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(RunningTask)); - private IRunningTaskClr2Java _runningTaskClr2Java; - private IActiveContextClr2Java _activeContextClr2Java; - - public RunningTask(IRunningTaskClr2Java runningTaskClr2Java) - { - using (LOGGER.LogFunction("RunningTask::RunningTask")) - { - _runningTaskClr2Java = runningTaskClr2Java; - _activeContextClr2Java = runningTaskClr2Java.GetActiveContext(); - } - } - - public Context.IActiveContext ActiveContext - { - get - { - return new ActiveContext(_activeContextClr2Java); - } - - set - { - ActiveContext = value; - } - } - - public string Id - { - get - { - return _runningTaskClr2Java.GetId(); - } - - set - { - Id = value; - } - } - - public void Send(byte[] message) - { - _runningTaskClr2Java.Send(message); - } - - public void OnNext(byte[] message) - { - throw new NotImplementedException(); - } - - public void Suspend(byte[] message) - { - throw new NotImplementedException(); - } - - public void Suspend() - { - throw new NotImplementedException(); - } - - public void Dispose(byte[] message) - { - throw new NotImplementedException(); - } - - public void Dispose() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/SuspendedTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/SuspendedTask.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/SuspendedTask.cs deleted file mode 100644 index 33f7b8f..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/SuspendedTask.cs +++ /dev/null @@ -1,81 +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 Org.Apache.Reef.Driver.Context; -using System; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - [DataContract] - internal class SuspendedTask : ISuspendedTask - { - internal SuspendedTask(ISuspendedTaskClr2Java suspendedTaskClr2Java) - { - InstanceId = Guid.NewGuid().ToString("N"); - SuspendedTaskClr2Java = suspendedTaskClr2Java; - ActiveContextClr2Java = suspendedTaskClr2Java.GetActiveContext(); - } - - [DataMember] - public string InstanceId { get; set; } - - public byte[] Message - { - get - { - return SuspendedTaskClr2Java.Get(); - } - - set - { - } - } - - public string Id - { - get - { - return SuspendedTaskClr2Java.GetId(); - } - - set - { - } - } - - public IActiveContext ActiveContext - { - get - { - return new ActiveContext(ActiveContextClr2Java); - } - - set - { - } - } - - [DataMember] - private ISuspendedTaskClr2Java SuspendedTaskClr2Java { get; set; } - - [DataMember] - private IActiveContextClr2Java ActiveContextClr2Java { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/TaskMessage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/TaskMessage.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/TaskMessage.cs deleted file mode 100644 index f12039e..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/bridge/events/TaskMessage.cs +++ /dev/null @@ -1,64 +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 Org.Apache.Reef.Driver.Task; -using System; -using System.Runtime.Serialization; - -namespace Org.Apache.Reef.Driver.Bridge -{ - /// <summary> - /// TaskMessage which wraps ITaskMessageClr2Java - /// </summary> - [DataContract] - internal class TaskMessage : ITaskMessage - { - private ITaskMessageClr2Java _taskMessageClr2Java; - private byte[] _message; - private string _instanceId; - - public TaskMessage(ITaskMessageClr2Java clr2Java, byte[] message) - { - _instanceId = Guid.NewGuid().ToString("N"); - _taskMessageClr2Java = clr2Java; - _message = message; - } - - [DataMember] - public string InstanceId - { - get { return _instanceId; } - set { _instanceId = value; } - } - - [DataMember] - public string TaskId - { - get { return _taskMessageClr2Java.GetId(); } - set { } - } - - [DataMember] - public byte[] Message - { - get { return _message; } - set { _message = value; } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfiguration.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfiguration.cs deleted file mode 100644 index 451ad2a..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfiguration.cs +++ /dev/null @@ -1,93 +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 Org.Apache.Reef.Common.Context; -using Org.Apache.Reef.Common.Events; -using Org.Apache.Reef.Tasks; -using Org.Apache.Reef.Tasks.Events; -using Org.Apache.Reef.Tang.Formats; -using Org.Apache.Reef.Tang.Util; -using System; -using System.Diagnostics.CodeAnalysis; - -[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "static field, typical usage in configurations")] - -namespace Org.Apache.Reef.Driver.Context -{ - public class ContextConfiguration : ConfigurationModuleBuilder - { - /// <summary> - /// The identifier of the context. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly RequiredParameter<string> Identifier = new RequiredParameter<string>(); - - /// <summary> - /// for context start. Defaults to logging if not bound. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<IContextStart>> OnContextStart = new OptionalImpl<IObserver<IContextStart>>(); - - /// <summary> - /// for context stop. Defaults to logging if not bound. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<IContextStop>> OnContextStop = new OptionalImpl<IObserver<IContextStop>>(); - - /// <summary> - /// to be informed right before a Task enters its call() method. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<ITaskStart>> OnTaskStart = new OptionalImpl<IObserver<ITaskStart>>(); - - /// <summary> - /// to be informed right after a Task exits its call() method. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<ITaskStop>> OnTaskStop = new OptionalImpl<IObserver<ITaskStop>>(); - - /// <summary> - /// Source of messages to be called whenever the evaluator is about to make a heartbeat. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IContextMessageSource> OnSendMessage = new OptionalImpl<IContextMessageSource>(); - - /// <summary> - /// Driver has sent the context a message, and this parameter is used to register a handler on the context for processing that message. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IContextMessageHandler> OnMessage = new OptionalImpl<IContextMessageHandler>(); - - public static ConfigurationModule ConfigurationModule - { - get - { - return new ContextConfiguration() - .BindNamedParameter(GenericType<ContextConfigurationOptions.ContextIdentifier>.Class, Identifier) - .BindSetEntry(GenericType<ContextConfigurationOptions.StartHandlers>.Class, OnContextStart) - .BindSetEntry(GenericType<ContextConfigurationOptions.StopHandlers>.Class, OnContextStop) - .BindSetEntry(GenericType<ContextConfigurationOptions.ContextMessageSources>.Class, OnSendMessage) - .BindSetEntry(GenericType<ContextConfigurationOptions.ContextMessageHandlers>.Class, OnMessage) - .BindSetEntry(GenericType<TaskConfigurationOptions.StartHandlers>.Class, OnTaskStart) - .BindSetEntry(GenericType<TaskConfigurationOptions.StopHandlers>.Class, OnTaskStop) - .Build(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfigurationOptions.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfigurationOptions.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfigurationOptions.cs deleted file mode 100644 index 66d7de7..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/ContextConfigurationOptions.cs +++ /dev/null @@ -1,60 +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 Org.Apache.Reef.Common.Context; -using Org.Apache.Reef.Common.Events; -using Org.Apache.Reef.Driver.Defaults; -using Org.Apache.Reef.Tang.Annotations; -using Org.Apache.Reef.Tang.Formats; -using System; -using System.Collections.Generic; - -namespace Org.Apache.Reef.Driver.Context -{ - /// <summary> - /// Configuration parameters for ContextConfiguration module. - /// </summary> - public class ContextConfigurationOptions : ConfigurationModuleBuilder - { - [NamedParameter(documentation: "The identifier for the context.")] - public class ContextIdentifier : Name<string> - { - } - - [NamedParameter(documentation: "The set of event handlers for the ContextStart event", defaultClasses: new[] { typeof(DefaultContextStartHandler) })] - public class StartHandlers : Name<ISet<IObserver<IContextStart>>> - { - } - - [NamedParameter(documentation: "The set of event handlers for the ContextStop event", defaultClasses: new[] { typeof(DefaultContextStopHandler) })] - public class StopHandlers : Name<ISet<IObserver<IContextStop>>> - { - } - - [NamedParameter(documentation: "The set of ContextMessageSource implementations called during heartbeats.", defaultClasses: new[] { typeof(DefaultContextMessageSource) })] - public class ContextMessageSources : Name<ISet<IContextMessageSource>> - { - } - - [NamedParameter(documentation: "The set of Context message handlers.")] - public class ContextMessageHandlers : Name<ISet<IContextMessageHandler>> - { - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/EvaluatorContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/EvaluatorContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/EvaluatorContext.cs deleted file mode 100644 index 1bd8b18..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/EvaluatorContext.cs +++ /dev/null @@ -1,148 +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 Org.Apache.Reef.Common.ProtoBuf.EvaluatorRunTimeProto; -using Org.Apache.Reef.Driver.Bridge; -using Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Interface; -using System; -using System.Globalization; - -namespace Org.Apache.Reef.Driver -{ - public class EvaluatorContext : IActiveContext - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(EvaluatorContext)); - - private string _identifier; - - private Optional<string> _parentId; - - private EvaluatorManager _evaluatorManager; - - private bool _disposed = false; - - public EvaluatorContext(EvaluatorManager evaluatorManager, string id, Optional<string> parentId) - { - _identifier = id; - _parentId = parentId; - _evaluatorManager = evaluatorManager; - } - - public string Id - { - get - { - return _identifier; - } - - set - { - } - } - - public string EvaluatorId - { - get - { - return _evaluatorManager.Id; - } - - set - { - } - } - - public Optional<string> ParentId - { - get - { - return _parentId; - } - - set - { - } - } - - public IEvaluatorDescriptor EvaluatorDescriptor - { - get - { - return _evaluatorManager.EvaluatorDescriptor; - } - - set - { - } - } - - public void Dispose() - { - if (_disposed) - { - var e = new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Active context [{0}] already closed", _identifier)); - Exceptions.Throw(e, LOGGER); - } - LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Submit close context: RunningEvaluator id [{0}] for context id [{1}]", EvaluatorId, Id)); - RemoveContextProto removeContextProto = new RemoveContextProto(); - removeContextProto.context_id = Id; - ContextControlProto contextControlProto = new ContextControlProto(); - contextControlProto.remove_context = removeContextProto; - _evaluatorManager.Handle(contextControlProto); - _disposed = true; - } - - public ClosedContext GetClosedContext(IActiveContext parentContext) - { - //return new ClosedContext(parentContext, EvaluatorId, Id, ParentId, EvaluatorDescriptor); - throw new NotImplementedException(); - } - - public FailedContext GetFailedContext(Optional<IActiveContext> parentContext, Exception cause) - { - //return new FailedContext(parentContext, Id, cause, EvaluatorId, ParentId, EvaluatorDescriptor); - throw new NotImplementedException(); - } - - public void SubmitTask(IConfiguration taskConf) - { - throw new NotImplementedException(); - } - - public void SubmitContext(IConfiguration contextConfiguration) - { - throw new NotImplementedException(); - } - - public void SubmitContextAndService(IConfiguration contextConfiguration, IConfiguration serviceConfiguration) - { - throw new NotImplementedException(); - } - - public void SendMessage(byte[] message) - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/IActiveContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IActiveContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/IActiveContext.cs deleted file mode 100644 index b511e25..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IActiveContext.cs +++ /dev/null @@ -1,29 +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 Org.Apache.Reef.Common; -using System; - -namespace Org.Apache.Reef.Driver.Context -{ - public interface IActiveContext : IDisposable, IContext, ITaskSubmittable, IContextSubmittable - { - void SendMessage(byte[] message); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/IClosedContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IClosedContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/IClosedContext.cs deleted file mode 100644 index 8ea7cc2..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IClosedContext.cs +++ /dev/null @@ -1,26 +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. - */ - -namespace Org.Apache.Reef.Driver.Context -{ - public interface IClosedContext : IContext - { - IActiveContext ParentContext { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/IContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/IContext.cs deleted file mode 100644 index d47b9ea..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IContext.cs +++ /dev/null @@ -1,45 +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 Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities; - -namespace Org.Apache.Reef.Driver.Context -{ - /// <summary> - /// A common base interface for Contexts, available or failed. - /// </summary> - public interface IContext : IIdentifiable - { - /// <summary> - /// the identifier of the Evaluator this EvaluatorContext is instantiated on. - /// </summary> - string EvaluatorId { get; set; } - - /// <summary> - /// ID of the parent context, if there is any. - /// </summary> - Optional<string> ParentId { get; set; } - - /// <summary> - /// descriptor of the Evaluator this Context is on. - /// </summary> - IEvaluatorDescriptor EvaluatorDescriptor { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/IFailedContext.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IFailedContext.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/IFailedContext.cs deleted file mode 100644 index 7f9b94e..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/IFailedContext.cs +++ /dev/null @@ -1,28 +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 Org.Apache.Reef.Utilities; - -namespace Org.Apache.Reef.Driver.Context -{ - public interface IFailedContext : IContext - { - Optional<IActiveContext> ParentContext { get; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextMessageSource.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextMessageSource.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextMessageSource.cs deleted file mode 100644 index 9b4f3a3..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextMessageSource.cs +++ /dev/null @@ -1,42 +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 Org.Apache.Reef.Common.Context; -using Org.Apache.Reef.Utilities; - -namespace Org.Apache.Reef.Driver.Context -{ - /// <summary> - /// Default ContextMessageSource: return nothing. - /// </summary> - public class DefaultContextMessageSource : IContextMessageSource - { - public Optional<Common.Context.ContextMessage> Message - { - get - { - return Optional<Common.Context.ContextMessage>.Empty(); - } - - set - { - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStartHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStartHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStartHandler.cs deleted file mode 100644 index 94af51e..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStartHandler.cs +++ /dev/null @@ -1,48 +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 Org.Apache.Reef.Common.Events; -using Org.Apache.Reef.Utilities.Logging; -using System; - -namespace Org.Apache.Reef.Driver.Context -{ - /// <summary> - /// Default handler for ContextStart - /// </summary> - public class DefaultContextStartHandler : IObserver<IContextStart> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultContextStartHandler)); - - public void OnNext(IContextStart contextStart) - { - LOGGER.Log(Level.Info, "DefaultContextStartHandler received for context: " + contextStart.Id); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStopHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStopHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStopHandler.cs deleted file mode 100644 index a7f0220..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/context/defaults/DefaultContextStopHandler.cs +++ /dev/null @@ -1,48 +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 Org.Apache.Reef.Common.Events; -using Org.Apache.Reef.Utilities.Logging; -using System; - -namespace Org.Apache.Reef.Driver.Context -{ - /// <summary> - /// Default event handler for ContextStop - /// </summary> - public class DefaultContextStopHandler : IObserver<IContextStop> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultContextStopHandler)); - - public void OnNext(IContextStop contextStop) - { - LOGGER.Log(Level.Info, "DefaultContextStopHandler received for context: " + contextStop.Id); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/contract/IBridgeContract.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/contract/IBridgeContract.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/contract/IBridgeContract.cs deleted file mode 100644 index 424fdb8..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/contract/IBridgeContract.cs +++ /dev/null @@ -1,26 +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. - */ - -namespace Org.Apache.Reef.Driver.Contract -{ - public interface IBridgeContract - { - string InstanceId { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseHandler.cs deleted file mode 100644 index a69200f..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseHandler.cs +++ /dev/null @@ -1,53 +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 Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; - -namespace Org.Apache.Reef.Driver.Defaults -{ - /// <summary> - /// Default handler for close messages from the client: logging it - /// </summary> - public class DefaultClientCloseHandler : IObserver<byte[]> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultClientCloseHandler)); - - [Inject] - public DefaultClientCloseHandler() - { - } - - public void OnNext(byte[] value) - { - LOGGER.Log(Level.Info, "Closing the Client"); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseWithMessageHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseWithMessageHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseWithMessageHandler.cs deleted file mode 100644 index 16e004c..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientCloseWithMessageHandler.cs +++ /dev/null @@ -1,54 +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 Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; - -namespace Org.Apache.Reef.Driver.Defaults -{ - /// <summary> - /// Default handler for close messages from the client: Throw an Exception. - /// </summary> - public class DefaultClientCloseWithMessageHandler : IObserver<byte[]> - { - [Inject] - public DefaultClientCloseWithMessageHandler() - { - } - - public void OnNext(byte[] value) - { - Exceptions.Throw(new InvalidOperationException("No handler bound for client Close With Message event:" + ByteUtilities.ByteArrarysToString(value)), - Logger.GetLogger(typeof(DefaultClientCloseWithMessageHandler))); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientMessageHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientMessageHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientMessageHandler.cs deleted file mode 100644 index 61689d0..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultClientMessageHandler.cs +++ /dev/null @@ -1,54 +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 Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; - -namespace Org.Apache.Reef.Driver.Defaults -{ - /// <summary> - /// DDefault event handler for Client messages: Logging it. - /// </summary> - public class DefaultClientMessageHandler : IObserver<byte[]> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultClientMessageHandler)); - - [Inject] - public DefaultClientMessageHandler() - { - } - - public void OnNext(byte[] value) - { - LOGGER.Log(Level.Info, "Received message: " + ByteUtilities.ByteArrarysToString(value)); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextActiveHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextActiveHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextActiveHandler.cs deleted file mode 100644 index bc0b482..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextActiveHandler.cs +++ /dev/null @@ -1,56 +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 Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; -using System.Globalization; - -namespace Org.Apache.Reef.Driver.Defaults -{ - /// <summary> - /// Default handler for ActiveContext: Close it. - /// </summary> - public class DefaultContextActiveHandler : IObserver<IActiveContext> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultContextActiveHandler)); - - [Inject] - public DefaultContextActiveHandler() - { - } - - public void OnNext(IActiveContext value) - { - LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received ActiveContext :[{0}], closing it", value.Id)); - value.Dispose(); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextClosureHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextClosureHandler.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextClosureHandler.cs deleted file mode 100644 index 62e8966..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/defaults/DefaultContextClosureHandler.cs +++ /dev/null @@ -1,55 +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 Org.Apache.Reef.Common.Context; -using Org.Apache.Reef.Driver.Context; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; - -namespace Org.Apache.Reef.Driver.Defaults -{ - /// <summary> - /// Default event handler for ClosedContext: Logging it. - /// </summary> - public class DefaultContextClosureHandler : IObserver<IClosedContext> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultContextClosureHandler)); - - [Inject] - public DefaultContextClosureHandler() - { - } - - public void OnNext(IClosedContext value) - { - LOGGER.Log(Level.Info, "Received ClosedContext :" + value.Id); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -}
