You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2015/02/07 04:11:29 UTC
[1/3] incubator-reef git commit: [REEF-143] Refactor REEF.Examples
into one project This is to consolidate all reef examples into one project
Repository: incubator-reef
Updated Branches:
refs/heads/master 05766f9d3 -> 29c56c8e6
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloSimpleEventHandlers.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloSimpleEventHandlers.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloSimpleEventHandlers.cs
new file mode 100644
index 0000000..1e61c61
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloSimpleEventHandlers.cs
@@ -0,0 +1,422 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Examples.Tasks.HelloTask;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ enum DriverStatus
+ {
+ Init = 0,
+ Idle = 1,
+ RunningTasks = 2,
+ CompleteTasks = 3
+ }
+
+ internal enum TaskStatus
+ {
+ Submitting = 0,
+ Running = 1,
+ Completed = 2
+ }
+
+ /// <summary>
+ /// A demo class that contains basic handlers. It runs given tasks and is able to get request from http server and start to ren the tasks again.
+ /// It handle various http requests. It also monitoring task status and driver status.
+ /// </summary>
+ public class HelloSimpleEventHandlers :
+ IObserver<IEvaluatorRequestor>,
+ IObserver<IAllocatedEvaluator>,
+ IObserver<IActiveContext>,
+ IObserver<ICompletedTask>,
+ IObserver<IRunningTask>,
+ IObserver<IFailedTask>,
+ IObserver<IFailedEvaluator>,
+ IObserver<ICompletedEvaluator>,
+ IStartHandler,
+ IHttpHandler
+ {
+ private const int NumberOfTasks = 5;
+ private static readonly Logger LOGGER = Logger.GetLogger(typeof(HelloSimpleEventHandlers));
+ private IAllocatedEvaluator _allocatedEvaluator;
+ private IActiveContext _activeContext;
+ private IList<IActiveContext> _activeContexts = new List<IActiveContext>();
+ private DriverStatus driveStatus;
+ private TaskContext _taskContext;
+
+ [Inject]
+ public HelloSimpleEventHandlers()
+ {
+ LOGGER.Log(Level.Info, "HelloSimpleEventHandlers constructor");
+ CreateClassHierarchy();
+ Identifier = "HelloSimpleEventHandlers";
+ _taskContext = new TaskContext();
+ _taskContext.TotalTasks = NumberOfTasks;
+ driveStatus = DriverStatus.Init;
+ }
+
+ public string Identifier { get; set; }
+
+ public static string ParsePathInfo(string pathInfo)
+ {
+ string[] p = pathInfo.Split('/');
+ foreach (string s in p)
+ {
+ LOGGER.Log(Level.Info, s);
+ }
+ if (p.Length > 3)
+ {
+ return p[3];
+ }
+ return null;
+ }
+
+ public static void BuildHttpResponse(
+ ReefHttpResponse response,
+ HttpStatusCode httpStatusCode,
+ string strResponse)
+ {
+ response.Status = httpStatusCode;
+ response.OutputStream = ByteUtilities.StringToByteArrays(strResponse);
+ }
+
+ public static void BuildHttpResponse(
+ ReefHttpResponse response,
+ HttpStatusCode httpStatusCode,
+ byte[] bytesResponse)
+ {
+ response.Status = httpStatusCode;
+ response.OutputStream = bytesResponse;
+ }
+
+ public void OnNext(IEvaluatorRequestor evalutorRequestor)
+ {
+ using (LOGGER.LogFunction("HelloSimpleEventHandlers::evalutorRequestor received"))
+ {
+ int evaluatorsNumber = 2;
+ int memory = 1024 * 3;
+ int cpuCoreCount = 1;
+ string rack = "WonderlandRack";
+ string evaluatorBatchId = "evaluatorThatRequires3GBofMemory";
+ EvaluatorRequest request = new EvaluatorRequest(evaluatorsNumber, memory, cpuCoreCount, rack, evaluatorBatchId);
+
+ evalutorRequestor.Submit(request);
+ }
+ }
+
+ public void OnNext(IAllocatedEvaluator allocatedEvaluator)
+ {
+ string taskId = "Task_" + allocatedEvaluator.Id;
+ using (LOGGER.LogFunction("HelloSimpleEventHandlers::allocatedEvaluator received {0}.", taskId))
+ {
+ _allocatedEvaluator = allocatedEvaluator;
+
+ IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule.Set(ContextConfiguration.Identifier, "HelloSimpleEventHandlersContext_" + Guid.NewGuid().ToString("N")).Build();
+
+ allocatedEvaluator.SubmitContext(contextConfiguration);
+ }
+ }
+
+ public void OnNext(IActiveContext activeContext)
+ {
+ using (LOGGER.LogFunction("HelloSimpleEventHandlers::activeContext received"))
+ {
+ LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received activeContext, EvaluatorId id: {0}", activeContext.EvaluatorId));
+ _activeContext = activeContext;
+ _activeContexts.Add(activeContext);
+ driveStatus = DriverStatus.RunningTasks;
+ SubmitNextTask(activeContext);
+ }
+ }
+
+ public void OnNext(ICompletedTask value)
+ {
+ using (LOGGER.LogFunction("HelloSimpleEventHandlers::CompletedTask received"))
+ {
+ LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received CompletedTask: {0}, task id: {1}", value.Id, _taskContext.CurrentTaskId()));
+ _activeContext = value.ActiveContext;
+ _taskContext.UpdateTaskStatus(value.Id, TaskStatus.Completed);
+ _taskContext.TaskCompleted++;
+ SubmitNextTask(value.ActiveContext);
+ }
+ }
+
+ public void OnError(Exception error)
+ {
+ LOGGER.Log(Level.Error, string.Format(CultureInfo.InvariantCulture, "Exception in coral handlers Msg: {1} Stack: {2}", error.Message, error.StackTrace));
+ }
+
+ public void OnCompleted()
+ {
+ }
+
+ public void OnNext(IRunningTask value)
+ {
+ _taskContext.UpdateTaskStatus(_taskContext.CurrentTaskId(), TaskStatus.Running);
+ }
+
+ public void OnNext(IFailedTask value)
+ {
+ }
+
+ public void OnNext(IFailedEvaluator value)
+ {
+ }
+
+ public void OnNext(ICompletedEvaluator completedEvaluator)
+ {
+ string messageStr = string.Format(
+ CultureInfo.InvariantCulture,
+ "HelloSimpleEventHandlers: Evaluator [{0}] is done.",
+ completedEvaluator.Id);
+ Console.WriteLine(messageStr);
+ }
+
+ public string GetSpecification()
+ {
+ return "crystal";
+ }
+
+ public void OnHttpRequest(ReefHttpRequest request, ReefHttpResponse response)
+ {
+ string target = ParsePathInfo(request.PathInfo);
+ LOGGER.Log(Level.Info, "Target: " + target + ". PathInfo: " + request.PathInfo);
+ //if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("driverstatus"))
+ if (target != null && target.Equals("driverstatus"))
+ {
+ LOGGER.Log(Level.Info, "Target: " + target + ". Driver status: " + driveStatus.ToString());
+ string msg = string.Format(CultureInfo.CurrentCulture, "Current Driver status: {0} ", driveStatus.ToString());
+ BuildHttpResponse(response, HttpStatusCode.OK, msg);
+ return;
+ }
+
+ if (target != null && target.Equals("taskstatus"))
+ {
+ LOGGER.Log(Level.Info, "Target: " + target + ". TaskStatus string: " + _taskContext.TaskStatusString());
+ BuildHttpResponse(response, HttpStatusCode.OK, _taskContext.TaskStatusString());
+ return;
+ }
+
+ if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("run") && driveStatus == DriverStatus.Init)
+ {
+ BuildHttpResponse(response, HttpStatusCode.OK, "Driver is not ready, wait a few second then send request again!!!");
+ return;
+ }
+
+ if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("run") && driveStatus == DriverStatus.RunningTasks)
+ {
+ string msg = string.Format(CultureInfo.CurrentCulture,
+ "A job is running. Please check driver status and then submit your job again.");
+ BuildHttpResponse(response, HttpStatusCode.OK, msg);
+ return;
+ }
+
+ if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("run") && driveStatus == DriverStatus.Idle)
+ {
+ string numberOfTasks = getQueryValue(request.Querystring, "numberoftasks");
+ if (numberOfTasks == null)
+ {
+ BuildHttpResponse(response, HttpStatusCode.OK, "Please specify number of tasks to run");
+ return;
+ }
+
+ driveStatus = DriverStatus.RunningTasks;
+ using (LOGGER.LogFunction("HelloSimpleEventHandlers::Processing a new Job from web request"))
+ {
+ _taskContext = new TaskContext();
+ _taskContext.TotalTasks = int.Parse(numberOfTasks, CultureInfo.CurrentCulture);
+ BuildHttpResponse(response, HttpStatusCode.OK, "Job from web request is submitted and is running!!!");
+ }
+
+ foreach (var c in _activeContexts)
+ {
+ SubmitNextTask(c);
+ }
+ return;
+ }
+ BuildHttpResponse(response, HttpStatusCode.OK, "Unsupported query");
+ }
+
+ private static IDictionary<string, string> ParseQueryString(string queryString)
+ {
+ IDictionary<string, string> queryPairs = new Dictionary<string, string>();
+ if (queryString != null && queryString.Length > 0)
+ {
+ string[] queries = queryString.Split('&');
+ foreach (string query in queries)
+ {
+ string[] pairs = query.Split('=');
+ if (pairs.Length == 2 && !pairs[0].Equals(string.Empty) && !pairs[1].Equals(string.Empty))
+ {
+ queryPairs[pairs[0]] = pairs[1];
+ LOGGER.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "query key: {0}, Query value: {1}.", pairs[0], pairs[1]));
+ }
+ }
+ }
+ return queryPairs;
+ }
+
+ private static string getQueryValue(string queryString, string name)
+ {
+ IDictionary<string, string> pairs = ParseQueryString(queryString);
+ string v;
+ pairs.TryGetValue(name, out v);
+ return v;
+ }
+
+ private void CreateClassHierarchy()
+ {
+ HashSet<string> clrDlls = new HashSet<string>();
+ clrDlls.Add(typeof(IDriver).Assembly.GetName().Name);
+ clrDlls.Add(typeof(ITask).Assembly.GetName().Name);
+ clrDlls.Add(typeof(HelloTask).Assembly.GetName().Name);
+ clrDlls.Add(typeof(INameClient).Assembly.GetName().Name);
+ clrDlls.Add(typeof(NameClient).Assembly.GetName().Name);
+
+ ClrHandlerHelper.GenerateClassHierarchy(clrDlls);
+ }
+
+ private void SubmitNextTask(IActiveContext activeContext)
+ {
+ LOGGER.Log(Level.Info, "SubmitNextTask with evaluatorid: " + activeContext.EvaluatorId);
+ IConfiguration finalConfiguration = GetNextTaskConfiguration();
+ if (null != finalConfiguration)
+ {
+ LOGGER.Log(Level.Info, "Executing task id " + _taskContext.CurrentTaskId());
+ LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Submitting Task {0}", _taskContext.CurrentTaskId()));
+
+ activeContext.SubmitTask(finalConfiguration);
+ }
+ else
+ {
+ if (_taskContext.TaskCompleted == _taskContext.TotalTasks)
+ {
+ LOGGER.Log(Level.Info, "All tasks submitted and completed, active context remian idle");
+ driveStatus = DriverStatus.Idle;
+ }
+ }
+ }
+
+ private IConfiguration GetNextTaskConfiguration()
+ {
+ string nextTaskId = _taskContext.NextTaskId();
+ LOGGER.Log(Level.Info, "GetNextTaskConfiguration, nextTaskId: " + nextTaskId);
+ if (nextTaskId != null)
+ {
+ IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
+ .Set(TaskConfiguration.Identifier, nextTaskId)
+ .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class)
+ .Set(TaskConfiguration.OnMessage, GenericType<HelloTask.HelloDriverMessageHandler>.Class)
+ .Set(TaskConfiguration.OnSendMessage, GenericType<HelloTaskMessage>.Class)
+ .Build();
+ return taskConfiguration;
+ }
+ return null;
+ }
+ }
+
+ class TaskContext
+ {
+ private IList<string> taskIds = new List<string>();
+
+ private IDictionary<string, TaskStatus> tasks = new Dictionary<string, TaskStatus>();
+
+ public TaskContext()
+ {
+ NextTaskIndex = 0;
+ TaskCompleted = 0;
+ }
+
+ public int TotalTasks { get; set; }
+
+ public int NextTaskIndex { get; set; }
+
+ public int TaskCompleted { get; set; }
+
+ public string NextTaskId()
+ {
+ Console.WriteLine("NextTaskId: " + NextTaskIndex);
+ if (NextTaskIndex < TotalTasks)
+ {
+ string id = "Jan7DemoTask_" + DateTime.Now.Ticks;
+ taskIds.Add(id);
+ tasks.Add(id, TaskStatus.Submitting);
+ NextTaskIndex++;
+ return id;
+ }
+ return null;
+ }
+
+ public string CurrentTaskId()
+ {
+ Console.WriteLine("CurrentTaskIndex: " + (NextTaskIndex - 1));
+ if (NextTaskIndex <= TotalTasks)
+ {
+ Console.WriteLine("CurrentTaskId: " + taskIds[NextTaskIndex - 1]);
+ return taskIds[NextTaskIndex - 1];
+ }
+ return null; //either not started or completed
+ }
+
+ public void UpdateTaskStatus(string taskId, TaskStatus status)
+ {
+ tasks[taskId] = status;
+ }
+
+ public string TaskStatusString()
+ {
+ Console.WriteLine("TaskStatusString 1, nextTaskIndex: " + NextTaskIndex);
+ StringBuilder sb = new StringBuilder();
+
+ if (tasks.Count > 0)
+ {
+ foreach (var pair in tasks)
+ {
+ sb.AppendLine("Task id: " + pair.Key + " Task status: " + pair.Value.ToString());
+ }
+ }
+ else
+ {
+ sb.Append("No task is running yet");
+ }
+
+ return sb.ToString();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloStartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloStartHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloStartHandler.cs
new file mode 100644
index 0000000..6234fec
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloStartHandler.cs
@@ -0,0 +1,65 @@
+/**
+ * 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.Common.io;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.bridge;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Examples.Tasks.HelloTask;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloStartHandler : IStartHandler
+ {
+ private static readonly Logger LOGGER = Logger.GetLogger(typeof(HelloStartHandler));
+
+ [Inject]
+ public HelloStartHandler(HttpServerPort httpServerPort)
+ {
+ CreateClassHierarchy();
+ Identifier = "HelloStartHandler";
+ LOGGER.Log(Level.Info, "HttpPort received in HelloStartHandler: " + httpServerPort.PortNumber);
+ }
+
+ public HelloStartHandler(string id)
+ {
+ Identifier = id;
+ CreateClassHierarchy();
+ }
+
+ public string Identifier { get; set; }
+
+ private void CreateClassHierarchy()
+ {
+ HashSet<string> clrDlls = new HashSet<string>();
+ clrDlls.Add(typeof(IDriver).Assembly.GetName().Name);
+ clrDlls.Add(typeof(ITask).Assembly.GetName().Name);
+ clrDlls.Add(typeof(HelloTask).Assembly.GetName().Name);
+ clrDlls.Add(typeof(INameClient).Assembly.GetName().Name);
+ clrDlls.Add(typeof(NameClient).Assembly.GetName().Name);
+
+ ClrHandlerHelper.GenerateClassHierarchy(clrDlls);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloTaskMessageHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloTaskMessageHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloTaskMessageHandler.cs
new file mode 100644
index 0000000..e6675ef
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloTaskMessageHandler.cs
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Globalization;
+using System.Text;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloTaskMessageHandler : IObserver<ITaskMessage>
+ {
+ [Inject]
+ public HelloTaskMessageHandler()
+ {
+ }
+
+ public void OnNext(ITaskMessage taskMessage)
+ {
+ Console.WriteLine(string.Format(
+ CultureInfo.InvariantCulture,
+ "CLR HelloTaskMessageHandler received following message from Task: {0}, Message: {1}.",
+ taskMessage.TaskId,
+ Encoding.UTF8.GetString(taskMessage.Message)));
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/HelloTraceListener.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/HelloTraceListener.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/HelloTraceListener.cs
new file mode 100644
index 0000000..88dbe3b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/HelloTraceListener.cs
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.Tang.Annotations;
+using System.Diagnostics;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge
+{
+ /// <summary>
+ /// This is a sample implemenation on how custom trace listner can be implemented
+ /// </summary>
+ public class HelloTraceListener : TraceListener
+ {
+ private TraceListener _listener;
+
+ [Inject]
+ public HelloTraceListener()
+ {
+ _listener = new ConsoleTraceListener();
+ }
+
+ public override void Write(string message)
+ {
+ _listener.Write("[helloTrace]" + message );
+ }
+
+ public override void WriteLine(string message)
+ {
+ _listener.WriteLine("[helloTrace]" + message);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj b/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj
new file mode 100644
index 0000000..e2691c5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Org.Apache.REEF.Examples.csproj
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{75503F90-7B82-4762-9997-94B5C68F15DB}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Org.Apache.REEF.Examples</RootNamespace>
+ <AssemblyName>Org.Apache.REEF.Examples</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <RestorePackages>true</RestorePackages>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\build.props" />
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="HelloCLRBridge\Handlers\AnotherHelloAllocatedEvaluatorHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloActiveContextHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloAllocatedEvaluatorHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloCompletedEvaluatorHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloDriverRestartActiveContextHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloDriverRestartRunningTaskHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloEvaluatorRequestorHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloFailedEvaluatorHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloFailedTaskHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloHttpHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloRestartHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloRunningTaskHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloSimpleEventHandlers.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloStartHandler.cs" />
+ <Compile Include="HelloCLRBridge\Handlers\HelloTaskMessageHandler.cs" />
+ <Compile Include="HelloCLRBridge\HelloTraceListener.cs" />
+ <Compile Include="RetainedEvalCLRBridge\Handlers\RetainedEvalActiveContextHandler.cs" />
+ <Compile Include="RetainedEvalCLRBridge\Handlers\RetainedEvalAllocatedEvaluatorHandler.cs" />
+ <Compile Include="RetainedEvalCLRBridge\Handlers\RetainedEvalEvaluatorRequestorHandler.cs" />
+ <Compile Include="RetainedEvalCLRBridge\Handlers\RetainedEvalStartHandler.cs" />
+ <Compile Include="Tasks\FailedTask\FailedTask.cs" />
+ <Compile Include="Tasks\HelloTask\HelloService.cs" />
+ <Compile Include="Tasks\HelloTask\HelloTask.cs" />
+ <Compile Include="Tasks\HelloTask\HelloTaskMessage.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Tasks\ShellTask\ShellTask.cs" />
+ <Compile Include="Tasks\StreamingTasks\StreamTask1.cs" />
+ <Compile Include="Tasks\StreamingTasks\StreamTask2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
+ <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
+ <Name>Org.Apache.REEF.Tang</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
+ <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+ <Name>Org.Apache.REEF.Utilities</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
+ <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
+ <Name>Org.Apache.REEF.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
+ <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+ <Name>Org.Apache.REEF.Driver</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
+ <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
+ <Name>Org.Apache.REEF.Network</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
+ <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
+ <Name>Org.Apache.REEF.Wake</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Examples/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..fba805a
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Org.Apache.REEF.Examples")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Org.Apache.REEF.Examples")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b9e219f1-a02c-468c-ab26-3ef5c91310f7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalActiveContextHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalActiveContextHandler.cs b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalActiveContextHandler.cs
new file mode 100644
index 0000000..8a6be9d
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalActiveContextHandler.cs
@@ -0,0 +1,56 @@
+/**
+ * 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.Context;
+using Org.Apache.REEF.Examples.Tasks.ShellTask;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Tasks;
+
+namespace Org.Apache.REEF.Examples.RetainedEvalCLRBridge.Handlers
+{
+ public class RetainedEvalActiveContextHandler : IObserver<IActiveContext>
+ {
+ public void OnNext(IActiveContext activeContext)
+ {
+ ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
+ cb.AddConfiguration(TaskConfiguration.ConfigurationModule
+ .Set(TaskConfiguration.Identifier, "bridgeCLRShellTask_" + DateTime.Now.Ticks)
+ .Set(TaskConfiguration.Task, GenericType<ShellTask>.Class)
+ .Build());
+ cb.BindNamedParameter<ShellTask.Command, string>(GenericType<ShellTask.Command>.Class, "echo");
+
+ IConfiguration taskConfiguration = cb.Build();
+
+ activeContext.SubmitTask(taskConfiguration);
+ }
+
+ 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalAllocatedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalAllocatedEvaluatorHandler.cs
new file mode 100644
index 0000000..c591382
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalAllocatedEvaluatorHandler.cs
@@ -0,0 +1,48 @@
+/**
+ * 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.Context;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.Examples.RetainedEvalCLRBridge.Handlers
+{
+ public class RetainedEvalAllocatedEvaluatorHandler : IObserver<IAllocatedEvaluator>
+ {
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnNext(IAllocatedEvaluator allocatedEvaluator)
+ {
+ IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule
+ .Set(ContextConfiguration.Identifier, "RetainedEvalCLRBridgeContextId")
+ .Build();
+
+ allocatedEvaluator.SubmitContext(contextConfiguration);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalEvaluatorRequestorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalEvaluatorRequestorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalEvaluatorRequestorHandler.cs
new file mode 100644
index 0000000..2bff930
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalEvaluatorRequestorHandler.cs
@@ -0,0 +1,48 @@
+/**
+ * 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.Bridge;
+using Org.Apache.REEF.Driver.Evaluator;
+
+namespace Org.Apache.REEF.Examples.RetainedEvalCLRBridge.Handlers
+{
+ public class RetainedEvalEvaluatorRequestorHandler : IObserver<IEvaluatorRequestor>
+ {
+ public void OnNext(IEvaluatorRequestor requestor)
+ {
+ int evaluatorsNumber = 1;
+ int memory = 512;
+ string rack = "WonderlandRack";
+ EvaluatorRequest request = new EvaluatorRequest(evaluatorsNumber, memory, rack);
+
+ requestor.Submit(request);
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalStartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalStartHandler.cs b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalStartHandler.cs
new file mode 100644
index 0000000..f077831
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/RetainedEvalCLRBridge/Handlers/RetainedEvalStartHandler.cs
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Org.Apache.REEF.Driver;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Examples.Tasks.ShellTask;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+
+namespace Org.Apache.REEF.Examples.RetainedEvalCLRBridge.Handlers
+{
+ public class RetainedEvalStartHandler : IStartHandler
+ {
+ private static ClrSystemHandler<IEvaluatorRequestor> _evaluatorRequestorHandler;
+ private static ClrSystemHandler<IAllocatedEvaluator> _allocatedEvaluatorHandler;
+ private static ClrSystemHandler<IActiveContext> _activeContextHandler;
+
+ [Inject]
+ public RetainedEvalStartHandler()
+ {
+ CreateClassHierarchy();
+ Identifier = "RetainedEvalStartHandler";
+ }
+
+ public RetainedEvalStartHandler(string id)
+ {
+ Identifier = id;
+ CreateClassHierarchy();
+ }
+
+ public string Identifier { get; set; }
+
+ public IList<ulong> GetHandlers()
+ {
+ ulong[] handlers = Enumerable.Repeat(Constants.NullHandler, Constants.HandlersNumber).ToArray();
+
+ // initiate Evaluator Requestor handler
+ _evaluatorRequestorHandler = new ClrSystemHandler<IEvaluatorRequestor>();
+ handlers[Constants.Handlers[Constants.EvaluatorRequestorHandler]] = ClrHandlerHelper.CreateHandler(_evaluatorRequestorHandler);
+ Console.WriteLine("_evaluatorRequestorHandler initiated");
+ _evaluatorRequestorHandler.Subscribe(new RetainedEvalEvaluatorRequestorHandler());
+
+ // initiate Allocated Evaluator handler
+ _allocatedEvaluatorHandler = new ClrSystemHandler<IAllocatedEvaluator>();
+ handlers[Constants.Handlers[Constants.AllocatedEvaluatorHandler]] = ClrHandlerHelper.CreateHandler(_allocatedEvaluatorHandler);
+ Console.WriteLine("_allocatedEvaluatorHandler initiated");
+ _allocatedEvaluatorHandler.Subscribe(new RetainedEvalAllocatedEvaluatorHandler());
+
+ // initiate Active Context handler
+ _activeContextHandler = new ClrSystemHandler<IActiveContext>();
+ handlers[Constants.Handlers[Constants.ActiveContextHandler]] = ClrHandlerHelper.CreateHandler(_activeContextHandler);
+ Console.WriteLine("_activeContextHandler initiated");
+ _activeContextHandler.Subscribe(new RetainedEvalActiveContextHandler());
+
+ return handlers;
+ }
+
+ private void CreateClassHierarchy()
+ {
+ HashSet<string> clrDlls = new HashSet<string>();
+ clrDlls.Add(typeof(IDriver).Assembly.GetName().Name);
+ clrDlls.Add(typeof(ITask).Assembly.GetName().Name);
+ clrDlls.Add(typeof(ShellTask).Assembly.GetName().Name);
+
+ ClrHandlerHelper.GenerateClassHierarchy(clrDlls);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/FailedTask/FailedTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/FailedTask/FailedTask.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/FailedTask/FailedTask.cs
new file mode 100644
index 0000000..aa489ce
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/FailedTask/FailedTask.cs
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Threading;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+
+namespace Org.Apache.REEF.Examples.Tasks.FailedTask
+{
+ public class FailedTask : ITask
+ {
+ [Inject]
+ public FailedTask()
+ {
+ }
+
+ public byte[] Call(byte[] memento)
+ {
+ Console.WriteLine("I am about to fail.");
+ Thread.Sleep(2 * 1000);
+ throw new ApplicationException("bite me.");
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloService.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloService.cs
new file mode 100644
index 0000000..e7734c1
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloService.cs
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using Org.Apache.REEF.Services;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.Tasks.HelloTask
+{
+ public class HelloService : IService
+ {
+ private IList<string> _guests;
+
+ [Inject]
+ public HelloService()
+ {
+ if (_guests == null)
+ {
+ _guests = new List<string>();
+ _guests.Add("MR.SMITH");
+ }
+ }
+
+ public IList<string> Guests
+ {
+ get
+ {
+ return _guests;
+ }
+ }
+
+ public void AddGuest(string guestName)
+ {
+ if (string.IsNullOrWhiteSpace(guestName))
+ {
+ throw new ArgumentException("can't do with empty name.");
+ }
+ Guests.Add(guestName);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
new file mode 100644
index 0000000..f832d50
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTask.cs
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Linq;
+using System.Net;
+using System.Threading;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Tasks.Events;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.Examples.Tasks.HelloTask
+{
+ public class HelloTask : ITask
+ {
+ private static readonly Logger LOGGER = Logger.GetLogger(typeof(HelloTask));
+
+ private INameClient _nameClient = null;
+
+ [Inject]
+ public HelloTask()
+ {
+ Console.WriteLine("HelloTask constructor 0");
+ }
+
+ [Inject]
+ public HelloTask(HelloService service, INameClient nameClient)
+ {
+ Console.WriteLine("HelloTask constructor 2");
+ Service = service;
+ _nameClient = nameClient;
+ }
+
+ [Inject]
+ public HelloTask(HelloService service)
+ {
+ Console.WriteLine("HelloTask constructor 1");
+ Service = service;
+ }
+
+ public HelloService Service { get; set; }
+
+ public byte[] Call(byte[] memento)
+ {
+ Console.WriteLine("Hello, CLR REEF!");
+ if (_nameClient != null)
+ {
+ _nameClient.Register("abc", new IPEndPoint(IPAddress.Any, 8080));
+ Console.WriteLine("IP Address: {0}", _nameClient.Lookup("abc"));
+ }
+ PrintGuestList();
+ Thread.Sleep(5 * 1000);
+ Console.WriteLine("Bye, CLR REEF!");
+
+ return null;
+ }
+
+ public void Dispose()
+ {
+ LOGGER.Log(Level.Info, "Hello task disposed.");
+ }
+
+ private void HandleDriverMessage(string message)
+ {
+ using (LOGGER.LogFunction("HelloTask::HandleDriverMessage"))
+ {
+ LOGGER.Log(Level.Info, "I handle message by logging : " + message);
+ }
+ }
+
+ private void PrintGuestList()
+ {
+ if (Service == null || !Service.Guests.Any())
+ {
+ Console.WriteLine("No service provided.");
+ }
+ else
+ {
+ Console.WriteLine("Serving guest: " + string.Join(";", Service.Guests));
+ }
+ }
+
+ public class HelloDriverMessageHandler : IDriverMessageHandler
+ {
+ private HelloTask _parentTask;
+
+ [Inject]
+ public HelloDriverMessageHandler(HelloTask task)
+ {
+ _parentTask = task;
+ }
+
+ public void Handle(IDriverMessage value)
+ {
+ string message = string.Empty;
+ LOGGER.Log(Level.Verbose, "Receieved a message from driver, handling it with HelloDriverMessageHandler");
+ if (value.Message.IsPresent())
+ {
+ message = ByteUtilities.ByteArrarysToString(value.Message.Value);
+ }
+ _parentTask.HandleDriverMessage(message);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTaskMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTaskMessage.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTaskMessage.cs
new file mode 100644
index 0000000..4814e0e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/HelloTask/HelloTaskMessage.cs
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Globalization;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities;
+
+namespace Org.Apache.REEF.Examples.Tasks.HelloTask
+{
+ public class HelloTaskMessage : ITaskMessageSource
+ {
+ [Inject]
+ public HelloTaskMessage()
+ {
+ }
+
+ public Optional<TaskMessage> Message
+ {
+ get
+ {
+ TaskMessage defaultTaskMessage = TaskMessage.From(
+ "helloSourceId",
+ ByteUtilities.StringToByteArrays("hello message generated at " + DateTime.Now.ToString(CultureInfo.InvariantCulture)));
+ return Optional<TaskMessage>.Of(defaultTaskMessage);
+ }
+
+ set
+ {
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/ShellTask/ShellTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/ShellTask/ShellTask.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/ShellTask/ShellTask.cs
new file mode 100644
index 0000000..7bc90d5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/ShellTask/ShellTask.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;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Text;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+
+[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "allow name parameter class to be embedded")]
+
+namespace Org.Apache.REEF.Examples.Tasks.ShellTask
+{
+ public class ShellTask : ITask
+ {
+ [Inject]
+ public ShellTask([Parameter(Value = typeof(Command))] string command)
+ {
+ Cmd = command;
+ }
+
+ public string Cmd { get; set; }
+
+ public byte[] Call(byte[] memento)
+ {
+ return Encoding.UTF8.GetBytes(CommandLineExecute(Cmd));
+ }
+
+ public void Dispose()
+ {
+ }
+
+ private string CommandLineExecute(string command)
+ {
+ string output = string.Empty;
+ try
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo()
+ {
+ FileName = "cmd.exe",
+ Arguments = @"/c " + command,
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true
+ };
+
+ using (Process process = Process.Start(startInfo))
+ {
+ StringBuilder standardOutput = new StringBuilder();
+
+ process.WaitForExit(1000);
+
+ standardOutput.Append(process.StandardOutput.ReadToEnd());
+ output = standardOutput.ToString();
+ }
+ }
+ catch (Exception e)
+ {
+ output = string.Format(CultureInfo.InvariantCulture, "Failed to execute command [{0}] and capture the output, exception {1} with message {2} ", command, e, e.Message);
+ Exceptions.Caught(e, Level.Error, output, Logger.GetLogger(typeof(ShellTask)));
+ }
+
+ return output;
+ }
+
+ [NamedParameter("Shell Command", "cmd", "")]
+ public class Command : Name<string>
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask1.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask1.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask1.cs
new file mode 100644
index 0000000..f35bf91
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask1.cs
@@ -0,0 +1,67 @@
+/**
+ * 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.Threading;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+
+namespace Org.Apache.REEF.Examples.Tasks.StreamingTasks
+{
+ public class StreamTask1 : ITask
+ {
+ private string _ipAddress;
+
+ [Inject]
+ public StreamTask1([Parameter(typeof(IpAddress))] string ipAddress)
+ {
+ this._ipAddress = ipAddress;
+ }
+
+ [Inject]
+ public StreamTask1()
+ {
+ }
+
+ public byte[] Call(byte[] memento)
+ {
+ System.Console.WriteLine("Hello, Streaming 1!!, Ip: " + _ipAddress);
+
+ Thread.Sleep(10000);
+
+ SIFirstNode();
+
+ return null;
+ }
+
+ public void Dispose()
+ {
+ }
+
+ public void SIFirstNode()
+ {
+ //var a = new SIFirstNodeXAM();
+ //a.Process(1111, 2222, ipAddress);
+ }
+
+ [NamedParameter("Ip Address", "IP", "10.121.32.158")]
+ public class IpAddress : Name<string>
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask2.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask2.cs b/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask2.cs
new file mode 100644
index 0000000..16ccfcc
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/Tasks/StreamingTasks/StreamTask2.cs
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tasks;
+
+namespace Org.Apache.REEF.Examples.Tasks.StreamingTasks
+{
+ public class StreamTask2 : ITask
+ {
+ [Inject]
+ public StreamTask2()
+ {
+ }
+
+ public byte[] Call(byte[] memento)
+ {
+ System.Console.WriteLine("Hello, Streaming 2!!");
+
+ SISecondNode();
+
+ return null;
+ }
+
+ public void Dispose()
+ {
+ }
+
+ public void SISecondNode()
+ {
+ //var a = new SISecondNodeXAM();
+ //a.Process(2222, 1111);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Tang.Examples/FileNames.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/FileNames.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/FileNames.cs
index 21517ea..0263a66 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Examples/FileNames.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Examples/FileNames.cs
@@ -29,7 +29,7 @@ namespace Org.Apache.REEF.Tang.Examples
{
public static string Examples = @"Org.Apache.REEF.Tang.Examples";
public static string Common = @"Org.Apache.REEF.Common";
- public static string Tasks = @"Org.Apache.REEF.Examples.Tasks";
+ public static string Tasks = @"Org.Apache.REEF.Examples";
public static string Seconds = "Org.Apache.REEF.Tang.Examples.Timer+Seconds";
public static string Timer = "Org.Apache.REEF.Tang.Examples.Timer";
public static string B = "Org.Apache.REEF.Tang.Examples.B";
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj b/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj
index 7275852..3a52856 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Org.Apache.REEF.Tang.Tests.csproj
@@ -167,9 +167,9 @@ under the License.
<Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
<Name>Org.Apache.REEF.Common</Name>
</ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj">
+ <ProjectReference Include="..\Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj">
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
- <Name>Org.Apache.REEF.Examples.Tasks</Name>
+ <Name>Org.Apache.REEF.Examples</Name>
</ProjectReference>
<ProjectReference Include="..\Org.Apache.REEF.Tang.Examples\Org.Apache.REEF.Tang.Examples.csproj">
<Project>{711b7f32-196e-4c21-9dbd-ad59c4a7cf77}</Project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Tang.Tools/Org.Apache.REEF.Tang.Tools.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tools/Org.Apache.REEF.Tang.Tools.csproj b/lang/cs/Org.Apache.REEF.Tang.Tools/Org.Apache.REEF.Tang.Tools.csproj
index 7e15775..aaff14b 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tools/Org.Apache.REEF.Tang.Tools.csproj
+++ b/lang/cs/Org.Apache.REEF.Tang.Tools/Org.Apache.REEF.Tang.Tools.csproj
@@ -99,9 +99,9 @@ under the License.
<Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
<Name>Org.Apache.REEF.Driver</Name>
</ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj">
+ <ProjectReference Include="..\Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj">
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
- <Name>Org.Apache.REEF.Examples.Tasks</Name>
+ <Name>Org.Apache.REEF.Examples</Name>
</ProjectReference>
<ProjectReference Include="..\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
<Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
index 83fc29b..f8b4385 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
+++ b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
@@ -160,17 +160,9 @@ under the License.
<Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
<Name>Org.Apache.REEF.Evaluator</Name>
</ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.HelloCLRBridge\Org.Apache.REEF.Examples.HelloCLRBridge.csproj">
- <Project>{a78dd8e8-31d0-4506-8738-daa9da86d55b}</Project>
- <Name>Org.Apache.REEF.Examples.HelloCLRBridge</Name>
- </ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.RetainedEvalCLRBridge\Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj">
- <Project>{05ec65cf-848d-49ab-9e67-57c14ea63044}</Project>
- <Name>Org.Apache.REEF.Examples.RetainedEvalCLRBridge</Name>
- </ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj">
+ <ProjectReference Include="..\Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj">
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
- <Name>Org.Apache.REEF.Examples.Tasks</Name>
+ <Name>Org.Apache.REEF.Examples</Name>
</ProjectReference>
<ProjectReference Include="..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
<Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.sln
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.sln b/lang/cs/Org.Apache.REEF.sln
index 8ab396d..cdd8778 100644
--- a/lang/cs/Org.Apache.REEF.sln
+++ b/lang/cs/Org.Apache.REEF.sln
@@ -32,18 +32,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Evaluator",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Network", "Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj", "{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Examples.RetainedEvalCLRBridge", "Org.Apache.REEF.Examples.RetainedEvalCLRBridge\Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj", "{05EC65CF-848D-49AB-9E67-57C14EA63044}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Examples.HelloCLRBridge", "Org.Apache.REEF.Examples.HelloCLRBridge\Org.Apache.REEF.Examples.HelloCLRBridge.csproj", "{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Examples.Tasks", "Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj", "{75503F90-7B82-4762-9997-94B5C68F15DB}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Client", "Org.Apache.REEF.Client\Org.Apache.REEF.Client.csproj", "{5094C35B-4FDB-4322-AC05-45D684501CBF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Tests", "Org.Apache.REEF.Tests\Org.Apache.REEF.Tests.csproj", "{988F90CF-A48D-4938-A4D2-FA3B758FB5A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.All", "Org.Apache.REEF.All\Org.Apache.REEF.All.csproj", "{4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Examples", "Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj", "{75503F90-7B82-4762-9997-94B5C68F15DB}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -140,30 +136,6 @@ Global
{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|Any CPU.Build.0 = Release|Any CPU
{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|x64.ActiveCfg = Release|x64
{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|x64.Build.0 = Release|x64
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Debug|x64.ActiveCfg = Debug|x64
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Debug|x64.Build.0 = Debug|x64
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Release|Any CPU.Build.0 = Release|Any CPU
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Release|x64.ActiveCfg = Release|x64
- {05EC65CF-848D-49AB-9E67-57C14EA63044}.Release|x64.Build.0 = Release|x64
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|x64.ActiveCfg = Debug|x64
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|x64.Build.0 = Debug|x64
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Release|Any CPU.Build.0 = Release|Any CPU
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Release|x64.ActiveCfg = Release|x64
- {A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Release|x64.Build.0 = Release|x64
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|x64.ActiveCfg = Debug|x64
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|x64.Build.0 = Debug|x64
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|Any CPU.Build.0 = Release|Any CPU
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|x64.ActiveCfg = Release|x64
- {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|x64.Build.0 = Release|x64
{5094C35B-4FDB-4322-AC05-45D684501CBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5094C35B-4FDB-4322-AC05-45D684501CBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5094C35B-4FDB-4322-AC05-45D684501CBF}.Debug|x64.ActiveCfg = Debug|x64
@@ -188,6 +160,14 @@ Global
{4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}.Release|Any CPU.Build.0 = Release|Any CPU
{4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}.Release|x64.ActiveCfg = Release|x64
{4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}.Release|x64.Build.0 = Release|x64
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|x64.ActiveCfg = Debug|x64
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|x64.Build.0 = Debug|x64
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|x64.ActiveCfg = Release|x64
+ {75503F90-7B82-4762-9997-94B5C68F15DB}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/pom.xml
----------------------------------------------------------------------
diff --git a/lang/cs/pom.xml b/lang/cs/pom.xml
index 70251fd..9faa604 100644
--- a/lang/cs/pom.xml
+++ b/lang/cs/pom.xml
@@ -47,7 +47,7 @@ under the License.
<configuration>
<arguments>
<argument>
- ${project.basedir}/ReefDotNet.sln
+ ${project.basedir}/Org.Apache.REEF.sln
</argument>
<argument>/p:Configuration="Release"</argument>
<argument>/p:Platform="x64"</argument>
@@ -64,7 +64,7 @@ under the License.
<configuration>
<arguments>
<argument>
- ${project.basedir}/ReefDotNet.sln
+ ${project.basedir}/Org.Apache.REEF.sln
</argument>
<argument>/p:Configuration="Release"</argument>
<argument>/p:Platform="x64"</argument>
[2/3] incubator-reef git commit: [REEF-143] Refactor REEF.Examples
into one project This is to consolidate all reef examples into one project
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Properties/AssemblyInfo.cs
deleted file mode 100644
index 946ee33..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Properties/AssemblyInfo.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 System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Org.Apache.REEF.Examples.RetainedEvalCLRBridge")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Org.Apache.REEF.Examples.RetainedEvalCLRBridge")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("636170aa-ea18-45bf-b345-83dae7fb6a03")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalActiveContextHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalActiveContextHandler.cs b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalActiveContextHandler.cs
deleted file mode 100644
index 8bcd5c6..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalActiveContextHandler.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.Tang.Implementations.Tang;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tang.Util;
-using Org.Apache.REEF.Tasks;
-using System;
-using Org.Apache.REEF.Examples.Tasks.ShellTask;
-
-namespace Org.Apache.REEF.Examples.RetainedCLREvalBridge.Handler
-{
- public class RetainedEvalActiveContextHandler : IObserver<IActiveContext>
- {
- public void OnNext(IActiveContext activeContext)
- {
- ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
- cb.AddConfiguration(TaskConfiguration.ConfigurationModule
- .Set(TaskConfiguration.Identifier, "bridgeCLRShellTask_" + DateTime.Now.Ticks)
- .Set(TaskConfiguration.Task, GenericType<ShellTask>.Class)
- .Build());
- cb.BindNamedParameter<ShellTask.Command, string>(GenericType<ShellTask.Command>.Class, "echo");
-
- IConfiguration taskConfiguration = cb.Build();
-
- activeContext.SubmitTask(taskConfiguration);
- }
-
- 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalAllocatedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalAllocatedEvaluatorHandler.cs
deleted file mode 100644
index d4379c3..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalAllocatedEvaluatorHandler.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.Driver.Context;
-using Org.Apache.REEF.Driver.Evaluator;
-using Org.Apache.REEF.Tang.Interface;
-using System;
-
-namespace Org.Apache.REEF.Examples.RetainedCLREvalBridge.Handler
-{
- public class RetainedEvalAllocatedEvaluatorHandler : IObserver<IAllocatedEvaluator>
- {
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
-
- public void OnNext(IAllocatedEvaluator allocatedEvaluator)
- {
- IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule
- .Set(ContextConfiguration.Identifier, "RetainedEvalCLRBridgeContextId")
- .Build();
-
- allocatedEvaluator.SubmitContext(contextConfiguration);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalEvaluatorRequestorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalEvaluatorRequestorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalEvaluatorRequestorHandler.cs
deleted file mode 100644
index b4d5084..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalEvaluatorRequestorHandler.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.Driver.Bridge;
-using Org.Apache.REEF.Driver.Evaluator;
-using System;
-
-namespace Org.Apache.REEF.Examples.RetainedCLREvalBridge.Handler
-{
- public class RetainedEvalEvaluatorRequestorHandler : IObserver<IEvaluatorRequestor>
- {
- public void OnNext(IEvaluatorRequestor requestor)
- {
- int evaluatorsNumber = 1;
- int memory = 512;
- string rack = "WonderlandRack";
- EvaluatorRequest request = new EvaluatorRequest(evaluatorsNumber, memory, rack);
-
- requestor.Submit(request);
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalStartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalStartHandler.cs b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalStartHandler.cs
deleted file mode 100644
index 97a3645..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalStartHandler.cs
+++ /dev/null
@@ -1,90 +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;
-using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.Driver.Context;
-using Org.Apache.REEF.Driver.Evaluator;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Tang.Annotations;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Org.Apache.REEF.Examples.RetainedCLREvalBridge.Handler;
-using Org.Apache.REEF.Examples.Tasks.ShellTask;
-
-namespace Org.Apache.REEF.Examples.RetainedCLREvalBridge.Handler
-{
- public class RetainedEvalStartHandler : IStartHandler
- {
- private static ClrSystemHandler<IEvaluatorRequestor> _evaluatorRequestorHandler;
- private static ClrSystemHandler<IAllocatedEvaluator> _allocatedEvaluatorHandler;
- private static ClrSystemHandler<IActiveContext> _activeContextHandler;
-
- [Inject]
- public RetainedEvalStartHandler()
- {
- CreateClassHierarchy();
- Identifier = "RetainedEvalStartHandler";
- }
-
- public RetainedEvalStartHandler(string id)
- {
- Identifier = id;
- CreateClassHierarchy();
- }
-
- public string Identifier { get; set; }
-
- public IList<ulong> GetHandlers()
- {
- ulong[] handlers = Enumerable.Repeat(Constants.NullHandler, Constants.HandlersNumber).ToArray();
-
- // initiate Evaluator Requestor handler
- _evaluatorRequestorHandler = new ClrSystemHandler<IEvaluatorRequestor>();
- handlers[Constants.Handlers[Constants.EvaluatorRequestorHandler]] = ClrHandlerHelper.CreateHandler(_evaluatorRequestorHandler);
- Console.WriteLine("_evaluatorRequestorHandler initiated");
- _evaluatorRequestorHandler.Subscribe(new RetainedEvalEvaluatorRequestorHandler());
-
- // initiate Allocated Evaluator handler
- _allocatedEvaluatorHandler = new ClrSystemHandler<IAllocatedEvaluator>();
- handlers[Constants.Handlers[Constants.AllocatedEvaluatorHandler]] = ClrHandlerHelper.CreateHandler(_allocatedEvaluatorHandler);
- Console.WriteLine("_allocatedEvaluatorHandler initiated");
- _allocatedEvaluatorHandler.Subscribe(new RetainedEvalAllocatedEvaluatorHandler());
-
- // initiate Active Context handler
- _activeContextHandler = new ClrSystemHandler<IActiveContext>();
- handlers[Constants.Handlers[Constants.ActiveContextHandler]] = ClrHandlerHelper.CreateHandler(_activeContextHandler);
- Console.WriteLine("_activeContextHandler initiated");
- _activeContextHandler.Subscribe(new RetainedEvalActiveContextHandler());
-
- return handlers;
- }
-
- private void CreateClassHierarchy()
- {
- HashSet<string> clrDlls = new HashSet<string>();
- clrDlls.Add(typeof(IDriver).Assembly.GetName().Name);
- clrDlls.Add(typeof(ITask).Assembly.GetName().Name);
- clrDlls.Add(typeof(ShellTask).Assembly.GetName().Name);
-
- ClrHandlerHelper.GenerateClassHierarchy(clrDlls);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/FailedTask/FailedTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/FailedTask/FailedTask.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/FailedTask/FailedTask.cs
deleted file mode 100644
index aa489ce..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/FailedTask/FailedTask.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 System;
-using System.Threading;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tasks;
-
-namespace Org.Apache.REEF.Examples.Tasks.FailedTask
-{
- public class FailedTask : ITask
- {
- [Inject]
- public FailedTask()
- {
- }
-
- public byte[] Call(byte[] memento)
- {
- Console.WriteLine("I am about to fail.");
- Thread.Sleep(2 * 1000);
- throw new ApplicationException("bite me.");
- }
-
- public void Dispose()
- {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloService.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloService.cs
deleted file mode 100644
index e7734c1..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloService.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Collections.Generic;
-using Org.Apache.REEF.Services;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.Tasks.HelloTask
-{
- public class HelloService : IService
- {
- private IList<string> _guests;
-
- [Inject]
- public HelloService()
- {
- if (_guests == null)
- {
- _guests = new List<string>();
- _guests.Add("MR.SMITH");
- }
- }
-
- public IList<string> Guests
- {
- get
- {
- return _guests;
- }
- }
-
- public void AddGuest(string guestName)
- {
- if (string.IsNullOrWhiteSpace(guestName))
- {
- throw new ArgumentException("can't do with empty name.");
- }
- Guests.Add(guestName);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTask.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTask.cs
deleted file mode 100644
index f832d50..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTask.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Linq;
-using System.Net;
-using System.Threading;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Tasks.Events;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Utilities.Logging;
-
-namespace Org.Apache.REEF.Examples.Tasks.HelloTask
-{
- public class HelloTask : ITask
- {
- private static readonly Logger LOGGER = Logger.GetLogger(typeof(HelloTask));
-
- private INameClient _nameClient = null;
-
- [Inject]
- public HelloTask()
- {
- Console.WriteLine("HelloTask constructor 0");
- }
-
- [Inject]
- public HelloTask(HelloService service, INameClient nameClient)
- {
- Console.WriteLine("HelloTask constructor 2");
- Service = service;
- _nameClient = nameClient;
- }
-
- [Inject]
- public HelloTask(HelloService service)
- {
- Console.WriteLine("HelloTask constructor 1");
- Service = service;
- }
-
- public HelloService Service { get; set; }
-
- public byte[] Call(byte[] memento)
- {
- Console.WriteLine("Hello, CLR REEF!");
- if (_nameClient != null)
- {
- _nameClient.Register("abc", new IPEndPoint(IPAddress.Any, 8080));
- Console.WriteLine("IP Address: {0}", _nameClient.Lookup("abc"));
- }
- PrintGuestList();
- Thread.Sleep(5 * 1000);
- Console.WriteLine("Bye, CLR REEF!");
-
- return null;
- }
-
- public void Dispose()
- {
- LOGGER.Log(Level.Info, "Hello task disposed.");
- }
-
- private void HandleDriverMessage(string message)
- {
- using (LOGGER.LogFunction("HelloTask::HandleDriverMessage"))
- {
- LOGGER.Log(Level.Info, "I handle message by logging : " + message);
- }
- }
-
- private void PrintGuestList()
- {
- if (Service == null || !Service.Guests.Any())
- {
- Console.WriteLine("No service provided.");
- }
- else
- {
- Console.WriteLine("Serving guest: " + string.Join(";", Service.Guests));
- }
- }
-
- public class HelloDriverMessageHandler : IDriverMessageHandler
- {
- private HelloTask _parentTask;
-
- [Inject]
- public HelloDriverMessageHandler(HelloTask task)
- {
- _parentTask = task;
- }
-
- public void Handle(IDriverMessage value)
- {
- string message = string.Empty;
- LOGGER.Log(Level.Verbose, "Receieved a message from driver, handling it with HelloDriverMessageHandler");
- if (value.Message.IsPresent())
- {
- message = ByteUtilities.ByteArrarysToString(value.Message.Value);
- }
- _parentTask.HandleDriverMessage(message);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTaskMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTaskMessage.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTaskMessage.cs
deleted file mode 100644
index 4814e0e..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/HelloTask/HelloTaskMessage.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Globalization;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities;
-
-namespace Org.Apache.REEF.Examples.Tasks.HelloTask
-{
- public class HelloTaskMessage : ITaskMessageSource
- {
- [Inject]
- public HelloTaskMessage()
- {
- }
-
- public Optional<TaskMessage> Message
- {
- get
- {
- TaskMessage defaultTaskMessage = TaskMessage.From(
- "helloSourceId",
- ByteUtilities.StringToByteArrays("hello message generated at " + DateTime.Now.ToString(CultureInfo.InvariantCulture)));
- return Optional<TaskMessage>.Of(defaultTaskMessage);
- }
-
- set
- {
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/Org.Apache.REEF.Examples.Tasks.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/Org.Apache.REEF.Examples.Tasks.csproj b/lang/cs/Org.Apache.REEF.Examples.Tasks/Org.Apache.REEF.Examples.Tasks.csproj
deleted file mode 100644
index 333e2b7..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/Org.Apache.REEF.Examples.Tasks.csproj
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{75503F90-7B82-4762-9997-94B5C68F15DB}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Org.Apache.REEF.Examples.Tasks</RootNamespace>
- <AssemblyName>Org.Apache.REEF.Examples.Tasks</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <RestorePackages>true</RestorePackages>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- </PropertyGroup>
- <Import Project="$(SolutionDir)\build.props" />
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="FailedTask\FailedTask.cs" />
- <Compile Include="HelloTask\HelloService.cs" />
- <Compile Include="HelloTask\HelloTask.cs" />
- <Compile Include="HelloTask\HelloTaskMessage.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="ShellTask\ShellTask.cs" />
- <Compile Include="StreamingTasks\StreamTask1.cs" />
- <Compile Include="StreamingTasks\StreamTask2.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
- <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Org.Apache.REEF.Tang</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
- <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
- <Name>Org.Apache.REEF.Utilities</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
- <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>Org.Apache.REEF.Common</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
- <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>Org.Apache.REEF.Driver</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4a41805..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/Properties/AssemblyInfo.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 System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Tasks")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Tasks")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b9e219f1-a02c-468c-ab26-3ef5c91310f7")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/ShellTask/ShellTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/ShellTask/ShellTask.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/ShellTask/ShellTask.cs
deleted file mode 100644
index 7bc90d5..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/ShellTask/ShellTask.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Text;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities.Diagnostics;
-using Org.Apache.REEF.Utilities.Logging;
-
-[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "allow name parameter class to be embedded")]
-
-namespace Org.Apache.REEF.Examples.Tasks.ShellTask
-{
- public class ShellTask : ITask
- {
- [Inject]
- public ShellTask([Parameter(Value = typeof(Command))] string command)
- {
- Cmd = command;
- }
-
- public string Cmd { get; set; }
-
- public byte[] Call(byte[] memento)
- {
- return Encoding.UTF8.GetBytes(CommandLineExecute(Cmd));
- }
-
- public void Dispose()
- {
- }
-
- private string CommandLineExecute(string command)
- {
- string output = string.Empty;
- try
- {
- ProcessStartInfo startInfo = new ProcessStartInfo()
- {
- FileName = "cmd.exe",
- Arguments = @"/c " + command,
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true
- };
-
- using (Process process = Process.Start(startInfo))
- {
- StringBuilder standardOutput = new StringBuilder();
-
- process.WaitForExit(1000);
-
- standardOutput.Append(process.StandardOutput.ReadToEnd());
- output = standardOutput.ToString();
- }
- }
- catch (Exception e)
- {
- output = string.Format(CultureInfo.InvariantCulture, "Failed to execute command [{0}] and capture the output, exception {1} with message {2} ", command, e, e.Message);
- Exceptions.Caught(e, Level.Error, output, Logger.GetLogger(typeof(ShellTask)));
- }
-
- return output;
- }
-
- [NamedParameter("Shell Command", "cmd", "")]
- public class Command : Name<string>
- {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask1.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask1.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask1.cs
deleted file mode 100644
index f35bf91..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask1.cs
+++ /dev/null
@@ -1,67 +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.Threading;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tasks;
-
-namespace Org.Apache.REEF.Examples.Tasks.StreamingTasks
-{
- public class StreamTask1 : ITask
- {
- private string _ipAddress;
-
- [Inject]
- public StreamTask1([Parameter(typeof(IpAddress))] string ipAddress)
- {
- this._ipAddress = ipAddress;
- }
-
- [Inject]
- public StreamTask1()
- {
- }
-
- public byte[] Call(byte[] memento)
- {
- System.Console.WriteLine("Hello, Streaming 1!!, Ip: " + _ipAddress);
-
- Thread.Sleep(10000);
-
- SIFirstNode();
-
- return null;
- }
-
- public void Dispose()
- {
- }
-
- public void SIFirstNode()
- {
- //var a = new SIFirstNodeXAM();
- //a.Process(1111, 2222, ipAddress);
- }
-
- [NamedParameter("Ip Address", "IP", "10.121.32.158")]
- public class IpAddress : Name<string>
- {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask2.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask2.cs b/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask2.cs
deleted file mode 100644
index 16ccfcc..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.Tasks/StreamingTasks/StreamTask2.cs
+++ /dev/null
@@ -1,51 +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.Tang.Annotations;
-using Org.Apache.REEF.Tasks;
-
-namespace Org.Apache.REEF.Examples.Tasks.StreamingTasks
-{
- public class StreamTask2 : ITask
- {
- [Inject]
- public StreamTask2()
- {
- }
-
- public byte[] Call(byte[] memento)
- {
- System.Console.WriteLine("Hello, Streaming 2!!");
-
- SISecondNode();
-
- return null;
- }
-
- public void Dispose()
- {
- }
-
- public void SISecondNode()
- {
- //var a = new SISecondNodeXAM();
- //a.Process(2222, 1111);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/AnotherHelloAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/AnotherHelloAllocatedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/AnotherHelloAllocatedEvaluatorHandler.cs
new file mode 100644
index 0000000..3a1e847
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/AnotherHelloAllocatedEvaluatorHandler.cs
@@ -0,0 +1,48 @@
+/**
+ * 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.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class AnotherHelloAllocatedEvaluatorHandler : IObserver<IAllocatedEvaluator>
+ {
+ [Inject]
+ public AnotherHelloAllocatedEvaluatorHandler()
+ {
+ }
+
+ public void OnNext(IAllocatedEvaluator allocatedEvaluator)
+ {
+ Console.WriteLine("I am just here for the ride.");
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloActiveContextHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloActiveContextHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloActiveContextHandler.cs
new file mode 100644
index 0000000..d18ae44
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloActiveContextHandler.cs
@@ -0,0 +1,83 @@
+/**
+ * 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.Tasks;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+using System;
+using System.Globalization;
+using Org.Apache.REEF.Examples.Tasks.HelloTask;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloActiveContextHandler : IObserver<IActiveContext>
+ {
+ [Inject]
+ public HelloActiveContextHandler()
+ {
+ }
+
+ public void OnNext(IActiveContext activeContext)
+ {
+ Console.WriteLine(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Active context {0} received from evaluator {1}",
+ activeContext.Id,
+ activeContext.EvaluatorId));
+
+ IEvaluatorDescriptor evaluatorDescriptor = activeContext.EvaluatorDescriptor;
+ string ipAddress = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Address.ToString();
+ int port = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Port;
+ string hostName = evaluatorDescriptor.NodeDescriptor.HostName;
+
+ Console.WriteLine(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "The running evaluator is assigned with {0} MB of memory and is running at ip: {1} and port {2}, with hostname {3}",
+ evaluatorDescriptor.Memory,
+ ipAddress,
+ port,
+ hostName));
+
+ IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
+ .Set(TaskConfiguration.Identifier, "bridgeCLRHelloTask_" + DateTime.Now.Ticks)
+ .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class)
+ .Set(TaskConfiguration.OnMessage, GenericType<HelloTask.HelloDriverMessageHandler>.Class)
+ .Set(TaskConfiguration.OnSendMessage, GenericType<HelloTaskMessage>.Class)
+ .Build();
+
+ activeContext.SubmitTask(taskConfiguration);
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloAllocatedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloAllocatedEvaluatorHandler.cs
new file mode 100644
index 0000000..c07f809
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloAllocatedEvaluatorHandler.cs
@@ -0,0 +1,132 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Services;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Implementations.Configuration;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+using Org.Apache.REEF.Examples.Tasks.HelloTask;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloAllocatedEvaluatorHandler : IObserver<IAllocatedEvaluator>
+ {
+ [Inject]
+ public HelloAllocatedEvaluatorHandler()
+ {
+ }
+
+ public void OnNext(IAllocatedEvaluator allocatedEvaluator)
+ {
+ string control = string.Empty;
+
+ ISet<string> arguments = ClrHandlerHelper.GetCommandLineArguments();
+
+ if (arguments != null && arguments.Any())
+ {
+ foreach (string argument in arguments)
+ {
+ Console.WriteLine("testing argument: " + argument);
+ }
+
+ control = arguments.Last();
+ }
+
+ IEvaluatorDescriptor descriptor = allocatedEvaluator.GetEvaluatorDescriptor();
+
+ IConfiguration serviceConfiguration = ServiceConfiguration.ConfigurationModule
+ .Set(ServiceConfiguration.Services, GenericType<HelloService>.Class)
+ .Build();
+
+ IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule
+ .Set(ContextConfiguration.Identifier, "bridgeHelloCLRContextId_" + Guid.NewGuid().ToString("N"))
+ .Build();
+
+ IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
+ .Set(TaskConfiguration.Identifier, "bridgeHelloCLRTaskId_" + Guid.NewGuid().ToString("N"))
+ .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class)
+ .Set(TaskConfiguration.OnMessage, GenericType<HelloTask.HelloDriverMessageHandler>.Class)
+ .Set(TaskConfiguration.OnSendMessage, GenericType<HelloTaskMessage>.Class)
+ .Build();
+
+ IConfiguration mergedTaskConfiguration = taskConfiguration;
+
+ if (allocatedEvaluator.NameServerInfo != null)
+ {
+ IPEndPoint nameServerEndpoint = NetUtilities.ParseIpEndpoint(allocatedEvaluator.NameServerInfo);
+
+ IConfiguration nameClientConfiguration = TangFactory.GetTang().NewConfigurationBuilder(
+ NamingConfiguration.ConfigurationModule
+ .Set(NamingConfiguration.NameServerAddress, nameServerEndpoint.Address.ToString())
+ .Set(NamingConfiguration.NameServerPort,
+ nameServerEndpoint.Port.ToString(CultureInfo.InvariantCulture))
+ .Build())
+ .BindImplementation(GenericType<INameClient>.Class,
+ GenericType<NameClient>.Class)
+ .Build();
+
+ mergedTaskConfiguration = Configurations.Merge(taskConfiguration, nameClientConfiguration);
+ }
+
+ string ipAddress = descriptor.NodeDescriptor.InetSocketAddress.Address.ToString();
+ int port = descriptor.NodeDescriptor.InetSocketAddress.Port;
+ string hostName = descriptor.NodeDescriptor.HostName;
+ Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Alloated evaluator {0} with ip {1}:{2}. Hostname is {3}", allocatedEvaluator.Id, ipAddress, port, hostName));
+ Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Evaluator is assigned with {0} MB of memory and {1} cores.", descriptor.Memory, descriptor.VirtualCore));
+
+ if (control.Equals("submitContext", StringComparison.OrdinalIgnoreCase))
+ {
+ allocatedEvaluator.SubmitContext(contextConfiguration);
+ }
+ else if (control.Equals("submitContextAndServiceAndTask", StringComparison.OrdinalIgnoreCase))
+ {
+ allocatedEvaluator.SubmitContextAndServiceAndTask(contextConfiguration, serviceConfiguration, mergedTaskConfiguration);
+ }
+ else
+ {
+ // default behavior
+ allocatedEvaluator.SubmitContextAndTask(contextConfiguration, mergedTaskConfiguration);
+ }
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloCompletedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloCompletedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloCompletedEvaluatorHandler.cs
new file mode 100644
index 0000000..7c4f650
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloCompletedEvaluatorHandler.cs
@@ -0,0 +1,59 @@
+/**
+ * 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.Driver.Task;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+using System.Globalization;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ /// <summary>
+ /// Sample implementaion of RunningTaskHandler
+ /// </summary>
+ public class HelloCompletedEvaluatorHandler : IObserver<ICompletedEvaluator>
+ {
+ [Inject]
+ public HelloCompletedEvaluatorHandler()
+ {
+ }
+
+ public void OnNext(ICompletedEvaluator completedEvaluator)
+ {
+ string messageStr = string.Format(
+ CultureInfo.InvariantCulture,
+ "HelloCompletedEvaluatorHandler: Evaluator [{0}] is done.",
+ completedEvaluator.Id);
+ Console.WriteLine(messageStr);
+ }
+
+ 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartActiveContextHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartActiveContextHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartActiveContextHandler.cs
new file mode 100644
index 0000000..9494f96
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartActiveContextHandler.cs
@@ -0,0 +1,69 @@
+/**
+ * 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.Tang.Annotations;
+using System;
+using System.Globalization;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloDriverRestartActiveContextHandler : IObserver<IActiveContext>
+ {
+ [Inject]
+ public HelloDriverRestartActiveContextHandler()
+ {
+ }
+
+ public void OnNext(IActiveContext activeContext)
+ {
+ Console.WriteLine(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Active context {0} received after driver restart, from evaluator {1}",
+ activeContext.Id,
+ activeContext.EvaluatorId));
+
+ IEvaluatorDescriptor evaluatorDescriptor = activeContext.EvaluatorDescriptor;
+ string ipAddress = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Address.ToString();
+ int port = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Port;
+ string hostName = evaluatorDescriptor.NodeDescriptor.HostName;
+
+ Console.WriteLine(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "The running evaluator allocated by previous driver is assigned with {0} MB of memory and is running at ip: {1} and port {2}, with hostname {3}",
+ evaluatorDescriptor.Memory,
+ ipAddress,
+ port,
+ hostName));
+ }
+
+ 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartRunningTaskHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartRunningTaskHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartRunningTaskHandler.cs
new file mode 100644
index 0000000..d2d30cf
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloDriverRestartRunningTaskHandler.cs
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Globalization;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ /// <summary>
+ /// Sample implementaion of RunningTaskHandler
+ /// </summary>
+ public class HelloDriverRestartRunningTaskHandler : IObserver<IRunningTask>
+ {
+ [Inject]
+ public HelloDriverRestartRunningTaskHandler()
+ {
+ }
+
+ public void OnNext(IRunningTask runningTask)
+ {
+ IActiveContext context = runningTask.ActiveContext;
+
+ Console.WriteLine(string.Format(
+ CultureInfo.InvariantCulture,
+ "HelloDriverRestartRunningTaskHandler: Task [{0}] is running after driver restart. Evaluator id: [{1}].",
+ runningTask.Id,
+ context.EvaluatorId));
+
+ runningTask.Send(ByteUtilities.StringToByteArrays(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Hello, task {0}! Glad to know that you are still running in Evaluator {1} after driver restart!",
+ runningTask.Id,
+ context.EvaluatorId)));
+ }
+
+ 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloEvaluatorRequestorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloEvaluatorRequestorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloEvaluatorRequestorHandler.cs
new file mode 100644
index 0000000..4f24e0f
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloEvaluatorRequestorHandler.cs
@@ -0,0 +1,65 @@
+/**
+ * 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.Bridge;
+using Org.Apache.REEF.Driver.Evaluator;
+using System;
+
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloEvaluatorRequestorHandler : IObserver<IEvaluatorRequestor>
+ {
+ [Inject]
+ public HelloEvaluatorRequestorHandler()
+ {
+ }
+
+ public void OnNext(IEvaluatorRequestor evalutorRequestor)
+ {
+ int evaluatorsNumber = 1;
+ int memory = 512;
+ int core = 2;
+ string rack = "WonderlandRack";
+ string evaluatorBatchId = "evaluatorThatRequires512MBofMemory";
+ EvaluatorRequest request = new EvaluatorRequest(evaluatorsNumber, memory, core, rack, evaluatorBatchId);
+
+ evalutorRequestor.Submit(request);
+
+ evaluatorsNumber = 1;
+ memory = 1999;
+ core = 2;
+ rack = "WonderlandRack";
+ evaluatorBatchId = "evaluatorThatRequires1999MBofMemory";
+ request = new EvaluatorRequest(evaluatorsNumber, memory, core, rack, evaluatorBatchId);
+ evalutorRequestor.Submit(request);
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedEvaluatorHandler.cs
new file mode 100644
index 0000000..e9aa232
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedEvaluatorHandler.cs
@@ -0,0 +1,68 @@
+/**
+ * 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.Bridge;
+using Org.Apache.REEF.Driver.Evaluator;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloFailedEvaluatorHandler : IObserver<IFailedEvaluator>
+ {
+ private static int _failureCount = 0;
+
+ private static int _maxTrial = 2;
+
+ [Inject]
+ public HelloFailedEvaluatorHandler()
+ {
+ }
+
+ public void OnNext(IFailedEvaluator failedEvaluator)
+ {
+ Console.WriteLine("Receive a failed evaluator: " + failedEvaluator.Id);
+ if (++_failureCount < _maxTrial)
+ {
+ Console.WriteLine("Requesting another evaluator");
+ EvaluatorRequest newRequest = new EvaluatorRequest(1, 512, "somerack");
+ IEvaluatorRequestor requestor = failedEvaluator.GetEvaluatorRequetor();
+ if (failedEvaluator.GetEvaluatorRequetor() != null)
+ {
+ requestor.Submit(newRequest);
+ }
+ }
+ else
+ {
+ Console.WriteLine("Exceed max retries number");
+ throw new Exception("Unrecoverable evaluator failure.");
+ }
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedTaskHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedTaskHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedTaskHandler.cs
new file mode 100644
index 0000000..7618f00
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloFailedTaskHandler.cs
@@ -0,0 +1,67 @@
+/**
+ * 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;
+using Org.Apache.REEF.Tang.Annotations;
+using System;
+using System.Globalization;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloFailedTaskHandler : IObserver<IFailedTask>
+ {
+ [Inject]
+ public HelloFailedTaskHandler()
+ {
+ }
+
+ public void OnNext(IFailedTask failedTask)
+ {
+ string errorMessage = string.Format(
+ CultureInfo.InvariantCulture,
+ "Task [{0}] has failed caused by [{1}], with message [{2}] and description [{3}]. The raw data for failure is [{4}].",
+ failedTask.Id,
+ failedTask.Reason.IsPresent() ? failedTask.Reason.Value : string.Empty,
+ failedTask.Message,
+ failedTask.Description.IsPresent() ? failedTask.Description.Value : string.Empty,
+ failedTask.Data.IsPresent() ? ByteUtilities.ByteArrarysToString(failedTask.Data.Value) : string.Empty);
+
+ Console.WriteLine(errorMessage);
+
+ if (failedTask.GetActiveContext().IsPresent())
+ {
+ Console.WriteLine("Disposing the active context the failed task ran in.");
+
+ // we must do something here: either close the context or resubmit a task to the active context
+ failedTask.GetActiveContext().Value.Dispose();
+ }
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloHttpHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloHttpHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloHttpHandler.cs
new file mode 100644
index 0000000..e1bf097
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloHttpHandler.cs
@@ -0,0 +1,51 @@
+/**
+ * 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.Globalization;
+using System.Net;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloHttpHandler : IHttpHandler
+ {
+ private static readonly Logger LOGGER = Logger.GetLogger(typeof(HttpServerHandler));
+
+ [Inject]
+ public HelloHttpHandler()
+ {
+ }
+
+ public string GetSpecification()
+ {
+ return "NRT"; //Client Example
+ }
+
+ public void OnHttpRequest(ReefHttpRequest requet, ReefHttpResponse response)
+ {
+ LOGGER.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "HelloHttpHandler OnHttpRequest: URL: {0}, QueryString: {1}, inputStream: {2}.", requet.Url, requet.Querystring, ByteUtilities.ByteArrarysToString(requet.InputStream)));
+ response.Status = HttpStatusCode.OK;
+ response.OutputStream =
+ ByteUtilities.StringToByteArrays("Byte array returned from HelloHttpHandler in CLR!!!");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRestartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRestartHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRestartHandler.cs
new file mode 100644
index 0000000..6e72147
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRestartHandler.cs
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake.Time;
+using System;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ public class HelloRestartHandler : IObserver<StartTime>
+ {
+ [Inject]
+ public HelloRestartHandler()
+ {
+ }
+
+ public void OnNext(StartTime value)
+ {
+ Console.WriteLine("Hello from CLR: we are informed that Driver has restarted at " + new DateTime(value.TimeStamp));
+ }
+
+ 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRunningTaskHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRunningTaskHandler.cs b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRunningTaskHandler.cs
new file mode 100644
index 0000000..07048e4
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Examples/HelloCLRBridge/Handlers/HelloRunningTaskHandler.cs
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System;
+using System.Globalization;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Driver.Task;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
+{
+ /// <summary>
+ /// Sample implementaion of RunningTaskHandler
+ /// </summary>
+ public class HelloRunningTaskHandler : IObserver<IRunningTask>
+ {
+ [Inject]
+ public HelloRunningTaskHandler()
+ {
+ }
+
+ public void OnNext(IRunningTask runningTask)
+ {
+ IActiveContext context = runningTask.ActiveContext;
+
+ string messageStr = string.Format(
+ CultureInfo.InvariantCulture,
+ "HelloRunningTaskHandler: Task [{0}] is running. Evaluator id: [{1}].",
+ runningTask.Id,
+ context.EvaluatorId);
+ Console.WriteLine(messageStr);
+
+ byte[] message = ByteUtilities.StringToByteArrays(messageStr);
+
+ runningTask.Send(message);
+ }
+
+ public void OnError(Exception error)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnCompleted()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
[3/3] incubator-reef git commit: [REEF-143] Refactor REEF.Examples
into one project This is to consolidate all reef examples into one project
Posted by we...@apache.org.
[REEF-143] Refactor REEF.Examples into one project
This is to consolidate all reef examples into one project
* Updated folder structures and name spaces
* Updated references
* Updated pom file for building Org.Apache.REEF
JIRA:
[REEF-143] https://issues.apache.org/jira/browse/REEF-143
Pull Request:
This closes #72
Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/29c56c8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/29c56c8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/29c56c8e
Branch: refs/heads/master
Commit: 29c56c8e640c34ae95b8365b4e5198826e7b307e
Parents: 05766f9
Author: Julia Wang <jw...@yahoo.com>
Authored: Fri Feb 6 16:15:58 2015 -0800
Committer: Markus Weimer <we...@apache.org>
Committed: Fri Feb 6 19:09:24 2015 -0800
----------------------------------------------------------------------
.../Org.Apache.REEF.Client.csproj | 14 +-
.../HelloTraceListener.cs | 48 ---
...g.Apache.REEF.Examples.HelloCLRBridge.csproj | 138 ------
.../Properties/AssemblyInfo.cs | 55 ---
.../AnotherHelloAllocatedEvaluatorHandler.cs | 48 ---
.../handlers/HelloActiveContextHandler.cs | 83 ----
.../handlers/HelloAllocatedEvaluatorHandler.cs | 132 ------
.../handlers/HelloCompletedEvaluatorHandler.cs | 59 ---
.../HelloDriverRestartActiveContextHandler.cs | 69 ---
.../HelloDriverRestartRunningTaskHandler.cs | 67 ---
.../handlers/HelloEvaluatorRequestorHandler.cs | 65 ---
.../handlers/HelloFailedEvaluatorHandler.cs | 68 ---
.../handlers/HelloFailedTaskHandler.cs | 67 ---
.../handlers/HelloHttpHandler.cs | 51 ---
.../handlers/HelloRestartHandler.cs | 48 ---
.../handlers/HelloRunningTaskHandler.cs | 65 ---
.../handlers/HelloSimpleEventHandlers.cs | 422 -------------------
.../handlers/HelloStartHandler.cs | 65 ---
.../handlers/HelloTaskMessageHandler.cs | 54 ---
...e.REEF.Examples.RetainedEvalCLRBridge.csproj | 122 ------
.../Properties/AssemblyInfo.cs | 55 ---
.../handler/RetainedEvalActiveContextHandler.cs | 56 ---
.../RetainedEvalAllocatedEvaluatorHandler.cs | 48 ---
.../RetainedEvalEvaluatorRequestorHandler.cs | 48 ---
.../handler/RetainedEvalStartHandler.cs | 90 ----
.../FailedTask/FailedTask.cs | 45 --
.../HelloTask/HelloService.cs | 58 ---
.../HelloTask/HelloTask.cs | 124 ------
.../HelloTask/HelloTaskMessage.cs | 50 ---
.../Org.Apache.REEF.Examples.Tasks.csproj | 117 -----
.../Properties/AssemblyInfo.cs | 55 ---
.../ShellTask/ShellTask.cs | 91 ----
.../StreamingTasks/StreamTask1.cs | 67 ---
.../StreamingTasks/StreamTask2.cs | 51 ---
.../AnotherHelloAllocatedEvaluatorHandler.cs | 48 +++
.../Handlers/HelloActiveContextHandler.cs | 83 ++++
.../Handlers/HelloAllocatedEvaluatorHandler.cs | 132 ++++++
.../Handlers/HelloCompletedEvaluatorHandler.cs | 59 +++
.../HelloDriverRestartActiveContextHandler.cs | 69 +++
.../HelloDriverRestartRunningTaskHandler.cs | 67 +++
.../Handlers/HelloEvaluatorRequestorHandler.cs | 65 +++
.../Handlers/HelloFailedEvaluatorHandler.cs | 68 +++
.../Handlers/HelloFailedTaskHandler.cs | 67 +++
.../HelloCLRBridge/Handlers/HelloHttpHandler.cs | 51 +++
.../Handlers/HelloRestartHandler.cs | 48 +++
.../Handlers/HelloRunningTaskHandler.cs | 65 +++
.../Handlers/HelloSimpleEventHandlers.cs | 422 +++++++++++++++++++
.../Handlers/HelloStartHandler.cs | 65 +++
.../Handlers/HelloTaskMessageHandler.cs | 54 +++
.../HelloCLRBridge/HelloTraceListener.cs | 48 +++
.../Org.Apache.REEF.Examples.csproj | 145 +++++++
.../Properties/AssemblyInfo.cs | 55 +++
.../RetainedEvalActiveContextHandler.cs | 56 +++
.../RetainedEvalAllocatedEvaluatorHandler.cs | 48 +++
.../RetainedEvalEvaluatorRequestorHandler.cs | 48 +++
.../Handlers/RetainedEvalStartHandler.cs | 89 ++++
.../Tasks/FailedTask/FailedTask.cs | 45 ++
.../Tasks/HelloTask/HelloService.cs | 58 +++
.../Tasks/HelloTask/HelloTask.cs | 124 ++++++
.../Tasks/HelloTask/HelloTaskMessage.cs | 50 +++
.../Tasks/ShellTask/ShellTask.cs | 91 ++++
.../Tasks/StreamingTasks/StreamTask1.cs | 67 +++
.../Tasks/StreamingTasks/StreamTask2.cs | 51 +++
.../Org.Apache.REEF.Tang.Examples/FileNames.cs | 2 +-
.../Org.Apache.REEF.Tang.Tests.csproj | 4 +-
.../Org.Apache.REEF.Tang.Tools.csproj | 4 +-
.../Org.Apache.REEF.Tests.csproj | 12 +-
lang/cs/Org.Apache.REEF.sln | 40 +-
lang/cs/pom.xml | 4 +-
69 files changed, 2360 insertions(+), 2739 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
index b173562..3d26f04 100644
--- a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
+++ b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
@@ -102,10 +102,6 @@ under the License.
<Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
<Name>Org.Apache.REEF.Driver</Name>
</ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj">
- <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
- <Name>Org.Apache.REEF.Examples.Tasks</Name>
- </ProjectReference>
<ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
<Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
<Name>Org.Apache.REEF.Network</Name>
@@ -114,13 +110,9 @@ under the License.
<Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
<Name>Org.Apache.REEF.Wake</Name>
</ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.HelloCLRBridge\Org.Apache.REEF.Examples.HelloCLRBridge.csproj">
- <Project>{a78dd8e8-31d0-4506-8738-daa9da86d55b}</Project>
- <Name>Org.Apache.REEF.Examples.HelloCLRBridge</Name>
- </ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.RetainedEvalCLRBridge\Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj">
- <Project>{05ec65cf-848d-49ab-9e67-57c14ea63044}</Project>
- <Name>Org.Apache.REEF.Examples.RetainedEvalCLRBridge</Name>
+ <ProjectReference Include="..\Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj">
+ <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
+ <Name>Org.Apache.REEF.Examples</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/HelloTraceListener.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/HelloTraceListener.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/HelloTraceListener.cs
deleted file mode 100644
index 88dbe3b..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/HelloTraceListener.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.Tang.Annotations;
-using System.Diagnostics;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge
-{
- /// <summary>
- /// This is a sample implemenation on how custom trace listner can be implemented
- /// </summary>
- public class HelloTraceListener : TraceListener
- {
- private TraceListener _listener;
-
- [Inject]
- public HelloTraceListener()
- {
- _listener = new ConsoleTraceListener();
- }
-
- public override void Write(string message)
- {
- _listener.Write("[helloTrace]" + message );
- }
-
- public override void WriteLine(string message)
- {
- _listener.WriteLine("[helloTrace]" + message);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Org.Apache.REEF.Examples.HelloCLRBridge.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Org.Apache.REEF.Examples.HelloCLRBridge.csproj b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Org.Apache.REEF.Examples.HelloCLRBridge.csproj
deleted file mode 100644
index a9a0471..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Org.Apache.REEF.Examples.HelloCLRBridge.csproj
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Org.Apache.REEF.Examples.HelloCLRBridge</RootNamespace>
- <AssemblyName>Org.Apache.REEF.Examples.HelloCLRBridge</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <RestorePackages>true</RestorePackages>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- </PropertyGroup>
- <Import Project="$(SolutionDir)\build.props" />
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="handlers\AnotherHelloAllocatedEvaluatorHandler.cs" />
- <Compile Include="handlers\HelloActiveContextHandler.cs" />
- <Compile Include="handlers\HelloAllocatedEvaluatorHandler.cs" />
- <Compile Include="handlers\HelloCompletedEvaluatorHandler.cs" />
- <Compile Include="handlers\HelloDriverRestartActiveContextHandler.cs" />
- <Compile Include="handlers\HelloDriverRestartRunningTaskHandler.cs" />
- <Compile Include="handlers\HelloEvaluatorRequestorHandler.cs" />
- <Compile Include="handlers\HelloFailedEvaluatorHandler.cs" />
- <Compile Include="handlers\HelloFailedTaskHandler.cs" />
- <Compile Include="handlers\HelloHttpHandler.cs" />
- <Compile Include="handlers\HelloRestartHandler.cs" />
- <Compile Include="handlers\HelloRunningTaskHandler.cs" />
- <Compile Include="handlers\HelloSimpleEventHandlers.cs" />
- <Compile Include="handlers\HelloStartHandler.cs" />
- <Compile Include="handlers\HelloTaskMessageHandler.cs" />
- <Compile Include="HelloTraceListener.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
- <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Org.Apache.REEF.Tang</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
- <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
- <Name>Org.Apache.REEF.Utilities</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
- <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>Org.Apache.REEF.Common</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
- <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>Org.Apache.REEF.Driver</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
- <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
- <Name>Org.Apache.REEF.Network</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
- <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
- <Name>Org.Apache.REEF.Wake</Name>
- </ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj">
- <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
- <Name>Org.Apache.REEF.Examples.Tasks</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Properties/AssemblyInfo.cs
deleted file mode 100644
index fb84df6..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/Properties/AssemblyInfo.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 System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Org.Apache.REEF.Examples.HelloCLRBridge")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Org.Apache.REEF.Examples.HelloCLRBridge")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("aedd2853-36a1-4a95-ac5c-1535374fa90c")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.cs
deleted file mode 100644
index 3a1e847..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.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.Driver.Evaluator;
-using Org.Apache.REEF.Tang.Annotations;
-using System;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class AnotherHelloAllocatedEvaluatorHandler : IObserver<IAllocatedEvaluator>
- {
- [Inject]
- public AnotherHelloAllocatedEvaluatorHandler()
- {
- }
-
- public void OnNext(IAllocatedEvaluator allocatedEvaluator)
- {
- Console.WriteLine("I am just here for the ride.");
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloActiveContextHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloActiveContextHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloActiveContextHandler.cs
deleted file mode 100644
index d18ae44..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloActiveContextHandler.cs
+++ /dev/null
@@ -1,83 +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.Tasks;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tang.Formats;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tang.Util;
-using System;
-using System.Globalization;
-using Org.Apache.REEF.Examples.Tasks.HelloTask;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloActiveContextHandler : IObserver<IActiveContext>
- {
- [Inject]
- public HelloActiveContextHandler()
- {
- }
-
- public void OnNext(IActiveContext activeContext)
- {
- Console.WriteLine(
- string.Format(
- CultureInfo.InvariantCulture,
- "Active context {0} received from evaluator {1}",
- activeContext.Id,
- activeContext.EvaluatorId));
-
- IEvaluatorDescriptor evaluatorDescriptor = activeContext.EvaluatorDescriptor;
- string ipAddress = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Address.ToString();
- int port = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Port;
- string hostName = evaluatorDescriptor.NodeDescriptor.HostName;
-
- Console.WriteLine(
- string.Format(
- CultureInfo.InvariantCulture,
- "The running evaluator is assigned with {0} MB of memory and is running at ip: {1} and port {2}, with hostname {3}",
- evaluatorDescriptor.Memory,
- ipAddress,
- port,
- hostName));
-
- IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
- .Set(TaskConfiguration.Identifier, "bridgeCLRHelloTask_" + DateTime.Now.Ticks)
- .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class)
- .Set(TaskConfiguration.OnMessage, GenericType<HelloTask.HelloDriverMessageHandler>.Class)
- .Set(TaskConfiguration.OnSendMessage, GenericType<HelloTaskMessage>.Class)
- .Build();
-
- activeContext.SubmitTask(taskConfiguration);
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
deleted file mode 100644
index c07f809..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
+++ /dev/null
@@ -1,132 +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.io;
-using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.Driver.Context;
-using Org.Apache.REEF.Driver.Evaluator;
-using Org.Apache.REEF.Network.Naming;
-using Org.Apache.REEF.Services;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tang.Implementations.Configuration;
-using Org.Apache.REEF.Tang.Implementations.Tang;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tang.Util;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Net;
-using Org.Apache.REEF.Examples.Tasks.HelloTask;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloAllocatedEvaluatorHandler : IObserver<IAllocatedEvaluator>
- {
- [Inject]
- public HelloAllocatedEvaluatorHandler()
- {
- }
-
- public void OnNext(IAllocatedEvaluator allocatedEvaluator)
- {
- string control = string.Empty;
-
- ISet<string> arguments = ClrHandlerHelper.GetCommandLineArguments();
-
- if (arguments != null && arguments.Any())
- {
- foreach (string argument in arguments)
- {
- Console.WriteLine("testing argument: " + argument);
- }
-
- control = arguments.Last();
- }
-
- IEvaluatorDescriptor descriptor = allocatedEvaluator.GetEvaluatorDescriptor();
-
- IConfiguration serviceConfiguration = ServiceConfiguration.ConfigurationModule
- .Set(ServiceConfiguration.Services, GenericType<HelloService>.Class)
- .Build();
-
- IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule
- .Set(ContextConfiguration.Identifier, "bridgeHelloCLRContextId_" + Guid.NewGuid().ToString("N"))
- .Build();
-
- IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
- .Set(TaskConfiguration.Identifier, "bridgeHelloCLRTaskId_" + Guid.NewGuid().ToString("N"))
- .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class)
- .Set(TaskConfiguration.OnMessage, GenericType<HelloTask.HelloDriverMessageHandler>.Class)
- .Set(TaskConfiguration.OnSendMessage, GenericType<HelloTaskMessage>.Class)
- .Build();
-
- IConfiguration mergedTaskConfiguration = taskConfiguration;
-
- if (allocatedEvaluator.NameServerInfo != null)
- {
- IPEndPoint nameServerEndpoint = NetUtilities.ParseIpEndpoint(allocatedEvaluator.NameServerInfo);
-
- IConfiguration nameClientConfiguration = TangFactory.GetTang().NewConfigurationBuilder(
- NamingConfiguration.ConfigurationModule
- .Set(NamingConfiguration.NameServerAddress, nameServerEndpoint.Address.ToString())
- .Set(NamingConfiguration.NameServerPort,
- nameServerEndpoint.Port.ToString(CultureInfo.InvariantCulture))
- .Build())
- .BindImplementation(GenericType<INameClient>.Class,
- GenericType<NameClient>.Class)
- .Build();
-
- mergedTaskConfiguration = Configurations.Merge(taskConfiguration, nameClientConfiguration);
- }
-
- string ipAddress = descriptor.NodeDescriptor.InetSocketAddress.Address.ToString();
- int port = descriptor.NodeDescriptor.InetSocketAddress.Port;
- string hostName = descriptor.NodeDescriptor.HostName;
- Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Alloated evaluator {0} with ip {1}:{2}. Hostname is {3}", allocatedEvaluator.Id, ipAddress, port, hostName));
- Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Evaluator is assigned with {0} MB of memory and {1} cores.", descriptor.Memory, descriptor.VirtualCore));
-
- if (control.Equals("submitContext", StringComparison.OrdinalIgnoreCase))
- {
- allocatedEvaluator.SubmitContext(contextConfiguration);
- }
- else if (control.Equals("submitContextAndServiceAndTask", StringComparison.OrdinalIgnoreCase))
- {
- allocatedEvaluator.SubmitContextAndServiceAndTask(contextConfiguration, serviceConfiguration, mergedTaskConfiguration);
- }
- else
- {
- // default behavior
- allocatedEvaluator.SubmitContextAndTask(contextConfiguration, mergedTaskConfiguration);
- }
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloCompletedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloCompletedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloCompletedEvaluatorHandler.cs
deleted file mode 100644
index 7c4f650..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloCompletedEvaluatorHandler.cs
+++ /dev/null
@@ -1,59 +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.Driver.Task;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Tang.Annotations;
-using System;
-using System.Globalization;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- /// <summary>
- /// Sample implementaion of RunningTaskHandler
- /// </summary>
- public class HelloCompletedEvaluatorHandler : IObserver<ICompletedEvaluator>
- {
- [Inject]
- public HelloCompletedEvaluatorHandler()
- {
- }
-
- public void OnNext(ICompletedEvaluator completedEvaluator)
- {
- string messageStr = string.Format(
- CultureInfo.InvariantCulture,
- "HelloCompletedEvaluatorHandler: Evaluator [{0}] is done.",
- completedEvaluator.Id);
- Console.WriteLine(messageStr);
- }
-
- 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartActiveContextHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartActiveContextHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartActiveContextHandler.cs
deleted file mode 100644
index 9494f96..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartActiveContextHandler.cs
+++ /dev/null
@@ -1,69 +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.Tang.Annotations;
-using System;
-using System.Globalization;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloDriverRestartActiveContextHandler : IObserver<IActiveContext>
- {
- [Inject]
- public HelloDriverRestartActiveContextHandler()
- {
- }
-
- public void OnNext(IActiveContext activeContext)
- {
- Console.WriteLine(
- string.Format(
- CultureInfo.InvariantCulture,
- "Active context {0} received after driver restart, from evaluator {1}",
- activeContext.Id,
- activeContext.EvaluatorId));
-
- IEvaluatorDescriptor evaluatorDescriptor = activeContext.EvaluatorDescriptor;
- string ipAddress = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Address.ToString();
- int port = evaluatorDescriptor.NodeDescriptor.InetSocketAddress.Port;
- string hostName = evaluatorDescriptor.NodeDescriptor.HostName;
-
- Console.WriteLine(
- string.Format(
- CultureInfo.InvariantCulture,
- "The running evaluator allocated by previous driver is assigned with {0} MB of memory and is running at ip: {1} and port {2}, with hostname {3}",
- evaluatorDescriptor.Memory,
- ipAddress,
- port,
- hostName));
- }
-
- 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartRunningTaskHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartRunningTaskHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartRunningTaskHandler.cs
deleted file mode 100644
index d2d30cf..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloDriverRestartRunningTaskHandler.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Globalization;
-using Org.Apache.REEF.Driver.Context;
-using Org.Apache.REEF.Driver.Task;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- /// <summary>
- /// Sample implementaion of RunningTaskHandler
- /// </summary>
- public class HelloDriverRestartRunningTaskHandler : IObserver<IRunningTask>
- {
- [Inject]
- public HelloDriverRestartRunningTaskHandler()
- {
- }
-
- public void OnNext(IRunningTask runningTask)
- {
- IActiveContext context = runningTask.ActiveContext;
-
- Console.WriteLine(string.Format(
- CultureInfo.InvariantCulture,
- "HelloDriverRestartRunningTaskHandler: Task [{0}] is running after driver restart. Evaluator id: [{1}].",
- runningTask.Id,
- context.EvaluatorId));
-
- runningTask.Send(ByteUtilities.StringToByteArrays(
- string.Format(
- CultureInfo.InvariantCulture,
- "Hello, task {0}! Glad to know that you are still running in Evaluator {1} after driver restart!",
- runningTask.Id,
- context.EvaluatorId)));
- }
-
- 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloEvaluatorRequestorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloEvaluatorRequestorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloEvaluatorRequestorHandler.cs
deleted file mode 100644
index 4f24e0f..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloEvaluatorRequestorHandler.cs
+++ /dev/null
@@ -1,65 +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.Bridge;
-using Org.Apache.REEF.Driver.Evaluator;
-using System;
-
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloEvaluatorRequestorHandler : IObserver<IEvaluatorRequestor>
- {
- [Inject]
- public HelloEvaluatorRequestorHandler()
- {
- }
-
- public void OnNext(IEvaluatorRequestor evalutorRequestor)
- {
- int evaluatorsNumber = 1;
- int memory = 512;
- int core = 2;
- string rack = "WonderlandRack";
- string evaluatorBatchId = "evaluatorThatRequires512MBofMemory";
- EvaluatorRequest request = new EvaluatorRequest(evaluatorsNumber, memory, core, rack, evaluatorBatchId);
-
- evalutorRequestor.Submit(request);
-
- evaluatorsNumber = 1;
- memory = 1999;
- core = 2;
- rack = "WonderlandRack";
- evaluatorBatchId = "evaluatorThatRequires1999MBofMemory";
- request = new EvaluatorRequest(evaluatorsNumber, memory, core, rack, evaluatorBatchId);
- evalutorRequestor.Submit(request);
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedEvaluatorHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedEvaluatorHandler.cs
deleted file mode 100644
index e9aa232..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedEvaluatorHandler.cs
+++ /dev/null
@@ -1,68 +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.Bridge;
-using Org.Apache.REEF.Driver.Evaluator;
-using Org.Apache.REEF.Tang.Annotations;
-using System;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloFailedEvaluatorHandler : IObserver<IFailedEvaluator>
- {
- private static int _failureCount = 0;
-
- private static int _maxTrial = 2;
-
- [Inject]
- public HelloFailedEvaluatorHandler()
- {
- }
-
- public void OnNext(IFailedEvaluator failedEvaluator)
- {
- Console.WriteLine("Receive a failed evaluator: " + failedEvaluator.Id);
- if (++_failureCount < _maxTrial)
- {
- Console.WriteLine("Requesting another evaluator");
- EvaluatorRequest newRequest = new EvaluatorRequest(1, 512, "somerack");
- IEvaluatorRequestor requestor = failedEvaluator.GetEvaluatorRequetor();
- if (failedEvaluator.GetEvaluatorRequetor() != null)
- {
- requestor.Submit(newRequest);
- }
- }
- else
- {
- Console.WriteLine("Exceed max retries number");
- throw new Exception("Unrecoverable evaluator failure.");
- }
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedTaskHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedTaskHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedTaskHandler.cs
deleted file mode 100644
index 7618f00..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloFailedTaskHandler.cs
+++ /dev/null
@@ -1,67 +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 Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Tang.Annotations;
-using System;
-using System.Globalization;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloFailedTaskHandler : IObserver<IFailedTask>
- {
- [Inject]
- public HelloFailedTaskHandler()
- {
- }
-
- public void OnNext(IFailedTask failedTask)
- {
- string errorMessage = string.Format(
- CultureInfo.InvariantCulture,
- "Task [{0}] has failed caused by [{1}], with message [{2}] and description [{3}]. The raw data for failure is [{4}].",
- failedTask.Id,
- failedTask.Reason.IsPresent() ? failedTask.Reason.Value : string.Empty,
- failedTask.Message,
- failedTask.Description.IsPresent() ? failedTask.Description.Value : string.Empty,
- failedTask.Data.IsPresent() ? ByteUtilities.ByteArrarysToString(failedTask.Data.Value) : string.Empty);
-
- Console.WriteLine(errorMessage);
-
- if (failedTask.GetActiveContext().IsPresent())
- {
- Console.WriteLine("Disposing the active context the failed task ran in.");
-
- // we must do something here: either close the context or resubmit a task to the active context
- failedTask.GetActiveContext().Value.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloHttpHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloHttpHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloHttpHandler.cs
deleted file mode 100644
index e1bf097..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloHttpHandler.cs
+++ /dev/null
@@ -1,51 +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.Globalization;
-using System.Net;
-using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloHttpHandler : IHttpHandler
- {
- private static readonly Logger LOGGER = Logger.GetLogger(typeof(HttpServerHandler));
-
- [Inject]
- public HelloHttpHandler()
- {
- }
-
- public string GetSpecification()
- {
- return "NRT"; //Client Example
- }
-
- public void OnHttpRequest(ReefHttpRequest requet, ReefHttpResponse response)
- {
- LOGGER.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "HelloHttpHandler OnHttpRequest: URL: {0}, QueryString: {1}, inputStream: {2}.", requet.Url, requet.Querystring, ByteUtilities.ByteArrarysToString(requet.InputStream)));
- response.Status = HttpStatusCode.OK;
- response.OutputStream =
- ByteUtilities.StringToByteArrays("Byte array returned from HelloHttpHandler in CLR!!!");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRestartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRestartHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRestartHandler.cs
deleted file mode 100644
index 6e72147..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRestartHandler.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.Tang.Annotations;
-using Org.Apache.REEF.Wake.Time;
-using System;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloRestartHandler : IObserver<StartTime>
- {
- [Inject]
- public HelloRestartHandler()
- {
- }
-
- public void OnNext(StartTime value)
- {
- Console.WriteLine("Hello from CLR: we are informed that Driver has restarted at " + new DateTime(value.TimeStamp));
- }
-
- 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRunningTaskHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRunningTaskHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRunningTaskHandler.cs
deleted file mode 100644
index 07048e4..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloRunningTaskHandler.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Globalization;
-using Org.Apache.REEF.Driver.Context;
-using Org.Apache.REEF.Driver.Task;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- /// <summary>
- /// Sample implementaion of RunningTaskHandler
- /// </summary>
- public class HelloRunningTaskHandler : IObserver<IRunningTask>
- {
- [Inject]
- public HelloRunningTaskHandler()
- {
- }
-
- public void OnNext(IRunningTask runningTask)
- {
- IActiveContext context = runningTask.ActiveContext;
-
- string messageStr = string.Format(
- CultureInfo.InvariantCulture,
- "HelloRunningTaskHandler: Task [{0}] is running. Evaluator id: [{1}].",
- runningTask.Id,
- context.EvaluatorId);
- Console.WriteLine(messageStr);
-
- byte[] message = ByteUtilities.StringToByteArrays(messageStr);
-
- runningTask.Send(message);
- }
-
- 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/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
deleted file mode 100644
index 1e61c61..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
+++ /dev/null
@@ -1,422 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Net;
-using System.Text;
-using System.Threading.Tasks;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.Driver;
-using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.Driver.Context;
-using Org.Apache.REEF.Driver.Evaluator;
-using Org.Apache.REEF.Driver.Task;
-using Org.Apache.REEF.Examples.Tasks.HelloTask;
-using Org.Apache.REEF.Network.Naming;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tang.Util;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- enum DriverStatus
- {
- Init = 0,
- Idle = 1,
- RunningTasks = 2,
- CompleteTasks = 3
- }
-
- internal enum TaskStatus
- {
- Submitting = 0,
- Running = 1,
- Completed = 2
- }
-
- /// <summary>
- /// A demo class that contains basic handlers. It runs given tasks and is able to get request from http server and start to ren the tasks again.
- /// It handle various http requests. It also monitoring task status and driver status.
- /// </summary>
- public class HelloSimpleEventHandlers :
- IObserver<IEvaluatorRequestor>,
- IObserver<IAllocatedEvaluator>,
- IObserver<IActiveContext>,
- IObserver<ICompletedTask>,
- IObserver<IRunningTask>,
- IObserver<IFailedTask>,
- IObserver<IFailedEvaluator>,
- IObserver<ICompletedEvaluator>,
- IStartHandler,
- IHttpHandler
- {
- private const int NumberOfTasks = 5;
- private static readonly Logger LOGGER = Logger.GetLogger(typeof(HelloSimpleEventHandlers));
- private IAllocatedEvaluator _allocatedEvaluator;
- private IActiveContext _activeContext;
- private IList<IActiveContext> _activeContexts = new List<IActiveContext>();
- private DriverStatus driveStatus;
- private TaskContext _taskContext;
-
- [Inject]
- public HelloSimpleEventHandlers()
- {
- LOGGER.Log(Level.Info, "HelloSimpleEventHandlers constructor");
- CreateClassHierarchy();
- Identifier = "HelloSimpleEventHandlers";
- _taskContext = new TaskContext();
- _taskContext.TotalTasks = NumberOfTasks;
- driveStatus = DriverStatus.Init;
- }
-
- public string Identifier { get; set; }
-
- public static string ParsePathInfo(string pathInfo)
- {
- string[] p = pathInfo.Split('/');
- foreach (string s in p)
- {
- LOGGER.Log(Level.Info, s);
- }
- if (p.Length > 3)
- {
- return p[3];
- }
- return null;
- }
-
- public static void BuildHttpResponse(
- ReefHttpResponse response,
- HttpStatusCode httpStatusCode,
- string strResponse)
- {
- response.Status = httpStatusCode;
- response.OutputStream = ByteUtilities.StringToByteArrays(strResponse);
- }
-
- public static void BuildHttpResponse(
- ReefHttpResponse response,
- HttpStatusCode httpStatusCode,
- byte[] bytesResponse)
- {
- response.Status = httpStatusCode;
- response.OutputStream = bytesResponse;
- }
-
- public void OnNext(IEvaluatorRequestor evalutorRequestor)
- {
- using (LOGGER.LogFunction("HelloSimpleEventHandlers::evalutorRequestor received"))
- {
- int evaluatorsNumber = 2;
- int memory = 1024 * 3;
- int cpuCoreCount = 1;
- string rack = "WonderlandRack";
- string evaluatorBatchId = "evaluatorThatRequires3GBofMemory";
- EvaluatorRequest request = new EvaluatorRequest(evaluatorsNumber, memory, cpuCoreCount, rack, evaluatorBatchId);
-
- evalutorRequestor.Submit(request);
- }
- }
-
- public void OnNext(IAllocatedEvaluator allocatedEvaluator)
- {
- string taskId = "Task_" + allocatedEvaluator.Id;
- using (LOGGER.LogFunction("HelloSimpleEventHandlers::allocatedEvaluator received {0}.", taskId))
- {
- _allocatedEvaluator = allocatedEvaluator;
-
- IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule.Set(ContextConfiguration.Identifier, "HelloSimpleEventHandlersContext_" + Guid.NewGuid().ToString("N")).Build();
-
- allocatedEvaluator.SubmitContext(contextConfiguration);
- }
- }
-
- public void OnNext(IActiveContext activeContext)
- {
- using (LOGGER.LogFunction("HelloSimpleEventHandlers::activeContext received"))
- {
- LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received activeContext, EvaluatorId id: {0}", activeContext.EvaluatorId));
- _activeContext = activeContext;
- _activeContexts.Add(activeContext);
- driveStatus = DriverStatus.RunningTasks;
- SubmitNextTask(activeContext);
- }
- }
-
- public void OnNext(ICompletedTask value)
- {
- using (LOGGER.LogFunction("HelloSimpleEventHandlers::CompletedTask received"))
- {
- LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received CompletedTask: {0}, task id: {1}", value.Id, _taskContext.CurrentTaskId()));
- _activeContext = value.ActiveContext;
- _taskContext.UpdateTaskStatus(value.Id, TaskStatus.Completed);
- _taskContext.TaskCompleted++;
- SubmitNextTask(value.ActiveContext);
- }
- }
-
- public void OnError(Exception error)
- {
- LOGGER.Log(Level.Error, string.Format(CultureInfo.InvariantCulture, "Exception in coral handlers Msg: {1} Stack: {2}", error.Message, error.StackTrace));
- }
-
- public void OnCompleted()
- {
- }
-
- public void OnNext(IRunningTask value)
- {
- _taskContext.UpdateTaskStatus(_taskContext.CurrentTaskId(), TaskStatus.Running);
- }
-
- public void OnNext(IFailedTask value)
- {
- }
-
- public void OnNext(IFailedEvaluator value)
- {
- }
-
- public void OnNext(ICompletedEvaluator completedEvaluator)
- {
- string messageStr = string.Format(
- CultureInfo.InvariantCulture,
- "HelloSimpleEventHandlers: Evaluator [{0}] is done.",
- completedEvaluator.Id);
- Console.WriteLine(messageStr);
- }
-
- public string GetSpecification()
- {
- return "crystal";
- }
-
- public void OnHttpRequest(ReefHttpRequest request, ReefHttpResponse response)
- {
- string target = ParsePathInfo(request.PathInfo);
- LOGGER.Log(Level.Info, "Target: " + target + ". PathInfo: " + request.PathInfo);
- //if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("driverstatus"))
- if (target != null && target.Equals("driverstatus"))
- {
- LOGGER.Log(Level.Info, "Target: " + target + ". Driver status: " + driveStatus.ToString());
- string msg = string.Format(CultureInfo.CurrentCulture, "Current Driver status: {0} ", driveStatus.ToString());
- BuildHttpResponse(response, HttpStatusCode.OK, msg);
- return;
- }
-
- if (target != null && target.Equals("taskstatus"))
- {
- LOGGER.Log(Level.Info, "Target: " + target + ". TaskStatus string: " + _taskContext.TaskStatusString());
- BuildHttpResponse(response, HttpStatusCode.OK, _taskContext.TaskStatusString());
- return;
- }
-
- if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("run") && driveStatus == DriverStatus.Init)
- {
- BuildHttpResponse(response, HttpStatusCode.OK, "Driver is not ready, wait a few second then send request again!!!");
- return;
- }
-
- if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("run") && driveStatus == DriverStatus.RunningTasks)
- {
- string msg = string.Format(CultureInfo.CurrentCulture,
- "A job is running. Please check driver status and then submit your job again.");
- BuildHttpResponse(response, HttpStatusCode.OK, msg);
- return;
- }
-
- if (target != null && target.ToLower(CultureInfo.CurrentCulture).Equals("run") && driveStatus == DriverStatus.Idle)
- {
- string numberOfTasks = getQueryValue(request.Querystring, "numberoftasks");
- if (numberOfTasks == null)
- {
- BuildHttpResponse(response, HttpStatusCode.OK, "Please specify number of tasks to run");
- return;
- }
-
- driveStatus = DriverStatus.RunningTasks;
- using (LOGGER.LogFunction("HelloSimpleEventHandlers::Processing a new Job from web request"))
- {
- _taskContext = new TaskContext();
- _taskContext.TotalTasks = int.Parse(numberOfTasks, CultureInfo.CurrentCulture);
- BuildHttpResponse(response, HttpStatusCode.OK, "Job from web request is submitted and is running!!!");
- }
-
- foreach (var c in _activeContexts)
- {
- SubmitNextTask(c);
- }
- return;
- }
- BuildHttpResponse(response, HttpStatusCode.OK, "Unsupported query");
- }
-
- private static IDictionary<string, string> ParseQueryString(string queryString)
- {
- IDictionary<string, string> queryPairs = new Dictionary<string, string>();
- if (queryString != null && queryString.Length > 0)
- {
- string[] queries = queryString.Split('&');
- foreach (string query in queries)
- {
- string[] pairs = query.Split('=');
- if (pairs.Length == 2 && !pairs[0].Equals(string.Empty) && !pairs[1].Equals(string.Empty))
- {
- queryPairs[pairs[0]] = pairs[1];
- LOGGER.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "query key: {0}, Query value: {1}.", pairs[0], pairs[1]));
- }
- }
- }
- return queryPairs;
- }
-
- private static string getQueryValue(string queryString, string name)
- {
- IDictionary<string, string> pairs = ParseQueryString(queryString);
- string v;
- pairs.TryGetValue(name, out v);
- return v;
- }
-
- private void CreateClassHierarchy()
- {
- HashSet<string> clrDlls = new HashSet<string>();
- clrDlls.Add(typeof(IDriver).Assembly.GetName().Name);
- clrDlls.Add(typeof(ITask).Assembly.GetName().Name);
- clrDlls.Add(typeof(HelloTask).Assembly.GetName().Name);
- clrDlls.Add(typeof(INameClient).Assembly.GetName().Name);
- clrDlls.Add(typeof(NameClient).Assembly.GetName().Name);
-
- ClrHandlerHelper.GenerateClassHierarchy(clrDlls);
- }
-
- private void SubmitNextTask(IActiveContext activeContext)
- {
- LOGGER.Log(Level.Info, "SubmitNextTask with evaluatorid: " + activeContext.EvaluatorId);
- IConfiguration finalConfiguration = GetNextTaskConfiguration();
- if (null != finalConfiguration)
- {
- LOGGER.Log(Level.Info, "Executing task id " + _taskContext.CurrentTaskId());
- LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Submitting Task {0}", _taskContext.CurrentTaskId()));
-
- activeContext.SubmitTask(finalConfiguration);
- }
- else
- {
- if (_taskContext.TaskCompleted == _taskContext.TotalTasks)
- {
- LOGGER.Log(Level.Info, "All tasks submitted and completed, active context remian idle");
- driveStatus = DriverStatus.Idle;
- }
- }
- }
-
- private IConfiguration GetNextTaskConfiguration()
- {
- string nextTaskId = _taskContext.NextTaskId();
- LOGGER.Log(Level.Info, "GetNextTaskConfiguration, nextTaskId: " + nextTaskId);
- if (nextTaskId != null)
- {
- IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
- .Set(TaskConfiguration.Identifier, nextTaskId)
- .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class)
- .Set(TaskConfiguration.OnMessage, GenericType<HelloTask.HelloDriverMessageHandler>.Class)
- .Set(TaskConfiguration.OnSendMessage, GenericType<HelloTaskMessage>.Class)
- .Build();
- return taskConfiguration;
- }
- return null;
- }
- }
-
- class TaskContext
- {
- private IList<string> taskIds = new List<string>();
-
- private IDictionary<string, TaskStatus> tasks = new Dictionary<string, TaskStatus>();
-
- public TaskContext()
- {
- NextTaskIndex = 0;
- TaskCompleted = 0;
- }
-
- public int TotalTasks { get; set; }
-
- public int NextTaskIndex { get; set; }
-
- public int TaskCompleted { get; set; }
-
- public string NextTaskId()
- {
- Console.WriteLine("NextTaskId: " + NextTaskIndex);
- if (NextTaskIndex < TotalTasks)
- {
- string id = "Jan7DemoTask_" + DateTime.Now.Ticks;
- taskIds.Add(id);
- tasks.Add(id, TaskStatus.Submitting);
- NextTaskIndex++;
- return id;
- }
- return null;
- }
-
- public string CurrentTaskId()
- {
- Console.WriteLine("CurrentTaskIndex: " + (NextTaskIndex - 1));
- if (NextTaskIndex <= TotalTasks)
- {
- Console.WriteLine("CurrentTaskId: " + taskIds[NextTaskIndex - 1]);
- return taskIds[NextTaskIndex - 1];
- }
- return null; //either not started or completed
- }
-
- public void UpdateTaskStatus(string taskId, TaskStatus status)
- {
- tasks[taskId] = status;
- }
-
- public string TaskStatusString()
- {
- Console.WriteLine("TaskStatusString 1, nextTaskIndex: " + NextTaskIndex);
- StringBuilder sb = new StringBuilder();
-
- if (tasks.Count > 0)
- {
- foreach (var pair in tasks)
- {
- sb.AppendLine("Task id: " + pair.Key + " Task status: " + pair.Value.ToString());
- }
- }
- else
- {
- sb.Append("No task is running yet");
- }
-
- return sb.ToString();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloStartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloStartHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloStartHandler.cs
deleted file mode 100644
index 6234fec..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloStartHandler.cs
+++ /dev/null
@@ -1,65 +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.Collections.Generic;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.Driver;
-using Org.Apache.REEF.Driver.bridge;
-using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.Examples.Tasks.HelloTask;
-using Org.Apache.REEF.Network.Naming;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloStartHandler : IStartHandler
- {
- private static readonly Logger LOGGER = Logger.GetLogger(typeof(HelloStartHandler));
-
- [Inject]
- public HelloStartHandler(HttpServerPort httpServerPort)
- {
- CreateClassHierarchy();
- Identifier = "HelloStartHandler";
- LOGGER.Log(Level.Info, "HttpPort received in HelloStartHandler: " + httpServerPort.PortNumber);
- }
-
- public HelloStartHandler(string id)
- {
- Identifier = id;
- CreateClassHierarchy();
- }
-
- public string Identifier { get; set; }
-
- private void CreateClassHierarchy()
- {
- HashSet<string> clrDlls = new HashSet<string>();
- clrDlls.Add(typeof(IDriver).Assembly.GetName().Name);
- clrDlls.Add(typeof(ITask).Assembly.GetName().Name);
- clrDlls.Add(typeof(HelloTask).Assembly.GetName().Name);
- clrDlls.Add(typeof(INameClient).Assembly.GetName().Name);
- clrDlls.Add(typeof(NameClient).Assembly.GetName().Name);
-
- ClrHandlerHelper.GenerateClassHierarchy(clrDlls);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloTaskMessageHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloTaskMessageHandler.cs b/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloTaskMessageHandler.cs
deleted file mode 100644
index e6675ef..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.HelloCLRBridge/handlers/HelloTaskMessageHandler.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 System;
-using System.Globalization;
-using System.Text;
-using Org.Apache.REEF.Driver.Task;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Examples.HelloCLRBridge.Handlers
-{
- public class HelloTaskMessageHandler : IObserver<ITaskMessage>
- {
- [Inject]
- public HelloTaskMessageHandler()
- {
- }
-
- public void OnNext(ITaskMessage taskMessage)
- {
- Console.WriteLine(string.Format(
- CultureInfo.InvariantCulture,
- "CLR HelloTaskMessageHandler received following message from Task: {0}, Message: {1}.",
- taskMessage.TaskId,
- Encoding.UTF8.GetString(taskMessage.Message)));
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception error)
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/29c56c8e/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj
deleted file mode 100644
index a7645b9..0000000
--- a/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/Org.Apache.REEF.Examples.RetainedEvalCLRBridge.csproj
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{05EC65CF-848D-49AB-9E67-57C14EA63044}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Org.Apache.REEF.Examples.RetainedEvalCLRBridge</RootNamespace>
- <AssemblyName>Org.Apache.REEF.Examples.RetainedEvalCLRBridge</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <RestorePackages>true</RestorePackages>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- </PropertyGroup>
- <Import Project="$(SolutionDir)\build.props" />
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="handler\RetainedEvalActiveContextHandler.cs" />
- <Compile Include="handler\RetainedEvalAllocatedEvaluatorHandler.cs" />
- <Compile Include="handler\RetainedEvalEvaluatorRequestorHandler.cs" />
- <Compile Include="handler\RetainedEvalStartHandler.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
- <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Org.Apache.REEF.Tang</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
- <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
- <Name>Org.Apache.REEF.Utilities</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
- <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>Org.Apache.REEF.Common</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
- <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>Org.Apache.REEF.Driver</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
- <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
- <Name>Org.Apache.REEF.Wake</Name>
- </ProjectReference>
- <ProjectReference Include="..\Org.Apache.REEF.Examples.Tasks\Org.Apache.REEF.Examples.Tasks.csproj">
- <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
- <Name>Org.Apache.REEF.Examples.Tasks</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file