http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/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 new file mode 100644 index 0000000..8bcd5c6 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/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 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/a7df272d/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 new file mode 100644 index 0000000..d4379c3 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/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 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/a7df272d/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 new file mode 100644 index 0000000..b4d5084 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/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 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/a7df272d/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 new file mode 100644 index 0000000..97a3645 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Examples.RetainedEvalCLRBridge/handler/RetainedEvalStartHandler.cs @@ -0,0 +1,90 @@ +/** + * 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/a7df272d/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/a7df272d/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/a7df272d/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/a7df272d/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/a7df272d/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 new file mode 100644 index 0000000..1d0f8d2 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Examples.Tasks/Org.Apache.REEF.Examples.Tasks.csproj @@ -0,0 +1,117 @@ +<?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)\Source\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/a7df272d/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 new file mode 100644 index 0000000..4a41805 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Examples.Tasks/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("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/a7df272d/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/a7df272d/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/a7df272d/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/a7df272d/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 840fd3a..21517ea 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.Tasks"; + public static string Tasks = @"Org.Apache.REEF.Examples.Tasks"; 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/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs index 935d739..1c5a505 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs @@ -28,6 +28,7 @@ using Org.Apache.REEF.Tang.Types; using Org.Apache.REEF.Tang.Util; using System; using System.Collections.Generic; +using Org.Apache.REEF.Examples.Tasks.HelloTask; namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy { @@ -402,8 +403,8 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy [TestMethod] public void TestHelloTaskNode() { - var node = ns.GetNode(typeof(Org.Apache.REEF.Tasks.HelloTask).AssemblyQualifiedName); - Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Org.Apache.REEF.Tasks.HelloTask))); + var node = ns.GetNode(typeof(HelloTask).AssemblyQualifiedName); + Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(HelloTask))); } [TestMethod] http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs index ee13cb3..1ae038f 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs @@ -1,4 +1,4 @@ -/** +/** * 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 @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -using System; + using System; using System.Collections.Generic; using System.Reflection; using Org.Apache.REEF.Tasks; @@ -26,7 +26,9 @@ using Org.Apache.REEF.Tang.Protobuf; using Org.Apache.REEF.Tang.Types; using Org.Apache.REEF.Tang.Util; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Org.Apache.REEF.Tang.Examples; + using Org.Apache.REEF.Examples.Tasks.HelloTask; + using Org.Apache.REEF.Examples.Tasks.StreamingTasks; + using Org.Apache.REEF.Tang.Examples; using Org.Apache.REEF.Tang.Implementations.InjectionPlan; using Org.Apache.REEF.Tang.Implementations.Tang; @@ -97,10 +99,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy [TestMethod] public void TestDeSerializeClassHierarchyForTask() { - Type streamTask1Type = typeof (Org.Apache.REEF.Tasks.StreamTask1); - Type helloTaskType = typeof (Org.Apache.REEF.Tasks.HelloTask); + Type streamTask1Type = typeof (StreamTask1); + Type helloTaskType = typeof (HelloTask); - IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Org.Apache.REEF.Tasks.HelloTask).Assembly.GetName().Name }); + IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(HelloTask).Assembly.GetName().Name }); IClassNode StreamTask1ClassNode = (IClassNode)ns.GetNode(streamTask1Type.AssemblyQualifiedName); IClassNode HelloTaskClassNode = (IClassNode)ns.GetNode(helloTaskType.AssemblyQualifiedName); @@ -137,10 +139,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy [TestMethod] public void TestDeSerializeClassHierarchyAndBind() { - Type streamTask1Type = typeof(Org.Apache.REEF.Tasks.StreamTask1); - Type helloTaskType = typeof(Org.Apache.REEF.Tasks.HelloTask); + Type streamTask1Type = typeof(StreamTask1); + Type helloTaskType = typeof(HelloTask); - IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(Org.Apache.REEF.Tasks.HelloTask).Assembly.GetName().Name }); + IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(HelloTask).Assembly.GetName().Name }); IClassNode StreamTask1ClassNode = (IClassNode)ns.GetNode(streamTask1Type.AssemblyQualifiedName); IClassNode HelloTaskClassNode = (IClassNode)ns.GetNode(helloTaskType.AssemblyQualifiedName); @@ -157,7 +159,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy .NewConfigurationBuilder(ns); cb.AddConfiguration(TaskConfiguration.ConfigurationModule .Set(TaskConfiguration.Identifier, "Hello_From_Streaming1") - .Set(TaskConfiguration.Task, GenericType<Org.Apache.REEF.Tasks.StreamTask1>.Class) + .Set(TaskConfiguration.Task, GenericType<StreamTask1>.Class) .Build()); IConfiguration taskConfiguration = cb.Build(); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs index 4d2fbd3..630eef0 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs @@ -24,6 +24,7 @@ using Org.Apache.REEF.Tang.Implementations; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Org.Apache.REEF.Examples.Tasks.HelloTask; using Org.Apache.REEF.Tang.Implementations.Tang; namespace Org.Apache.REEF.Tang.Tests.Configuration http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs index 654c132..28e244f 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs @@ -1,4 +1,4 @@ -/** +/** * 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 @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -using System; + using System; using System.Collections.Generic; using System.Reflection; using Org.Apache.REEF.Tasks; @@ -31,7 +31,8 @@ using Org.Apache.REEF.Tang.Protobuf; using Org.Apache.REEF.Tang.Util; using Org.Apache.REEF.Tang.Tests.ScenarioTest; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Org.Apache.REEF.Tang.Implementations.ClassHierarchy; + using Org.Apache.REEF.Examples.Tasks.HelloTask; + using Org.Apache.REEF.Tang.Implementations.ClassHierarchy; using Org.Apache.REEF.Tang.Implementations.Tang; namespace Org.Apache.REEF.Tang.Tests.Configuration @@ -153,7 +154,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration public void TestGetConfgiFromProtoBufClassHierarchy() { Type iTaskType = typeof(Org.Apache.REEF.Tasks.ITask); - Type helloTaskType = typeof(Org.Apache.REEF.Tasks.HelloTask); + Type helloTaskType = typeof(HelloTask); Type identifierType = typeof (TaskConfigurationOptions.Identifier); IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { FileNames.Common, FileNames.Tasks }); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs index 35368d7..7384fde 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs @@ -26,6 +26,7 @@ using Org.Apache.REEF.Tang.Implementations; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Org.Apache.REEF.Examples.Tasks.HelloTask; using Org.Apache.REEF.Tang.Implementations.Tang; namespace Org.Apache.REEF.Tang.Tests.Format @@ -103,7 +104,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format .Build(); IInjector injector1 = TangFactory.GetTang().NewInjector(conf1); - var task1 = (Org.Apache.REEF.Tasks.HelloTask)injector1.GetInstance(typeof(ITask)); + var task1 = (HelloTask)injector1.GetInstance(typeof(ITask)); Assert.IsNotNull(task1); var serializer = new AvroConfigurationSerializer(); @@ -111,7 +112,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format IConfiguration conf2 = serializer.FromByteArray(bytes); IInjector injector2 = TangFactory.GetTang().NewInjector(conf2); - var task2 = (Org.Apache.REEF.Tasks.HelloTask)injector2.GetInstance(typeof(ITask)); + var task2 = (HelloTask)injector2.GetInstance(typeof(ITask)); Assert.IsNotNull(task2); } @@ -131,7 +132,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format .Build(); IInjector injector1 = TangFactory.GetTang().NewInjector(conf1); - var task1 = (Org.Apache.REEF.Tasks.HelloTask)injector1.GetInstance(typeof(ITask)); + var task1 = (HelloTask)injector1.GetInstance(typeof(ITask)); Assert.IsNotNull(task1); var serializer = new AvroConfigurationSerializer(); @@ -139,14 +140,14 @@ namespace Org.Apache.REEF.Tang.Tests.Format IConfiguration conf2 = serializer.FromByteArray(bytes); IInjector injector2 = TangFactory.GetTang().NewInjector(conf2); - var task2 = (Org.Apache.REEF.Tasks.HelloTask)injector2.GetInstance(typeof(ITask)); + var task2 = (HelloTask)injector2.GetInstance(typeof(ITask)); Assert.IsNotNull(task2); serializer.ToFileStream(conf1, "TaskConfiguration.bin"); IConfiguration conf3 = serializer.FromFileStream("TaskConfiguration.bin"); IInjector injector3 = TangFactory.GetTang().NewInjector(conf3); - var task3 = (Org.Apache.REEF.Tasks.HelloTask)injector3.GetInstance(typeof(ITask)); + var task3 = (HelloTask)injector3.GetInstance(typeof(ITask)); Assert.IsNotNull(task3); } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjection.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjection.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjection.cs index 1f015ca..40b9a96 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjection.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjection.cs @@ -28,6 +28,8 @@ using Org.Apache.REEF.Tang.Util; using Org.Apache.REEF.Tasks; using System; using System.Reflection; +using Org.Apache.REEF.Examples.Tasks.HelloTask; +using Org.Apache.REEF.Examples.Tasks.StreamingTasks; namespace Org.Apache.REEF.Tang.Tests.Injection { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/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 2359a93..7275852 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,6 +167,10 @@ 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"> + <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> + <Name>Org.Apache.REEF.Examples.Tasks</Name> + </ProjectReference> <ProjectReference Include="..\Org.Apache.REEF.Tang.Examples\Org.Apache.REEF.Tang.Examples.csproj"> <Project>{711b7f32-196e-4c21-9dbd-ad59c4a7cf77}</Project> <Name>Org.Apache.REEF.Tang.Examples</Name> @@ -183,10 +187,6 @@ under the License. <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project> <Name>Org.Apache.REEF.Wake</Name> </ProjectReference> - <ProjectReference Include="..\Source\REEF\reef-tasks\Tasks\Tasks.csproj"> - <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> - <Name>Tasks</Name> - </ProjectReference> </ItemGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/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 9925d6e..84d6e09 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 @@ -83,10 +83,6 @@ under the License. <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="$(SourceDir)\REEF\reef-tasks\Tasks\Tasks.csproj"> - <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> - <Name>Tasks</Name> - </ProjectReference> <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> @@ -103,6 +99,10 @@ 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"> + <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> + <Name>Org.Apache.REEF.Examples.Tasks</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> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Org.Apache.REEF.Tang.Tools/Program.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tools/Program.cs b/lang/cs/Org.Apache.REEF.Tang.Tools/Program.cs index 0e158b6..1fec395 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tools/Program.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tools/Program.cs @@ -26,6 +26,9 @@ using System; using System.Collections.Generic; using System.Globalization; using System.IO; +using Org.Apache.REEF.Examples.Tasks.HelloTask; +using Org.Apache.REEF.Examples.Tasks.ShellTask; +using Org.Apache.REEF.Examples.Tasks.StreamingTasks; using Org.Apache.REEF.Tang.Implementations.Tang; namespace Org.Apache.REEF.Tang.Tools http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/ReefDotNet.sln ---------------------------------------------------------------------- diff --git a/lang/cs/ReefDotNet.sln b/lang/cs/ReefDotNet.sln index 10258b3..0f08c22 100644 --- a/lang/cs/ReefDotNet.sln +++ b/lang/cs/ReefDotNet.sln @@ -10,14 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{2B7EE9 .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tasks", "Source\REEF\reef-tasks\Tasks\Tasks.csproj", "{75503F90-7B82-4762-9997-94B5C68F15DB}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLRBridgeClient", "Source\REEF\reef-applications\CLRBridgeClient\CLRBridgeClient.csproj", "{5094C35B-4FDB-4322-AC05-45D684501CBF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloCLRBridge", "Source\REEF\reef-examples\HelloCLRBridge\HelloCLRBridge.csproj", "{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RetainedEvalCLRBridge", "Source\REEF\reef-examples\RetainedEvalCLRBridge\RetainedEvalCLRBridge.csproj", "{A33C20FB-A76E-494C-80C5-BCE4BAD876D3}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReefAll", "Source\Tools\ReefAll\ReefAll.csproj", "{4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReefTests", "Tests\ReefTests\ReefTests.csproj", "{988F90CF-A48D-4938-A4D2-FA3B758FB5A7}" @@ -44,6 +38,12 @@ 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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,14 +52,6 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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 @@ -68,22 +60,6 @@ Global {5094C35B-4FDB-4322-AC05-45D684501CBF}.Release|Any CPU.Build.0 = Release|Any CPU {5094C35B-4FDB-4322-AC05-45D684501CBF}.Release|x64.ActiveCfg = Release|x64 {5094C35B-4FDB-4322-AC05-45D684501CBF}.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 - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Debug|x64.ActiveCfg = Debug|x64 - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Debug|x64.Build.0 = Debug|x64 - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Release|Any CPU.Build.0 = Release|Any CPU - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Release|x64.ActiveCfg = Release|x64 - {A33C20FB-A76E-494C-80C5-BCE4BAD876D3}.Release|x64.Build.0 = Release|x64 {4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}.Debug|Any CPU.Build.0 = Debug|Any CPU {4C137C79-3A28-47D2-BFB9-A3CAB1EEDACE}.Debug|x64.ActiveCfg = Debug|x64 @@ -188,6 +164,30 @@ 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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs index ce2857f..6a9aa3c 100644 --- a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs +++ b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs @@ -32,6 +32,7 @@ using Org.Apache.REEF.Tang.Util; using System; using System.Collections.Generic; using System.IO; +using Org.Apache.REEF.Examples.Tasks.HelloTask; namespace Org.Apache.REEF.CLRBridgeClient { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj index 8b732ba..56990d9 100644 --- a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj +++ b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj @@ -90,18 +90,6 @@ under the License. <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project> <Name>Org.Apache.Reef.Utilities</Name> </ProjectReference> - <ProjectReference Include="$(SourceDir)\Reef\reef-examples\HelloCLRBridge\HelloCLRBridge.csproj"> - <Project>{a78dd8e8-31d0-4506-8738-daa9da86d55b}</Project> - <Name>HelloCLRBridge</Name> - </ProjectReference> - <ProjectReference Include="$(SourceDir)\Reef\reef-examples\RetainedEvalCLRBridge\RetainedEvalCLRBridge.csproj"> - <Project>{a33c20fb-a76e-494c-80c5-bce4bad876d3}</Project> - <Name>RetainedEvalCLRBridge</Name> - </ProjectReference> - <ProjectReference Include="$(SourceDir)\Reef\reef-tasks\Tasks\Tasks.csproj"> - <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> - <Name>Tasks</Name> - </ProjectReference> <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> @@ -114,6 +102,14 @@ under the License. <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project> <Name>Org.Apache.Reef.Driver</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.Tasks\Org.Apache.REEF.Examples.Tasks.csproj"> + <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> + <Name>Org.Apache.REEF.Examples.Tasks</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> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a7df272d/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj deleted file mode 100644 index 29f173b..0000000 --- a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/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)\Source\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="$(SourceDir)\Reef\reef-tasks\Tasks\Tasks.csproj"> - <Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project> - <Name>Tasks</Name> - </ProjectReference> - <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="..\..\..\..\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="..\..\..\..\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/a7df272d/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloTraceListener.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloTraceListener.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloTraceListener.cs deleted file mode 100644 index 88dbe3b..0000000 --- a/lang/cs/Source/REEF/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/a7df272d/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/Properties/AssemblyInfo.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/Properties/AssemblyInfo.cs deleted file mode 100644 index 6c1a298..0000000 --- a/lang/cs/Source/REEF/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("HelloCLRBridge")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("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/a7df272d/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/AnotherHelloAllocatedEvaluatorHandler.cs deleted file mode 100644 index f71f8be..0000000 --- a/lang/cs/Source/REEF/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 -{ - 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/a7df272d/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloActiveContextHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloActiveContextHandler.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloActiveContextHandler.cs deleted file mode 100644 index 3280bda..0000000 --- a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloActiveContextHandler.cs +++ /dev/null @@ -1,82 +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; - -namespace Org.Apache.REEF.Examples.HelloCLRBridge -{ - 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
