Repository: incubator-reef Updated Branches: refs/heads/master 281326ac2 -> 0e3282183
[REEF-369] Add IAllocatedEvaluator.SubmitTask This chang adds that method and makes use of it in `HelloDriver`. JIRA: [REEF-369](https://issues.apache.org/jira/browse/REEF-369) Pull Request: This closes #216 Author: Markus Weimer <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/0e328218 Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/0e328218 Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/0e328218 Branch: refs/heads/master Commit: 0e32821835bf57b9297fce5fc6a2e288b446e3e5 Parents: 281326a Author: Markus Weimer <[email protected]> Authored: Fri Jun 12 17:11:15 2015 +0900 Committer: Julia Wang <[email protected]> Committed: Mon Jun 15 14:13:49 2015 -0700 ---------------------------------------------------------------------- .../Bridge/Events/AllocatedEvaluator.cs | 9 +++++++ .../Evaluator/IAllocatedEvaluator.cs | 2 +- .../HelloDriver.cs | 25 +++++--------------- 3 files changed, 16 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/0e328218/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/AllocatedEvaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/AllocatedEvaluator.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/AllocatedEvaluator.cs index bf17fba..8d544f6 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/AllocatedEvaluator.cs +++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/AllocatedEvaluator.cs @@ -24,6 +24,7 @@ using System.Runtime.Serialization; using Org.Apache.REEF.Common.Catalog; using Org.Apache.REEF.Common.Evaluator; using Org.Apache.REEF.Driver.Bridge.Clr2java; +using Org.Apache.REEF.Driver.Context; using Org.Apache.REEF.Driver.Evaluator; using Org.Apache.REEF.Tang.Formats; using Org.Apache.REEF.Tang.Implementations.Configuration; @@ -69,6 +70,14 @@ namespace Org.Apache.REEF.Driver.Bridge.Events [DataMember] private IAllocatedEvaluaotrClr2Java Clr2Java { get; set; } + public void SubmitTask(IConfiguration taskConfiguration) + { + var contextConfiguration = + ContextConfiguration.ConfigurationModule.Set(ContextConfiguration.Identifier, "RootContext_" + this.Id) + .Build(); + SubmitContextAndTask(contextConfiguration, taskConfiguration); + + } public void SubmitContext(IConfiguration contextConfiguration) { LOGGER.Log(Level.Info, "AllocatedEvaluator::SubmitContext"); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/0e328218/lang/cs/Org.Apache.REEF.Driver/Evaluator/IAllocatedEvaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Evaluator/IAllocatedEvaluator.cs b/lang/cs/Org.Apache.REEF.Driver/Evaluator/IAllocatedEvaluator.cs index 014ca44..ed90368 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Evaluator/IAllocatedEvaluator.cs +++ b/lang/cs/Org.Apache.REEF.Driver/Evaluator/IAllocatedEvaluator.cs @@ -27,7 +27,7 @@ namespace Org.Apache.REEF.Driver.Evaluator /// <summary> /// Represents an Evaluator that is allocated, but is not running yet. /// </summary> - public interface IAllocatedEvaluator : IDisposable, IIdentifiable, IContextSubmittable, IContextAndTaskSubmittable + public interface IAllocatedEvaluator : IDisposable, IIdentifiable, IContextSubmittable, IContextAndTaskSubmittable, ITaskSubmittable { EvaluatorType Type { get; set; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/0e328218/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs index a5455be..faf051d 100644 --- a/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs +++ b/lang/cs/Org.Apache.REEF.Examples.HelloREEF/HelloDriver.cs @@ -19,15 +19,14 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using Org.Apache.REEF.Common.Files; +using Org.Apache.REEF.Common.Tasks; using Org.Apache.REEF.Driver; using Org.Apache.REEF.Driver.Bridge; using Org.Apache.REEF.Driver.Evaluator; using Org.Apache.REEF.Tang.Annotations; -using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; using Org.Apache.REEF.Utilities.Logging; @@ -40,22 +39,6 @@ namespace Org.Apache.REEF.Examples.HelloREEF { private static readonly Logger _Logger = Logger.GetLogger(typeof(HelloDriver)); - /// <summary> - /// Contexts contain configuration data used beyond a single task. - /// </summary> - private static readonly IConfiguration ContextConfiguration = - Driver.Context.ContextConfiguration.ConfigurationModule - .Set(Driver.Context.ContextConfiguration.Identifier, "HelloContext") - .Build(); - - /// <summary> - /// The TaskConfiguration contains the type of Task to run as well as the identifier of that task - /// </summary> - private static readonly IConfiguration TaskConfiguration = Common.Tasks.TaskConfiguration.ConfigurationModule - .Set(Common.Tasks.TaskConfiguration.Identifier, "HelloTask") - .Set(Common.Tasks.TaskConfiguration.Task, GenericType<HelloTask>.Class) - .Build(); - private readonly REEFFileNames _fileNames; private readonly IEvaluatorRequestor _evaluatorRequestor; @@ -83,7 +66,11 @@ namespace Org.Apache.REEF.Examples.HelloREEF /// <param name="allocatedEvaluator"></param> public void OnNext(IAllocatedEvaluator allocatedEvaluator) { - allocatedEvaluator.SubmitContextAndTask(ContextConfiguration, TaskConfiguration); + var taskConfiguration = TaskConfiguration.ConfigurationModule + .Set(TaskConfiguration.Identifier, "HelloTask") + .Set(TaskConfiguration.Task, GenericType<HelloTask>.Class) + .Build(); + allocatedEvaluator.SubmitTask(taskConfiguration); } public void OnError(Exception error)
