http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/IRunningTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/IRunningTask.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/IRunningTask.cs deleted file mode 100644 index 92a6887..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/IRunningTask.cs +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Utilities; -using System; - -namespace Org.Apache.Reef.Common.Task -{ - /// <summary> - /// Represents a running Task - /// </summary> - public interface IRunningTask : IIdentifiable, IDisposable - { - /// <summary> - /// Sends the message to the running task. - /// </summary> - /// <param name="message"></param> - void OnNext(byte[] message); - - /// <summary> - /// Signal the task to suspend. - /// </summary> - /// <param name="message">a message that is sent to the Task.</param> - void Suspend(byte[] message); - - /// <summary> - /// Sends the message to the running task. - /// </summary> - void Suspend(); - - /// <summary> - /// Signal the task to shut down. - /// </summary> - /// <param name="message">a message that is sent to the Task.</param> - void Dispose(byte[] message); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITask.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITask.cs deleted file mode 100644 index 3655a4b..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITask.cs +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; - -namespace Org.Apache.Reef.Tasks -{ - public interface ITask : IDisposable - { - byte[] Call(byte[] memento); - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITaskMessageSource.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITaskMessageSource.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITaskMessageSource.cs deleted file mode 100644 index 589a445..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/ITaskMessageSource.cs +++ /dev/null @@ -1,31 +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.Tasks.Defaults; -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Tang.Annotations; - -namespace Org.Apache.Reef.Tasks -{ - [DefaultImplementation(typeof(DefaultTaskMessageSource))] - public interface ITaskMessageSource - { - Optional<TaskMessage> Message { get; set; } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfiguration.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfiguration.cs deleted file mode 100644 index 6fb386b..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfiguration.cs +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Tasks.Events; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Formats; -using Org.Apache.Reef.Tang.Interface; -using Org.Apache.Reef.Tang.Util; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; - -[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "static readonly field, typical usage in configurations")] - -namespace Org.Apache.Reef.Tasks -{ - public class TaskConfiguration : ConfigurationModuleBuilder - { - // this is a hack for getting the task identifier for now - public const string TaskIdentifier = "TaskConfigurationOptions+Identifier"; - - /// <summary> - /// The identifier of the task. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly RequiredParameter<string> Identifier = new RequiredParameter<string>(); - - /// <summary> - /// The task to instantiate. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly RequiredImpl<ITask> Task = new RequiredImpl<ITask>(); - - /// <summary> - /// for task suspension. Defaults to task failure if not bound. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<ISuspendEvent>> OnSuspend = new OptionalImpl<IObserver<ISuspendEvent>>(); - - /// <summary> - /// for messages from the driver. Defaults to task failure if not bound. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IDriverMessageHandler> OnMessage = new OptionalImpl<IDriverMessageHandler>(); - - /// <summary> - /// for closure requests from the driver. Defaults to task failure if not bound. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<ICloseEvent>> OnClose = new OptionalImpl<IObserver<ICloseEvent>>(); - - /// <summary> - /// Message source invoked upon each evaluator heartbeat. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<ITaskMessageSource> OnSendMessage = new OptionalImpl<ITaskMessageSource>(); - - /// <summary> - /// to receive TaskStart after the Task.call() method was called. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<ITaskStart>> OnTaskStart = new OptionalImpl<IObserver<ITaskStart>>(); - - /// <summary> - /// to receive TaskStop after the Task.call() method returned. - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalImpl<IObserver<ITaskStop>> OnTaskStop = new OptionalImpl<IObserver<ITaskStop>>(); - - /// <summary> - /// The memento to be passed to Task.call(). - /// </summary> - [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")] - public static readonly OptionalParameter<string> Memento = new OptionalParameter<string>(); - - private static readonly Logger LOGGER = Logger.GetLogger(typeof(TaskConfiguration)); - - public TaskConfiguration() - : base() - { - } - - public TaskConfiguration(string configString) - { - TangConfig = new AvroConfigurationSerializer().FromString(configString); - AvroConfiguration avroConfiguration = AvroConfiguration.GetAvroConfigurationFromEmbeddedString(configString); - foreach (ConfigurationEntry config in avroConfiguration.Bindings) - { - if (config.key.Contains(TaskIdentifier)) - { - TaskId = config.value; - } - } - if (string.IsNullOrWhiteSpace(TaskId)) - { - string msg = "Required parameter TaskId not provided."; - LOGGER.Log(Level.Error, msg); - Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException(msg), LOGGER); - } - } - - public static ConfigurationModule ConfigurationModule - { - get - { - return new TaskConfiguration() - .BindImplementation(GenericType<ITask>.Class, Task) - .BindImplementation(GenericType<ITaskMessageSource>.Class, OnSendMessage) - .BindImplementation(GenericType<IDriverMessageHandler>.Class, OnMessage) - .BindNamedParameter(GenericType<TaskConfigurationOptions.Identifier>.Class, Identifier) - .BindNamedParameter(GenericType<TaskConfigurationOptions.Memento>.Class, Memento) - .BindNamedParameter(GenericType<TaskConfigurationOptions.CloseHandler>.Class, OnClose) - .BindNamedParameter(GenericType<TaskConfigurationOptions.SuspendHandler>.Class, OnSuspend) - .BindSetEntry(GenericType<TaskConfigurationOptions.StartHandlers>.Class, OnTaskStart) - .BindSetEntry(GenericType<TaskConfigurationOptions.StopHandlers>.Class, OnTaskStop) - .Build(); - } - } - - public string TaskId { get; private set; } - - public IList<KeyValuePair<string, string>> Configurations { get; private set; } - - public IConfiguration TangConfig { get; private set; } - - public override string ToString() - { - return string.Format(CultureInfo.InvariantCulture, "TaskConfiguration - configurations: {0}", TangConfig.ToString()); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfigurationOptions.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfigurationOptions.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfigurationOptions.cs deleted file mode 100644 index 888faf0..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskConfigurationOptions.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.Tasks.Events; -using Org.Apache.Reef.Tang.Annotations; -using System; -using System.Collections.Generic; - -namespace Org.Apache.Reef.Tasks -{ - public class TaskConfigurationOptions - { - [NamedParameter("The Identifier of the Task", "taskid", "Task")] - public class Identifier : Name<string> - { - } - - [NamedParameter(documentation: "The memento to be used for the Task")] - public class Memento : Name<string> - { - } - - [NamedParameter("TaskMessageSource", "messagesource", null)] - public class TaskMessageSources : Name<ISet<ITaskMessageSource>> - { - } - - [NamedParameter(documentation: "The set of event handlers for the TaskStart event.")] - public class StartHandlers : Name<ISet<IObserver<ITaskStart>>> - { - } - - [NamedParameter(documentation: "The set of event handlers for the TaskStop event.")] - public class StopHandlers : Name<ISet<IObserver<ITaskStop>>> - { - } - - [NamedParameter(documentation: "The event handler that receives the close event.")] - public class CloseHandler : Name<IObserver<ICloseEvent>> - { - } - - [NamedParameter(documentation: "The event handler that receives the suspend event.")] - public class SuspendHandler : Name<IObserver<ISuspendEvent>> - { - } - - [NamedParameter(documentation: "The event handler that receives messages from the driver.")] - public class MessageHandler : Name<IObserver<IDriverMessage>> - { - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskMessage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskMessage.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskMessage.cs deleted file mode 100644 index 20defce..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/TaskMessage.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.Utilities; -using System; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Tasks -{ - public class TaskMessage : IMessage - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(TaskMessage)); - private readonly string _messageSourcId; - private readonly byte[] _bytes; - - private TaskMessage(string messageSourceId, byte[] bytes) - { - _messageSourcId = messageSourceId; - _bytes = bytes; - } - - public string MessageSourceId - { - get { return _messageSourcId; } - } - - public byte[] Message - { - get { return _bytes; } - set { } - } - - /// <summary> - /// From byte[] message to a TaskMessage - /// </summary> - /// <param name="messageSourceId">messageSourceId The message's sourceID. This will be accessible in the Driver for routing</param> - /// <param name="message">The actual content of the message, serialized into a byte[]</param> - /// <returns>a new TaskMessage with the given content</returns> - public static TaskMessage From(string messageSourceId, byte[] message) - { - if (string.IsNullOrEmpty(messageSourceId)) - { - Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new ArgumentNullException("messageSourceId"), LOGGER); - } - if (message == null) - { - Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new ArgumentNullException("bytes"), LOGGER); - } - return new TaskMessage(messageSourceId, message); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultDriverMessageHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultDriverMessageHandler.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultDriverMessageHandler.cs deleted file mode 100644 index f77e18d..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultDriverMessageHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Tasks.Events; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Annotations; -using System; - -namespace Org.Apache.Reef.Tasks.Defaults -{ - public class DefaultDriverMessageHandler : IDriverMessageHandler - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DefaultDriverMessageHandler)); - - [Inject] - public DefaultDriverMessageHandler() - { - } - - public void Handle(IDriverMessage message) - { - Exceptions.Throw(new InvalidOperationException("No DriverMessage handler bound. Message received" + message), LOGGER); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultTaskMessageSource.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultTaskMessageSource.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultTaskMessageSource.cs deleted file mode 100644 index 97b52db..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/defaults/DefaultTaskMessageSource.cs +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Tang.Annotations; -using System; -using System.Globalization; - -namespace Org.Apache.Reef.Tasks.Defaults -{ - public class DefaultTaskMessageSource : ITaskMessageSource - { - [Inject] - public DefaultTaskMessageSource() - { - } - - public Optional<TaskMessage> Message - { - get - { - TaskMessage defaultTaskMessage = TaskMessage.From( - "defaultSourceId", - ByteUtilities.StringToByteArrays("default 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/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ICloseEvent.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ICloseEvent.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ICloseEvent.cs deleted file mode 100644 index 3ff9ccf..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ICloseEvent.cs +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Utilities; - -namespace Org.Apache.Reef.Tasks.Events -{ - public interface ICloseEvent - { - Optional<byte[]> Value { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/IDriverMessage.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/IDriverMessage.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/IDriverMessage.cs deleted file mode 100644 index 9ac120d..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/IDriverMessage.cs +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Utilities; - -namespace Org.Apache.Reef.Tasks.Events -{ - public interface IDriverMessage - { - Optional<byte[]> Message { get; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ISuspendEvent.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ISuspendEvent.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ISuspendEvent.cs deleted file mode 100644 index 218a28f..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ISuspendEvent.cs +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Tasks.Events -{ - public interface ISuspendEvent - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStart.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStart.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStart.cs deleted file mode 100644 index bcde0b3..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStart.cs +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Tasks.Events -{ - public interface ITaskStart - { - string Id { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStop.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStop.cs b/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStop.cs deleted file mode 100644 index 5e8ebc8..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefCommon/tasks/events/ITaskStop.cs +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace Org.Apache.Reef.Tasks.Events -{ - public interface ITaskStop - { - string Id { get; } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/ClientManager.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/ClientManager.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/ClientManager.cs deleted file mode 100644 index 3cd3e15..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/ClientManager.cs +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Common.ProtoBuf.ClienRuntimeProto; -using System; - -// TODO -namespace Org.Apache.Reef.Driver -{ - public class ClientManager : IObserver<JobControlProto> - { - public void OnNext(JobControlProto value) - { - throw new NotImplementedException(); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnCompleted() - { - throw new NotImplementedException(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/Constants.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/Constants.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/Constants.cs deleted file mode 100644 index 4e8e68c..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/Constants.cs +++ /dev/null @@ -1,114 +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; - -namespace Org.Apache.Reef.Driver -{ - public class Constants - { - public const ulong NullHandler = 0; - - public const string ClassHierarachyBin = "clrClassHierarchy.bin"; - - public const string GlobalUserSuppliedJavaLibraries = "userSuppliedGlobalLibraries.txt"; - - public const int DefaultMemoryGranularity = 1024; - - public const int HandlersNumber = 17; - - public const string EvaluatorRequestorHandler = "EvaluatorRequestor"; - - public const string AllocatedEvaluatorHandler = "AllocatedEvaluator"; - - public const string CompletedEvaluatorHandler = "CompletedEvaluator"; - - public const string ActiveContextHandler = "ActiveContext"; - - public const string ClosedContextHandler = "ClosedContext"; - - public const string FailedContextHandler = "FailedContext"; - - public const string ContextMessageHandler = "ContextMessage"; - - public const string TaskMessageHandler = "TaskMessage"; - - public const string FailedTaskHandler = "FailedTask"; - - public const string RunningTaskHandler = "RunningTask"; - - public const string FailedEvaluatorHandler = "FailedEvaluator"; - - public const string CompletedTaskHandler = "CompletedTask"; - - public const string SuspendedTaskHandler = "SuspendedTask"; - - public const string HttpServerHandler = "HttpServerHandler"; - - public const string DriverRestartHandler = "DriverRestart"; - - public const string DriverRestartActiveContextHandler = "DriverRestartActiveContext"; - - public const string DriverRestartRunningTaskHandler = "DriverRestartRunningTask"; - - public const string DriverBridgeConfiguration = Common.Constants.ClrBridgeRuntimeConfiguration; - - public const string DriverAppDirectory = "ReefDriverAppDlls"; - - public const string BridgeJarFileName = "reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar"; - - public const string BridgeLaunchClass = "org.apache.reef.javabridge.generic.Launch"; - - public const string BridgeLaunchHeadlessClass = "org.apache.reef.javabridge.generic.LaunchHeadless"; - - public const string DirectLauncherClass = "org.apache.reef.runtime.common.Launcher"; - - public const string JavaToCLRLoggingConfig = "-Djava.util.logging.config.class=org.apache.reef.util.logging.CLRLoggingConfig"; - - public const string JavaVerboseLoggingConfig = "-Djava.util.logging.config.class=org.apache.reef.util.logging.Config"; - - public static Dictionary<string, int> Handlers - { - get - { - return - new Dictionary<string, int>() - { - { EvaluatorRequestorHandler, 0 }, - { AllocatedEvaluatorHandler, 1 }, - { ActiveContextHandler, 2 }, - { TaskMessageHandler, 3 }, - { FailedTaskHandler, 4 }, - { FailedEvaluatorHandler, 5 }, - { HttpServerHandler, 6 }, - { CompletedTaskHandler, 7 }, - { RunningTaskHandler, 8 }, - { SuspendedTaskHandler, 9 }, - { CompletedEvaluatorHandler, 10 }, - { ClosedContextHandler, 11 }, - { FailedContextHandler, 12 }, - { ContextMessageHandler, 13 }, - { DriverRestartHandler, 14 }, - { DriverRestartActiveContextHandler, 15 }, - { DriverRestartRunningTaskHandler, 16 }, - }; - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigGenerator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigGenerator.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigGenerator.cs deleted file mode 100644 index 46c56c5..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigGenerator.cs +++ /dev/null @@ -1,151 +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 System.Globalization; -using System.IO; -using Org.Apache.Reef.Driver.bridge; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Formats; -using Org.Apache.Reef.Tang.Implementations.Configuration; -using Org.Apache.Reef.Tang.Interface; -using Org.Apache.Reef.Tang.Protobuf; - -namespace Org.Apache.Reef.Driver -{ - public class DriverConfigGenerator - { - public const string DriverConfigFile = "driver.config"; - public const string JobDriverConfigFile = "jobDriver.config"; - public const string DriverChFile = "driverClassHierarchy.bin"; - public const string HttpServerConfigFile = "httpServer.config"; - public const string NameServerConfigFile = "nameServer.config"; - public const string UserSuppliedGlobalLibraries = "userSuppliedGlobalLibraries.txt"; - - private static readonly Logger Log = Logger.GetLogger(typeof(DriverConfigGenerator)); - - public static void DriverConfigurationBuilder(DriverConfigurationSettings driverConfigurationSettings) - { - ExtractConfigFromJar(driverConfigurationSettings.JarFileFolder); - - if (!File.Exists(DriverChFile)) - { - Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", DriverChFile, driverConfigurationSettings.JarFileFolder)); - return; - } - - if (!File.Exists(HttpServerConfigFile)) - { - Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", HttpServerConfigFile, driverConfigurationSettings.JarFileFolder)); - return; - } - - if (!File.Exists(JobDriverConfigFile)) - { - Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", JobDriverConfigFile, driverConfigurationSettings.JarFileFolder)); - return; - } - - if (!File.Exists(NameServerConfigFile)) - { - Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", NameServerConfigFile, driverConfigurationSettings.JarFileFolder)); - return; - } - - AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); - - IClassHierarchy drvierClassHierarchy = ProtocolBufferClassHierarchy.DeSerialize(DriverChFile); - - AvroConfiguration jobDriverAvroconfiguration = serializer.AvroDeseriaizeFromFile(JobDriverConfigFile); - IConfiguration jobDriverConfiguration = serializer.FromAvro(jobDriverAvroconfiguration, drvierClassHierarchy); - - AvroConfiguration httpAvroconfiguration = serializer.AvroDeseriaizeFromFile(HttpServerConfigFile); - IConfiguration httpConfiguration = serializer.FromAvro(httpAvroconfiguration, drvierClassHierarchy); - - AvroConfiguration nameAvroconfiguration = serializer.AvroDeseriaizeFromFile(NameServerConfigFile); - IConfiguration nameConfiguration = serializer.FromAvro(nameAvroconfiguration, drvierClassHierarchy); - - IConfiguration merged; - - if (driverConfigurationSettings.IncludingHttpServer && driverConfigurationSettings.IncludingNameServer) - { - merged = Configurations.MergeDeserializedConfs(jobDriverConfiguration, httpConfiguration, nameConfiguration); - } - else if (driverConfigurationSettings.IncludingHttpServer) - { - merged = Configurations.MergeDeserializedConfs(jobDriverConfiguration, httpConfiguration); - } - else if (driverConfigurationSettings.IncludingNameServer) - { - merged = Configurations.MergeDeserializedConfs(jobDriverConfiguration, nameConfiguration); - } - else - { - merged = jobDriverConfiguration; - } - - var b = merged.newBuilder(); - - b.BindSetEntry("org.apache.reef.driver.parameters.DriverIdentifier", driverConfigurationSettings.DriverIdentifier); - b.Bind("org.apache.reef.driver.parameters.DriverMemory", driverConfigurationSettings.DriverMemory.ToString(CultureInfo.CurrentCulture)); - b.Bind("org.apache.reef.driver.parameters.DriverJobSubmissionDirectory", driverConfigurationSettings.SubmissionDirectory); - - //add for all the globallibaries - if (File.Exists(UserSuppliedGlobalLibraries)) - { - var globalLibString = File.ReadAllText(UserSuppliedGlobalLibraries); - if (!string.IsNullOrEmpty(globalLibString)) - { - foreach (string fname in globalLibString.Split(',')) - { - b.BindSetEntry("org.apache.reef.driver.parameters.JobGlobalLibraries", fname); - } - } - } - - foreach (string f in Directory.GetFiles(driverConfigurationSettings.ClrFolder)) - { - b.BindSetEntry("org.apache.reef.driver.parameters.JobGlobalFiles", f); - } - - IConfiguration c = b.Build(); - - serializer.ToFile(c, DriverConfigFile); - - Log.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "driver.config is written to: {0} {1}.", Directory.GetCurrentDirectory(), DriverConfigFile)); - - //additional file for easy to read - using (StreamWriter outfile = new StreamWriter(DriverConfigFile + ".txt")) - { - outfile.Write(serializer.ToString(c)); - } - } - - private static void ExtractConfigFromJar(string jarfileFolder) - { - string jarfile = jarfileFolder + Constants.BridgeJarFileName; - List<string> files = new List<string>(); - files.Add(DriverConfigGenerator.HttpServerConfigFile); - files.Add(DriverConfigGenerator.JobDriverConfigFile); - files.Add(DriverConfigGenerator.NameServerConfigFile); - files.Add(DriverConfigGenerator.DriverChFile); - ClrClientHelper.ExtractConfigfileFromJar(jarfile, files, "."); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigurationSettings.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigurationSettings.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigurationSettings.cs deleted file mode 100644 index 463e983..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverConfigurationSettings.cs +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Driver -{ - public class DriverConfigurationSettings - { - // default to "ReefDevClrBridge" - private string _driverIdentifier = "ReefDevClrBridge"; - - // default to _defaultSubmissionDirectory if not provided - private string _submissionDirectory = "reefTmp/job_" + DateTime.Now.Millisecond; - - // deault to 512MB if no value is provided - private int _driverMemory = 512; - - // folder path that constains clr dlls used by reef - private string _clrFolder = "."; - - // folder that contains jar File provided Byte REEF - private string _jarFileFolder = "."; - - // default to true if no value is specified - private bool _includeHttpServer = true; - - // default to true if no value is specified - private bool _includeNameServer = true; - - /// <summary> - /// Memory allocated for driver, default to 512 MB - /// </summary> - public int DriverMemory - { - get - { - return _driverMemory; - } - - set - { - if (value < 0) - { - throw new ArgumentException("driver memory cannot be negatvie value."); - } - _driverMemory = value; - } - } - - /// <summary> - /// Gets or sets a value indicating whether including name server in the config file. - /// </summary> - /// <value> - /// <c>true</c> if [including name server]; otherwise, <c>false</c>. - /// </value> - public bool IncludingNameServer - { - get { return _includeNameServer; } - set { _includeNameServer = value; } - } - - /// <summary> - /// Gets or sets a value indicating whether including HTTP server in the config file. - /// </summary> - /// <value> - /// <c>true</c> if [including HTTP server]; otherwise, <c>false</c>. - /// </value> - public bool IncludingHttpServer - { - get { return _includeHttpServer; } - set { _includeHttpServer = value; } - } - - /// <summary> - /// Driver Identifier, default to "ReefDevClrBridge" - /// </summary> - public string DriverIdentifier - { - get { return _driverIdentifier; } - set { _driverIdentifier = value; } - } - - /// <summary> - /// Driver job submission directory in (H)DFS where jar file shall be uploaded, default to a tmp directory with GUID name - /// If set by CLR user, the user must guarantee the uniquness of the directory across multiple jobs - /// </summary> - public string SubmissionDirectory - { - get { return _submissionDirectory; } - set { _submissionDirectory = value; } - } - - /// <summary> - /// Gets or sets the CLR folder. - /// </summary> - /// <value> - /// The CLR folder. - /// </value> - public string ClrFolder - { - get { return this._clrFolder; } - set { _clrFolder = value; } - } - - /// <summary> - /// Gets or sets the jar file folder. - /// </summary> - /// <value> - /// The jar file folder. - /// </value> - public string JarFileFolder - { - get { return this._jarFileFolder; } - set { _jarFileFolder = value; } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/DriverManager.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverManager.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/DriverManager.cs deleted file mode 100644 index b0efc2a..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverManager.cs +++ /dev/null @@ -1,540 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Common; -using Org.Apache.Reef.Common.Api; -using Org.Apache.Reef.Common.Catalog; -using Org.Apache.Reef.Common.Evaluator; -using Org.Apache.Reef.Common.Exceptions; -using Org.Apache.Reef.Common.ProtoBuf.DriverRuntimeProto; -using Org.Apache.Reef.Common.ProtoBuf.EvaluatorRunTimeProto; -using Org.Apache.Reef.Common.ProtoBuf.ReefProtocol; -using Org.Apache.Reef.Common.ProtoBuf.ReefServiceProto; -using Org.Apache.Reef.Driver.Bridge; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Utilities; -using Org.Apache.Reef.Utilities.Diagnostics; -using Org.Apache.Reef.Utilities.Logging; -using Org.Apache.Reef.Tang.Implementations; -using Org.Apache.Reef.Tang.Interface; -using Org.Apache.Reef.Wake.Remote; -using Org.Apache.Reef.Wake.Time; -using Org.Apache.Reef.Wake.Time.Runtime.Event; -using System; -using System.Collections.Generic; -using System.Globalization; - -namespace Org.Apache.Reef.Driver -{ - public class DriverManager : - IEvaluatorRequestor, - IObserver<RuntimeStatusProto>, - IObserver<ResourceStatusProto>, - IObserver<ResourceAllocationProto>, - IObserver<NodeDescriptorProto>, - IObserver<RuntimeStart>, - IObserver<RuntimeStop>, - IObserver<IdleClock> - { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(DriverManager)); - - private IInjector _injector; - - private IInjectionFuture<IClock> _clockFuture; - - private ResourceCatalogImpl _resourceCatalog; - - private IInjectionFuture<IResourceRequestHandler> _futureResourceRequestHandler; - - private Dictionary<string, EvaluatorManager> _evaluators = new Dictionary<string, EvaluatorManager>(); - - private EvaluatorHeartBeatSanityChecker _sanityChecker = new EvaluatorHeartBeatSanityChecker(); - - private ClientJobStatusHandler _clientJobStatusHandler; - - private IDisposable _heartbeatConnectionChannel; - - private IDisposable _errorChannel; - - private IObserver<RuntimeErrorProto> _runtimeErrorHandler; - - public DriverManager( - IInjector injector, - ResourceCatalogImpl resourceCatalog, - IRemoteManager<REEFMessage> remoteManager, - IInjectionFuture<IClock> clockFuture, - IInjectionFuture<IResourceRequestHandler> futureResourceRequestHandler, - ClientJobStatusHandler clientJobStatusHandler, - string clientRId) - { - _injector = injector; - _clockFuture = clockFuture; - _resourceCatalog = resourceCatalog; - _futureResourceRequestHandler = futureResourceRequestHandler; - _clientJobStatusHandler = clientJobStatusHandler; - - _heartbeatConnectionChannel = null; - _errorChannel = null; - _runtimeErrorHandler = null; - LOGGER.Log(Level.Info, "DriverManager instantiated"); - } - - public IResourceCatalog ResourceCatalog - { - get - { - return _resourceCatalog; - } - - set - { - } - } - - private RuntimeStatusProto _runtimeStatusProto - { - get - { - RuntimeStatusProto proto = new RuntimeStatusProto(); - proto.state = State.INIT; - proto.name = "REEF"; - proto.outstanding_container_requests = 0; - return proto; - } - - set - { - _runtimeStatusProto = value; - } - } - - public void Submit(IEvaluatorRequest request) - { - LOGGER.Log(Level.Info, "Got an EvaluatorRequest"); - ResourceRequestProto proto = new ResourceRequestProto(); - //TODO: request.size deprecated should use megabytes instead - //switch (request.Size) - //{ - // case EvaluatorRequest.EvaluatorSize.SMALL: - // proto.resource_size = SIZE.SMALL; - // break; - // case EvaluatorRequest.EvaluatorSize.MEDIUM: - // proto.resource_size = SIZE.MEDIUM; - // break; - // case EvaluatorRequest.EvaluatorSize.LARGE: - // proto.resource_size = SIZE.LARGE; - // break; - // case EvaluatorRequest.EvaluatorSize.XLARGE: - // proto.resource_size = SIZE.XLARGE; - // break; - // default: - // throw new InvalidOperationException("invalid request size" + request.Size); - //} - proto.resource_count = request.Number; - if (request.MemoryMegaBytes > 0) - { - proto.memory_size = request.MemoryMegaBytes; - } - - //final ResourceCatalog.Descriptor descriptor = req.getDescriptor(); - //if (descriptor != null) { - // if (descriptor instanceof RackDescriptor) { - // request.addRackName(descriptor.getName()); - // } else if (descriptor instanceof NodeDescriptor) { - // request.addNodeName(descriptor.getName()); - // } - //} - - //_futureResourceRequestHandler.Get().OnNext(proto); - } - - public void Release(EvaluatorManager evaluatorManager) - { - lock (this) - { - string evaluatorManagerId = evaluatorManager.Id; - if (_evaluators.ContainsKey(evaluatorManagerId)) - { - _evaluators.Remove(evaluatorManagerId); - } - else - { - var e = new InvalidOperationException("Trying to remove an unknown evaluator manager with id " + evaluatorManagerId); - Exceptions.Throw(e, LOGGER); - } - } - } - - /// <summary> - /// This handles runtime error occurs on the evaluator - /// </summary> - /// <param name="runtimeErrorProto"></param> - public void Handle(RuntimeErrorProto runtimeErrorProto) - { - FailedRuntime error = new FailedRuntime(runtimeErrorProto); - LOGGER.Log(Level.Warning, "Runtime error:" + error); - - EvaluatorException evaluatorException = error.Cause != null - ? new EvaluatorException(error.Id, error.Cause.Value) - : new EvaluatorException(error.Id, "Runtime error"); - EvaluatorManager evaluatorManager = null; - lock (_evaluators) - { - if (_evaluators.ContainsKey(error.Id)) - { - evaluatorManager = _evaluators[error.Id]; - } - else - { - LOGGER.Log(Level.Warning, "Unknown evaluator runtime error: " + error.Cause); - } - } - if (null != evaluatorManager) - { - evaluatorManager.Handle(evaluatorException); - } - } - - /// <summary> - /// A RuntimeStatusProto comes from the ResourceManager layer indicating its current status - /// </summary> - /// <param name="runtimeStatusProto"></param> - public void OnNext(RuntimeStatusProto runtimeStatusProto) - { - Handle(runtimeStatusProto); - } - - /// <summary> - /// A ResourceStatusProto message comes from the ResourceManager layer to indicate what it thinks - /// about the current state of a given resource. Ideally, we should think the same thing. - /// </summary> - /// <param name="resourceStatusProto"></param> - public void OnNext(ResourceStatusProto resourceStatusProto) - { - Handle(resourceStatusProto); - } - - /// <summary> - /// A ResourceAllocationProto indicates a resource allocation given by the ResourceManager layer. - /// </summary> - /// <param name="resourceAllocationProto"></param> - public void OnNext(ResourceAllocationProto resourceAllocationProto) - { - Handle(resourceAllocationProto); - } - - /// <summary> - /// A NodeDescriptorProto defines a new node in the cluster. We should add this to the resource catalog - /// so that clients can make resource requests against it. - /// </summary> - /// <param name="nodeDescriptorProto"></param> - public void OnNext(NodeDescriptorProto nodeDescriptorProto) - { - _resourceCatalog.Handle(nodeDescriptorProto); - } - - /// <summary> - /// This EventHandler is subscribed to the StartTime event of the Clock statically. It therefore provides the entrance - /// point to REEF. - /// </summary> - /// <param name="runtimeStart"></param> - public void OnNext(RuntimeStart runtimeStart) - { - LOGGER.Log(Level.Info, "RuntimeStart: " + runtimeStart); - _runtimeStatusProto = new RuntimeStatusProto(); - _runtimeStatusProto.state = State.RUNNING; - _runtimeStatusProto.name = "REEF"; - _runtimeStatusProto.outstanding_container_requests = 0; - } - - /// <summary> - /// Handles RuntimeStop - /// </summary> - /// <param name="runtimeStop"></param> - public void OnNext(RuntimeStop runtimeStop) - { - LOGGER.Log(Level.Info, "RuntimeStop: " + runtimeStop); - if (runtimeStop.Exception != null) - { - string exceptionMessage = runtimeStop.Exception.Message; - LOGGER.Log(Level.Warning, "Sending runtime error:" + exceptionMessage); - RuntimeErrorProto runtimeErrorProto = new RuntimeErrorProto(); - runtimeErrorProto.message = exceptionMessage; - runtimeErrorProto.exception = ByteUtilities.StringToByteArrays(exceptionMessage); - runtimeErrorProto.name = "REEF"; - _runtimeErrorHandler.OnNext(runtimeErrorProto); - - LOGGER.Log(Level.Warning, "DONE Sending runtime error: " + exceptionMessage); - } - - lock (_evaluators) - { - foreach (EvaluatorManager evaluatorManager in _evaluators.Values) - { - LOGGER.Log(Level.Warning, "Unclean shutdown of evaluator: " + evaluatorManager.Id); - evaluatorManager.Dispose(); - } - } - - try - { - _heartbeatConnectionChannel.Dispose(); - _errorChannel.Dispose(); - Optional<Exception> e = runtimeStop.Exception != null ? - Optional<Exception>.Of(runtimeStop.Exception) : Optional<Exception>.Empty(); - _clientJobStatusHandler.Dispose(e); - - LOGGER.Log(Level.Info, "driver manager closed"); - } - catch (Exception e) - { - Exceptions.Caught(e, Level.Error, "Error disposing Driver manager", LOGGER); - Exceptions.Throw(new InvalidOperationException("Cannot dispose driver manager"), LOGGER); - } - } - - public void OnNext(IdleClock value) - { - string message = string.Format( - CultureInfo.InvariantCulture, - "IdleClock: [{0}], RuntimeState [{1}], Outstanding container requests [{2}], Container allocation count[{3}]", - value + Environment.NewLine, - _runtimeStatusProto.state + Environment.NewLine, - _runtimeStatusProto.outstanding_container_requests + Environment.NewLine, - _runtimeStatusProto.container_allocation.Count); - LOGGER.Log(Level.Info, message); - - lock (_evaluators) - { - if (_runtimeStatusProto.state == State.RUNNING - && _runtimeStatusProto.outstanding_container_requests == 0 - && _runtimeStatusProto.container_allocation.Count == 0) - { - LOGGER.Log(Level.Info, "Idle runtime shutdown"); - _clockFuture.Get().Dispose(); - } - } - } - - void IObserver<IdleClock>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<IdleClock>.OnCompleted() - { - throw new NotImplementedException(); - } - - void IObserver<RuntimeStop>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<RuntimeStop>.OnCompleted() - { - throw new NotImplementedException(); - } - - void IObserver<RuntimeStart>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<RuntimeStart>.OnCompleted() - { - throw new NotImplementedException(); - } - - void IObserver<NodeDescriptorProto>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<NodeDescriptorProto>.OnCompleted() - { - throw new NotImplementedException(); - } - - void IObserver<ResourceAllocationProto>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<ResourceAllocationProto>.OnCompleted() - { - throw new NotImplementedException(); - } - - void IObserver<ResourceStatusProto>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<ResourceStatusProto>.OnCompleted() - { - throw new NotImplementedException(); - } - - void IObserver<RuntimeStatusProto>.OnError(Exception error) - { - throw new NotImplementedException(); - } - - void IObserver<RuntimeStatusProto>.OnCompleted() - { - throw new NotImplementedException(); - } - - /// <summary> - /// Something went wrong at the runtime layer (either driver or evaluator). This - /// method simply forwards the RuntimeErrorProto to the client via the RuntimeErrorHandler. - /// </summary> - /// <param name="runtimeErrorProto"></param> - private void Fail(RuntimeErrorProto runtimeErrorProto) - { - _runtimeErrorHandler.OnNext(runtimeErrorProto); - _clockFuture.Get().Dispose(); - } - - /// <summary> - /// Helper method to create a new EvaluatorManager instance - /// </summary> - /// <param name="id">identifier of the Evaluator</param> - /// <param name="descriptor"> NodeDescriptor on which the Evaluator executes.</param> - /// <returns>new EvaluatorManager instance.</returns> - private EvaluatorManager GetNewEvaluatorManagerInstance(string id, EvaluatorDescriptorImpl descriptor) - { - LOGGER.Log(Level.Info, "Creating Evaluator Manager: " + id); - //TODO bindVolatieParameter - return (EvaluatorManager)_injector.GetInstance(typeof(EvaluatorManager)); - } - - /// <summary> - /// Receives and routes heartbeats from Evaluators. - /// </summary> - /// <param name="evaluatorHearBeatProto"></param> - private void Handle(IRemoteMessage<EvaluatorHeartbeatProto> evaluatorHearBeatProto) - { - EvaluatorHeartbeatProto heartbeat = evaluatorHearBeatProto.Message; - EvaluatorStatusProto status = heartbeat.evaluator_status; - string evaluatorId = status.evaluator_id; - LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Heartbeat from Evaluator {0} with state {1} timestamp {2}", evaluatorId, status.state, heartbeat.timestamp)); - _sanityChecker.check(evaluatorId, heartbeat.timestamp); - - lock (_evaluators) - { - if (_evaluators.ContainsKey(evaluatorId)) - { - EvaluatorManager evaluatorManager = _evaluators[evaluatorId]; - evaluatorManager.Handle(evaluatorHearBeatProto); - } - else - { - string msg = "Contact from unkonwn evaluator with id: " + evaluatorId; - if (heartbeat.evaluator_status != null) - { - msg += " with state" + status.state; - } - LOGGER.Log(Level.Error, msg); - Exceptions.Throw(new InvalidOperationException(msg), LOGGER); - } - } - } - - /// <summary> - /// This resource status message comes from the ResourceManager layer; telling me what it thinks - /// about the state of the resource executing an Evaluator; This method simply passes the message - /// off to the referenced EvaluatorManager - /// </summary> - /// <param name="resourceStatusProto"></param> - private void Handle(ResourceStatusProto resourceStatusProto) - { - lock (_evaluators) - { - if (_evaluators.ContainsKey(resourceStatusProto.identifier)) - { - EvaluatorManager evaluatorManager = _evaluators[resourceStatusProto.identifier]; - evaluatorManager.Handle(resourceStatusProto); - } - else - { - var e = new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Unknown resource status from evaluator {0} with state {1}", resourceStatusProto.identifier, resourceStatusProto.state)); - Exceptions.Throw(e, LOGGER); - } - } - } - - /// <summary> - /// This method handles resource allocations by creating a new EvaluatorManager instance. - /// </summary> - /// <param name="resourceAllocationProto"></param> - private void Handle(ResourceAllocationProto resourceAllocationProto) - { - lock (_evaluators) - { - try - { - INodeDescriptor nodeDescriptor = _resourceCatalog.GetNode(resourceAllocationProto.node_id); - if (nodeDescriptor == null) - { - Exceptions.Throw(new InvalidOperationException("Unknown resurce: " + resourceAllocationProto.node_id), LOGGER); - } - EvaluatorDescriptorImpl evaluatorDescriptor = new EvaluatorDescriptorImpl(nodeDescriptor, EvaluatorType.UNDECIDED, resourceAllocationProto.resource_memory, resourceAllocationProto.virtual_cores); - LOGGER.Log(Level.Info, "Resource allocation: new evaluator id: " + resourceAllocationProto.identifier); - EvaluatorManager evaluatorManager = GetNewEvaluatorManagerInstance(resourceAllocationProto.identifier, evaluatorDescriptor); - _evaluators.Add(resourceAllocationProto.identifier, evaluatorManager); - } - catch (Exception e) - { - Exceptions.Caught(e, Level.Error, LOGGER); - Exceptions.Throw(new InvalidOperationException("Error handling resourceAllocationProto."), LOGGER); - } - } - } - - private void Handle(RuntimeStatusProto runtimeStatusProto) - { - State runtimeState = runtimeStatusProto.state; - LOGGER.Log(Level.Info, "Runtime status: " + runtimeStatusProto.state); - - switch (runtimeState) - { - case State.FAILED: - Fail(runtimeStatusProto.error); - break; - case State.DONE: - _clockFuture.Get().Dispose(); - break; - case State.RUNNING: - lock (_evaluators) - { - _runtimeStatusProto = runtimeStatusProto; - if (_clockFuture.Get().IsIdle() - && runtimeStatusProto.outstanding_container_requests == 0 - && runtimeStatusProto.container_allocation.Count == 0) - { - _clockFuture.Get().Dispose(); - } - } - break; - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfiguration.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfiguration.cs deleted file mode 100644 index a3dff0e..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfiguration.cs +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Common; -using Org.Apache.Reef.Common.Api; -using Org.Apache.Reef.Common.Catalog; -using Org.Apache.Reef.Common.Client; -using Org.Apache.Reef.Common.Evaluator; -using Org.Apache.Reef.Driver.Evaluator; -using Org.Apache.Reef.Tang.Formats; -using Org.Apache.Reef.Tang.Util; - -namespace Org.Apache.Reef.Driver -{ - public class DriverRuntimeConfiguration : ConfigurationModuleBuilder - { - public static ConfigurationModule ConfigurationModule - { - get - { - return new DriverRuntimeConfiguration() - // Resource Catalog - .BindImplementation(GenericType<IResourceCatalog>.Class, GenericType<ResourceCatalogImpl>.Class) - - // JobMessageObserver - //.BindImplementation(GenericType<IEvaluatorRequestor>.Class, GenericType<DriverManager>.Class) - .BindImplementation(GenericType<IJobMessageObserver>.Class, GenericType<ClientJobStatusHandler>.Class) - - // JobMessageObserver Wake event handler bindings - .BindNamedParameter(GenericType<DriverRuntimeConfigurationOptions.JobMessageHandler>.Class, GenericType<ClientJobStatusHandler>.Class) - .BindNamedParameter(GenericType<DriverRuntimeConfigurationOptions.JobExceptionHandler>.Class, GenericType<ClientJobStatusHandler>.Class) - - // Client manager - .BindNamedParameter(GenericType<DriverRuntimeConfigurationOptions.JobControlHandler>.Class, GenericType<ClientManager>.Class) - - // Bind the runtime parameters - //.BindNamedParameter(GenericType<RuntimeParameters.NodeDescriptorHandler>.Class, GenericType<DriverManager>.Class) - //.BindNamedParameter(GenericType<RuntimeParameters.ResourceAllocationHandler>.Class, GenericType<DriverManager>.Class) - //.BindNamedParameter(GenericType<RuntimeParameters.ResourceStatusHandler>.Class, GenericType<DriverManager>.Class) - //.BindNamedParameter(GenericType<RuntimeParameters.RuntimeStatusHandler>.Class, GenericType<DriverManager>.Class) - - // Bind to the Clock - //.BindSetEntry(GenericType<IClock.RuntimeStopHandler>.Class, GenericType<DriverManager>.Class) - .Build(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfigurationOptions.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfigurationOptions.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfigurationOptions.cs deleted file mode 100644 index 5de7856..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverRuntimeConfigurationOptions.cs +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using Org.Apache.Reef.Common; -using Org.Apache.Reef.Tang.Annotations; - -namespace Org.Apache.Reef.Driver -{ - public class DriverRuntimeConfigurationOptions - { - [NamedParameter(documentation: "Job message handler (see ClientJobStatusHandler)")] - public class JobMessageHandler : Name<ClientJobStatusHandler> - { - } - - [NamedParameter(documentation: "Job exception handler (see ClientJobStatusHandler)")] - public class JobExceptionHandler : Name<ClientJobStatusHandler> - { - } - - [NamedParameter(documentation: "Called when a job control message is received by the client.")] - public class JobControlHandler : Name<ClientManager> - { - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/c1b5200f/lang/cs/Source/REEF/reef-common/ReefDriver/DriverSubmissionSettings.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverSubmissionSettings.cs b/lang/cs/Source/REEF/reef-common/ReefDriver/DriverSubmissionSettings.cs deleted file mode 100644 index 3bdaf6b..0000000 --- a/lang/cs/Source/REEF/reef-common/ReefDriver/DriverSubmissionSettings.cs +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -using System; -using Org.Apache.Reef.Utilities.Logging; - -namespace Org.Apache.Reef.Driver -{ - // TODO: merge with EvaluatorConfigurations class - public class DriverSubmissionSettings - { - // default to "ReefDevClrBridge" - private string _driverIdentifier; - - // default to _defaultSubmissionDirectory is not provided - private string _submissionDirectory; - - // deault to 512MB if no value is provided - private int _driverMemory = 0; - - // default value, client wait till driver exit - private int _clientWaitTime = -1; - - // default to submit to driver with driver config - private bool _submit = true; - - // default to always update jar before submission - private bool _updateJar = true; - - // default to run on local - private bool _runOnYarn; - - // default to set to info logging - private JavaLoggingSetting _javaLogLevel = JavaLoggingSetting.INFO; - - /// <summary> - /// Whether to update jar file with needed dlls before submission - /// User can choose to reduce startup time by skipping the update, if jar file already contains all necessary dll - /// Note this settig is .NET only, it does not propagate to java side. - /// </summary> - public bool UpdateJarBeforeSubmission - { - get { return _updateJar; } - set { _updateJar = value; } - } - - /// <summary> - /// Determine the vebosity of Java driver's log. - /// Note this parameter is used when launching java process only, it does not propagate to java side. - /// </summary> - public JavaLoggingSetting JavaLogLevel - { - get { return _javaLogLevel; } - set { _javaLogLevel = value; } - } - - /// <summary> - /// Memory allocated for driver, default to 512 MB - /// </summary> - public int DriverMemory - { - get - { - return _driverMemory; - } - - set - { - if (value < 0) - { - throw new ArgumentException("driver memory cannot be negatvie value."); - } - _driverMemory = value; - } - } - - /// <summary> - /// Driver Identifier, default to "ReefDevClrBridge" - /// </summary> - public string DriverIdentifier - { - get - { - return _driverIdentifier; - } - - set - { - _driverIdentifier = value; - } - } - - /// <summary> - /// Whether to submit driver with config after driver configuration is construted, default to True - /// </summary> - public bool Submit - { - get - { - return _submit; - } - - set - { - _submit = value; - } - } - - /// <summary> - /// How long client would wait for Driver, default to wait till driver is done - /// </summary> - public int ClientWaitTime - { - get - { - return _clientWaitTime; - } - - set - { - _clientWaitTime = value; - } - } - - /// <summary> - /// Driver job submission directory in (H)DFS where jar file shall be uploaded, default to a tmp directory with GUID name - /// If set by CLR user, the user must guarantee the uniquness of the directory across multiple jobs - /// </summary> - public string SubmissionDirectory - { - get - { - return _submissionDirectory; - } - - set - { - _submissionDirectory = value; - } - } - - /// <summary> - /// Whether to Run on YARN runtime, default to false - /// </summary> - public bool RunOnYarn - { - get - { - return _runOnYarn; - } - - set - { - _runOnYarn = value; - } - } - - public string ToComamndLineArguments() - { - return - (RunOnYarn ? " -local false" : string.Empty) + - (!Submit ? " -submit false" : string.Empty) + - (DriverMemory > 0 ? " -driver_memory " + DriverMemory : string.Empty) + - (!string.IsNullOrWhiteSpace(DriverIdentifier) ? " -drive_id " + DriverIdentifier : string.Empty) + - (ClientWaitTime > 0 ? " -wait_time " + ClientWaitTime : string.Empty) + - (!string.IsNullOrWhiteSpace(SubmissionDirectory) ? " -submission_directory " + SubmissionDirectory : string.Empty); - } - } -}
