http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/Proto/reef_service_protos.proto ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/Proto/reef_service_protos.proto b/lang/cs/Org.Apache.REEF.Common/Protobuf/Proto/reef_service_protos.proto new file mode 100644 index 0000000..a553ca9 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/Proto/reef_service_protos.proto @@ -0,0 +1,117 @@ +/** + * 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. + */ +option java_package = "org.apache.reef.reef.proto"; + +option java_outer_classname = "ReefServiceProtos"; + +option java_generic_services = true; + +option java_generate_equals_and_hash = true; + +enum State { + INIT = 0; + RUNNING = 1; + DONE = 2; + SUSPEND = 3; + FAILED = 4; + KILLED = 5; +} + +enum FileType { + PLAIN = 0; + LIB = 1; + ARCHIVE = 2; +} + +// Removed in REEF 0.3 in favor of explicit memory sizes. +// enum SIZE { +// SMALL = 0; +// MEDIUM = 1; +// LARGE = 2; +// XLARGE = 3; +//} + +enum ProcessType { + JVM = 0; + CLR = 1; +} + +message FileResourceProto { + required FileType type = 1; + required string name = 2; + required string path = 3; +} + +message RuntimeErrorProto { + required string name = 1; // e.g., local, yarn21 + required string message = 2; + optional bytes exception = 3; + + optional string identifier = 5; // e.g., evaluator id +} + +message JobStatusProto { + required string identifier = 1; + required State state = 2; + optional bytes message = 3; + optional bytes exception = 4; +} + +message ContextStatusProto { + enum State { + READY = 0; + DONE = 1; + FAIL = 2; + } + required State context_state = 1; + + required string context_id = 2; + optional string parent_id = 3; + + optional bytes error = 5; // when creating the context + + optional bool recovery = 6; + // Context messages + message ContextMessageProto { + required string source_id = 1; + required bytes message = 2; + } + repeated ContextMessageProto context_message = 7; +} + +message TaskStatusProto { + required string task_id = 1; + required string context_id = 2; + required State state = 3; + optional bytes result = 4; // e.g., return value from Task.call() + optional bool recovery = 5; + + // TaskMessageSource messages + message TaskMessageProto { + required string source_id = 1; + required bytes message = 2; + } + repeated TaskMessageProto task_message = 6; +} + +message EvaluatorStatusProto { + required string evaluator_id = 1; + required State state = 2; + optional bytes error = 3; +}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ClientRuntime.pb.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ClientRuntime.pb.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ClientRuntime.pb.cs new file mode 100644 index 0000000..857332d --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ClientRuntime.pb.cs @@ -0,0 +1,145 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +// Generated from: client_runtime.proto +// Note: requires additional types generated from: reef_service_protos.proto + +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol{ + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"JobSubmissionProto")] + public partial class JobSubmissionProto : global::ProtoBuf.IExtensible + { + public JobSubmissionProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private string _remote_id; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"remote_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string remote_id + { + get { return _remote_id; } + set { _remote_id = value; } + } + private string _configuration; + [global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"configuration", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string configuration + { + get { return _configuration; } + set { _configuration = value; } + } + private string _user_name; + [global::ProtoBuf.ProtoMember(6, IsRequired = true, Name=@"user_name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string user_name + { + get { return _user_name; } + set { _user_name = value; } + } + private SIZE _driver_size = SIZE.SMALL; + [global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"driver_size", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(SIZE.SMALL)] + public SIZE driver_size + { + get { return _driver_size; } + set { _driver_size = value; } + } + private int _driver_memory = default(int); + [global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"driver_memory", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int driver_memory + { + get { return _driver_memory; } + set { _driver_memory = value; } + } + private int _priority = default(int); + [global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"priority", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int priority + { + get { return _priority; } + set { _priority = value; } + } + private string _queue = ""; + [global::ProtoBuf.ProtoMember(10, IsRequired = false, Name=@"queue", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue("")] + public string queue + { + get { return _queue; } + set { _queue = value; } + } + private readonly global::System.Collections.Generic.List<FileResourceProto> _global_file = new global::System.Collections.Generic.List<FileResourceProto>(); + [global::ProtoBuf.ProtoMember(11, Name=@"global_file", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<FileResourceProto> global_file + { + get { return _global_file; } + } + + private readonly global::System.Collections.Generic.List<FileResourceProto> _local_File = new global::System.Collections.Generic.List<FileResourceProto>(); + [global::ProtoBuf.ProtoMember(12, Name=@"local_File", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<FileResourceProto> local_File + { + get { return _local_File; } + } + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"JobControlProto")] + public partial class JobControlProto : global::ProtoBuf.IExtensible + { + public JobControlProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private Signal _signal = Signal.SIG_TERMINATE; + [global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"signal", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(Signal.SIG_TERMINATE)] + public Signal signal + { + get { return _signal; } + set { _signal = value; } + } + private byte[] _message = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"message", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] message + { + get { return _message; } + set { _message = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::ProtoBuf.ProtoContract(Name=@"Signal")] + public enum Signal + { + + [global::ProtoBuf.ProtoEnum(Name=@"SIG_TERMINATE", Value=1)] + SIG_TERMINATE = 1, + + [global::ProtoBuf.ProtoEnum(Name=@"SIG_SUSPEND", Value=2)] + SIG_SUSPEND = 2, + + [global::ProtoBuf.ProtoEnum(Name=@"SIG_RESUME", Value=3)] + SIG_RESUME = 3 + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/DriverRuntime.pb.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/DriverRuntime.pb.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/DriverRuntime.pb.cs new file mode 100644 index 0000000..d778d0d --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/DriverRuntime.pb.cs @@ -0,0 +1,337 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +// Generated from: driver_runtime.proto +// Note: requires additional types generated from: reef_service_protos.proto + +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol +{ + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"DriverProcessRegistrationProto")] + public partial class DriverProcessRegistrationProto : global::ProtoBuf.IExtensible + { + public DriverProcessRegistrationProto() {} + + private string _remote_identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"remote_identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string remote_identifier + { + get { return _remote_identifier; } + set { _remote_identifier = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"NodeDescriptorProto")] + public partial class NodeDescriptorProto : global::ProtoBuf.IExtensible + { + public NodeDescriptorProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private string _host_name; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"host_name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string host_name + { + get { return _host_name; } + set { _host_name = value; } + } + private int _port; + [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"port", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public int port + { + get { return _port; } + set { _port = value; } + } + private int _memory_size; + [global::ProtoBuf.ProtoMember(4, IsRequired = true, Name=@"memory_size", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public int memory_size + { + get { return _memory_size; } + set { _memory_size = value; } + } + private string _rack_name = ""; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"rack_name", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue("")] + public string rack_name + { + get { return _rack_name; } + set { _rack_name = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ResourceAllocationProto")] + public partial class ResourceAllocationProto : global::ProtoBuf.IExtensible + { + public ResourceAllocationProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private int _resource_memory; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"resource_memory", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public int resource_memory + { + get { return _resource_memory; } + set { _resource_memory = value; } + } + private string _node_id; + [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"node_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string node_id + { + get { return _node_id; } + set { _node_id = value; } + } + private int _virtual_cores = default(int); + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"virtual_cores", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int virtual_cores + { + get { return _virtual_cores; } + set { _virtual_cores = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ResourceStatusProto")] + public partial class ResourceStatusProto : global::ProtoBuf.IExtensible + { + public ResourceStatusProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private State _state; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"state", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public State state + { + get { return _state; } + set { _state = value; } + } + private string _diagnostics = ""; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"diagnostics", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue("")] + public string diagnostics + { + get { return _diagnostics; } + set { _diagnostics = value; } + } + private int _exit_code = default(int); + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"exit_code", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int exit_code + { + get { return _exit_code; } + set { _exit_code = value; } + } + private bool _is_from_previous_driver = default(bool); + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"is_from_previous_driver", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(default(bool))] + public bool is_from_previous_driver + { + get { return _is_from_previous_driver; } + set { _is_from_previous_driver = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"RuntimeStatusProto")] + public partial class RuntimeStatusProto : global::ProtoBuf.IExtensible + { + public RuntimeStatusProto() {} + + private string _name; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string name + { + get { return _name; } + set { _name = value; } + } + private State _state; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"state", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public State state + { + get { return _state; } + set { _state = value; } + } + private RuntimeErrorProto _error = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"error", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public RuntimeErrorProto error + { + get { return _error; } + set { _error = value; } + } + private int _outstanding_container_requests = default(int); + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"outstanding_container_requests", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int outstanding_container_requests + { + get { return _outstanding_container_requests; } + set { _outstanding_container_requests = value; } + } + private readonly global::System.Collections.Generic.List<string> _container_allocation = new global::System.Collections.Generic.List<string>(); + [global::ProtoBuf.ProtoMember(6, Name=@"container_allocation", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<string> container_allocation + { + get { return _container_allocation; } + } + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ResourceRequestProto")] + public partial class ResourceRequestProto : global::ProtoBuf.IExtensible + { + public ResourceRequestProto() {} + + private int _memory_size = default(int); + [global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"memory_size", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int memory_size + { + get { return _memory_size; } + set { _memory_size = value; } + } + private int _priority = default(int); + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"priority", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int priority + { + get { return _priority; } + set { _priority = value; } + } + private int _virtual_cores = default(int); + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"virtual_cores", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + [global::System.ComponentModel.DefaultValue(default(int))] + public int virtual_cores + { + get { return _virtual_cores; } + set { _virtual_cores = value; } + } + private int _resource_count; + [global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"resource_count", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public int resource_count + { + get { return _resource_count; } + set { _resource_count = value; } + } + private readonly global::System.Collections.Generic.List<string> _node_name = new global::System.Collections.Generic.List<string>(); + [global::ProtoBuf.ProtoMember(6, Name=@"node_name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<string> node_name + { + get { return _node_name; } + } + + private readonly global::System.Collections.Generic.List<string> _rack_name = new global::System.Collections.Generic.List<string>(); + [global::ProtoBuf.ProtoMember(7, Name=@"rack_name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<string> rack_name + { + get { return _rack_name; } + } + + private bool _relax_locality = default(bool); + [global::ProtoBuf.ProtoMember(10, IsRequired = false, Name=@"relax_locality", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(default(bool))] + public bool relax_locality + { + get { return _relax_locality; } + set { _relax_locality = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ResourceReleaseProto")] + public partial class ResourceReleaseProto : global::ProtoBuf.IExtensible + { + public ResourceReleaseProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ResourceLaunchProto")] + public partial class ResourceLaunchProto : global::ProtoBuf.IExtensible + { + public ResourceLaunchProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private string _remote_id; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"remote_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string remote_id + { + get { return _remote_id; } + set { _remote_id = value; } + } + private string _evaluator_conf; + [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"evaluator_conf", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string evaluator_conf + { + get { return _evaluator_conf; } + set { _evaluator_conf = value; } + } + private ProcessType _type; + [global::ProtoBuf.ProtoMember(4, IsRequired = true, Name=@"type", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public ProcessType type + { + get { return _type; } + set { _type = value; } + } + private readonly global::System.Collections.Generic.List<FileResourceProto> _file = new global::System.Collections.Generic.List<FileResourceProto>(); + [global::ProtoBuf.ProtoMember(10, Name=@"file", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<FileResourceProto> file + { + get { return _file; } + } + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorHeartbeatProtoCodec.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorHeartbeatProtoCodec.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorHeartbeatProtoCodec.cs new file mode 100644 index 0000000..93b6330 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorHeartbeatProtoCodec.cs @@ -0,0 +1,40 @@ +/** + * 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.Wake.Remote; + +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol +{ + public class EvaluatorHeartbeatProtoCodec : ICodec<EvaluatorHeartbeatProto> + { + public byte[] Encode(EvaluatorHeartbeatProto obj) + { + EvaluatorHeartbeatProto pbuf = new EvaluatorHeartbeatProto(); + + pbuf.evaluator_status = obj.evaluator_status; + return pbuf.Serialize(); + } + + public EvaluatorHeartbeatProto Decode(byte[] data) + { + EvaluatorHeartbeatProto pbuf = EvaluatorHeartbeatProto.Deserialize(data); + return pbuf; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorRunTime.pb.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorRunTime.pb.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorRunTime.pb.cs new file mode 100644 index 0000000..931d221 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/EvaluatorRunTime.pb.cs @@ -0,0 +1,304 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +// Generated from: evaluator_runtime.proto +// Note: requires additional types generated from: reef_service_protos.proto +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol +{ + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"StopEvaluatorProto")] + public partial class StopEvaluatorProto : global::ProtoBuf.IExtensible + { + public StopEvaluatorProto() {} + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"KillEvaluatorProto")] + public partial class KillEvaluatorProto : global::ProtoBuf.IExtensible + { + public KillEvaluatorProto() {} + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"StartTaskProto")] + public partial class StartTaskProto : global::ProtoBuf.IExtensible + { + public StartTaskProto() {} + + private string _context_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"context_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string context_id + { + get { return _context_id; } + set { _context_id = value; } + } + private string _configuration; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"configuration", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string configuration + { + get { return _configuration; } + set { _configuration = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"AddContextProto")] + public partial class AddContextProto : global::ProtoBuf.IExtensible + { + public AddContextProto() {} + + private string _parent_context_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"parent_context_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string parent_context_id + { + get { return _parent_context_id; } + set { _parent_context_id = value; } + } + private string _context_configuration; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"context_configuration", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string context_configuration + { + get { return _context_configuration; } + set { _context_configuration = value; } + } + private string _service_configuration = ""; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"service_configuration", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue("")] + public string service_configuration + { + get { return _service_configuration; } + set { _service_configuration = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"RemoveContextProto")] + public partial class RemoveContextProto : global::ProtoBuf.IExtensible + { + public RemoveContextProto() {} + + private string _context_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"context_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string context_id + { + get { return _context_id; } + set { _context_id = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"StopTaskProto")] + public partial class StopTaskProto : global::ProtoBuf.IExtensible + { + public StopTaskProto() {} + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"SuspendTaskProto")] + public partial class SuspendTaskProto : global::ProtoBuf.IExtensible + { + public SuspendTaskProto() {} + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ContextMessageProto")] + public partial class ContextMessageProto : global::ProtoBuf.IExtensible + { + public ContextMessageProto() {} + + private string _context_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"context_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string context_id + { + get { return _context_id; } + set { _context_id = value; } + } + private byte[] _message; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"message", DataFormat = global::ProtoBuf.DataFormat.Default)] + public byte[] message + { + get { return _message; } + set { _message = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ContextControlProto")] + public partial class ContextControlProto : global::ProtoBuf.IExtensible + { + public ContextControlProto() {} + + private byte[] _task_message = null; + [global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"task_message", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] task_message + { + get { return _task_message; } + set { _task_message = value; } + } + private ContextMessageProto _context_message = null; + [global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"context_message", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public ContextMessageProto context_message + { + get { return _context_message; } + set { _context_message = value; } + } + private AddContextProto _add_context = null; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"add_context", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public AddContextProto add_context + { + get { return _add_context; } + set { _add_context = value; } + } + private RemoveContextProto _remove_context = null; + [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"remove_context", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public RemoveContextProto remove_context + { + get { return _remove_context; } + set { _remove_context = value; } + } + private StartTaskProto _start_task = null; + [global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"start_task", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public StartTaskProto start_task + { + get { return _start_task; } + set { _start_task = value; } + } + private StopTaskProto _stop_task = null; + [global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"stop_task", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public StopTaskProto stop_task + { + get { return _stop_task; } + set { _stop_task = value; } + } + private SuspendTaskProto _suspend_task = null; + [global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"suspend_task", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public SuspendTaskProto suspend_task + { + get { return _suspend_task; } + set { _suspend_task = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EvaluatorHeartbeatProto")] + public partial class EvaluatorHeartbeatProto : global::ProtoBuf.IExtensible + { + public EvaluatorHeartbeatProto() {} + + private long _timestamp; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"timestamp", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public long timestamp + { + get { return _timestamp; } + set { _timestamp = value; } + } + private EvaluatorStatusProto _evaluator_status; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"evaluator_status", DataFormat = global::ProtoBuf.DataFormat.Default)] + public EvaluatorStatusProto evaluator_status + { + get { return _evaluator_status; } + set { _evaluator_status = value; } + } + private readonly global::System.Collections.Generic.List<ContextStatusProto> _context_status = new global::System.Collections.Generic.List<ContextStatusProto>(); + [global::ProtoBuf.ProtoMember(3, Name=@"context_status", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<ContextStatusProto> context_status + { + get { return _context_status; } + } + + private TaskStatusProto _task_status = null; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"task_status", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public TaskStatusProto task_status + { + get { return _task_status; } + set { _task_status = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + + private bool _recovery; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name = @"recovery", DataFormat = global::ProtoBuf.DataFormat.Default)] + public bool recovery + { + get { return _recovery; } + set { _recovery = value; } + } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EvaluatorControlProto")] + public partial class EvaluatorControlProto : global::ProtoBuf.IExtensible + { + public EvaluatorControlProto() {} + + private long _timestamp; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"timestamp", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public long timestamp + { + get { return _timestamp; } + set { _timestamp = value; } + } + private string _identifier; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private ContextControlProto _context_control = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"context_control", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public ContextControlProto context_control + { + get { return _context_control; } + set { _context_control = value; } + } + private KillEvaluatorProto _kill_evaluator = null; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"kill_evaluator", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public KillEvaluatorProto kill_evaluator + { + get { return _kill_evaluator; } + set { _kill_evaluator = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/REEFMessageCodec.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/REEFMessageCodec.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/REEFMessageCodec.cs new file mode 100644 index 0000000..e8c7515 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/REEFMessageCodec.cs @@ -0,0 +1,37 @@ +/** + * 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.Wake.Remote; + +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol +{ + public class REEFMessageCodec : ICodec<REEFMessage> + { + public byte[] Encode(REEFMessage obj) + { + return obj.Serialize(); + } + + public REEFMessage Decode(byte[] data) + { + REEFMessage pbuf = REEFMessage.Deserialize(data); + return pbuf; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefProtocol.pb.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefProtocol.pb.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefProtocol.pb.cs new file mode 100644 index 0000000..93fee85 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefProtocol.pb.cs @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +// Generated from: reef_protocol.proto +// Note: requires additional types generated from: client_runtime.proto +// Note: requires additional types generated from: evaluator_runtime.proto +// Note: requires additional types generated from: reef_service_protos.proto + +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol +{ + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"REEFMessage")] + public partial class REEFMessage : global::ProtoBuf.IExtensible + { + public REEFMessage() {} + + private JobSubmissionProto _jobSubmission = null; + [global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"jobSubmission", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public JobSubmissionProto jobSubmission + { + get { return _jobSubmission; } + set { _jobSubmission = value; } + } + private JobControlProto _jobControl = null; + [global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"jobControl", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public JobControlProto jobControl + { + get { return _jobControl; } + set { _jobControl = value; } + } + private RuntimeErrorProto _runtimeError = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"runtimeError", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public RuntimeErrorProto runtimeError + { + get { return _runtimeError; } + set { _runtimeError = value; } + } + private JobStatusProto _jobStatus = null; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"jobStatus", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public JobStatusProto jobStatus + { + get { return _jobStatus; } + set { _jobStatus = value; } + } + private EvaluatorControlProto _evaluatorControl = null; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"evaluatorControl", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public EvaluatorControlProto evaluatorControl + { + get { return _evaluatorControl; } + set { _evaluatorControl = value; } + } + private EvaluatorHeartbeatProto _evaluatorHeartBeat = null; + [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"evaluatorHeartBeat", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public EvaluatorHeartbeatProto evaluatorHeartBeat + { + get { return _evaluatorHeartBeat; } + set { _evaluatorHeartBeat = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefService.pb.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefService.pb.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefService.pb.cs new file mode 100644 index 0000000..bff57f5 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/ReefService.pb.cs @@ -0,0 +1,393 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +// Generated from: reef_service_protos.proto +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol + +{ + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"FileResourceProto")] + public partial class FileResourceProto : global::ProtoBuf.IExtensible + { + public FileResourceProto() {} + + private FileType _type; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"type", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public FileType type + { + get { return _type; } + set { _type = value; } + } + private string _name; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string name + { + get { return _name; } + set { _name = value; } + } + private string _path; + [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"path", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string path + { + get { return _path; } + set { _path = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"RuntimeErrorProto")] + public partial class RuntimeErrorProto : global::ProtoBuf.IExtensible + { + public RuntimeErrorProto() {} + + private string _name; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string name + { + get { return _name; } + set { _name = value; } + } + private string _message; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"message", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string message + { + get { return _message; } + set { _message = value; } + } + private byte[] _exception = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"exception", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] exception + { + get { return _exception; } + set { _exception = value; } + } + private string _identifier = ""; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue("")] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"JobStatusProto")] + public partial class JobStatusProto : global::ProtoBuf.IExtensible + { + public JobStatusProto() {} + + private string _identifier; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"identifier", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string identifier + { + get { return _identifier; } + set { _identifier = value; } + } + private State _state; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"state", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public State state + { + get { return _state; } + set { _state = value; } + } + private byte[] _message = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"message", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] message + { + get { return _message; } + set { _message = value; } + } + private byte[] _exception = null; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"exception", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] exception + { + get { return _exception; } + set { _exception = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ContextStatusProto")] + public partial class ContextStatusProto : global::ProtoBuf.IExtensible + { + public ContextStatusProto() {} + + private ContextStatusProto.State _context_state; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"context_state", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public ContextStatusProto.State context_state + { + get { return _context_state; } + set { _context_state = value; } + } + private string _context_id; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"context_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string context_id + { + get { return _context_id; } + set { _context_id = value; } + } + private string _parent_id = ""; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"parent_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue("")] + public string parent_id + { + get { return _parent_id; } + set { _parent_id = value; } + } + private byte[] _error = null; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"error", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] error + { + get { return _error; } + set { _error = value; } + } + private bool _recovery = false; + [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name = @"recovery", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(false)] + public bool recovery + { + get { return _recovery; } + set { _recovery = value; } + } + private readonly global::System.Collections.Generic.List<ContextStatusProto.ContextMessageProto> _context_message = new global::System.Collections.Generic.List<ContextStatusProto.ContextMessageProto>(); + [global::ProtoBuf.ProtoMember(7, Name=@"context_message", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<ContextStatusProto.ContextMessageProto> context_message + { + get { return _context_message; } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ContextMessageProto")] + public partial class ContextMessageProto : global::ProtoBuf.IExtensible + { + public ContextMessageProto() {} + + private string _source_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"source_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string source_id + { + get { return _source_id; } + set { _source_id = value; } + } + private byte[] _message; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"message", DataFormat = global::ProtoBuf.DataFormat.Default)] + public byte[] message + { + get { return _message; } + set { _message = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::ProtoBuf.ProtoContract(Name=@"State")] + public enum State + { + + [global::ProtoBuf.ProtoEnum(Name=@"READY", Value=0)] + READY = 0, + + [global::ProtoBuf.ProtoEnum(Name=@"DONE", Value=1)] + DONE = 1, + + [global::ProtoBuf.ProtoEnum(Name=@"FAIL", Value=2)] + FAIL = 2 + } + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"TaskStatusProto")] + public partial class TaskStatusProto : global::ProtoBuf.IExtensible + { + public TaskStatusProto() {} + + private string _task_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"task_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string task_id + { + get { return _task_id; } + set { _task_id = value; } + } + private string _context_id; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"context_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string context_id + { + get { return _context_id; } + set { _context_id = value; } + } + private State _state; + [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"state", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public State state + { + get { return _state; } + set { _state = value; } + } + private byte[] _result = null; + [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"result", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] result + { + get { return _result; } + set { _result = value; } + } + private bool _recovery = false; + [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name = @"recovery", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(false)] + public bool recovery + { + get { return _recovery; } + set { _recovery = value; } + } + private readonly global::System.Collections.Generic.List<TaskStatusProto.TaskMessageProto> _task_message = new global::System.Collections.Generic.List<TaskStatusProto.TaskMessageProto>(); + [global::ProtoBuf.ProtoMember(6, Name=@"task_message", DataFormat = global::ProtoBuf.DataFormat.Default)] + public global::System.Collections.Generic.List<TaskStatusProto.TaskMessageProto> task_message + { + get { return _task_message; } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"TaskMessageProto")] + public partial class TaskMessageProto : global::ProtoBuf.IExtensible + { + public TaskMessageProto() {} + + private string _source_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"source_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string source_id + { + get { return _source_id; } + set { _source_id = value; } + } + private byte[] _message; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"message", DataFormat = global::ProtoBuf.DataFormat.Default)] + public byte[] message + { + get { return _message; } + set { _message = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EvaluatorStatusProto")] + public partial class EvaluatorStatusProto : global::ProtoBuf.IExtensible + { + public EvaluatorStatusProto() {} + + private string _evaluator_id; + [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"evaluator_id", DataFormat = global::ProtoBuf.DataFormat.Default)] + public string evaluator_id + { + get { return _evaluator_id; } + set { _evaluator_id = value; } + } + private State _state; + [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"state", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)] + public State state + { + get { return _state; } + set { _state = value; } + } + private byte[] _error = null; + [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"error", DataFormat = global::ProtoBuf.DataFormat.Default)] + [global::System.ComponentModel.DefaultValue(null)] + public byte[] error + { + get { return _error; } + set { _error = value; } + } + private global::ProtoBuf.IExtension extensionObject; + global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) + { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } + } + + [global::ProtoBuf.ProtoContract(Name=@"State")] + public enum State + { + + [global::ProtoBuf.ProtoEnum(Name=@"INIT", Value=0)] + INIT = 0, + + [global::ProtoBuf.ProtoEnum(Name=@"RUNNING", Value=1)] + RUNNING = 1, + + [global::ProtoBuf.ProtoEnum(Name=@"DONE", Value=2)] + DONE = 2, + + [global::ProtoBuf.ProtoEnum(Name=@"SUSPEND", Value=3)] + SUSPEND = 3, + + [global::ProtoBuf.ProtoEnum(Name=@"FAILED", Value=4)] + FAILED = 4, + + [global::ProtoBuf.ProtoEnum(Name=@"KILLED", Value=5)] + KILLED = 5 + } + + [global::ProtoBuf.ProtoContract(Name=@"FileType")] + public enum FileType + { + + [global::ProtoBuf.ProtoEnum(Name=@"PLAIN", Value=0)] + PLAIN = 0, + + [global::ProtoBuf.ProtoEnum(Name=@"LIB", Value=1)] + LIB = 1, + + [global::ProtoBuf.ProtoEnum(Name=@"ARCHIVE", Value=2)] + ARCHIVE = 2 + } + + [global::ProtoBuf.ProtoContract(Name=@"SIZE")] + public enum SIZE + { + + [global::ProtoBuf.ProtoEnum(Name=@"SMALL", Value=0)] + SMALL = 0, + + [global::ProtoBuf.ProtoEnum(Name=@"MEDIUM", Value=1)] + MEDIUM = 1, + + [global::ProtoBuf.ProtoEnum(Name=@"LARGE", Value=2)] + LARGE = 2, + + [global::ProtoBuf.ProtoEnum(Name=@"XLARGE", Value=3)] + XLARGE = 3 + } + + [global::ProtoBuf.ProtoContract(Name=@"ProcessType")] + public enum ProcessType + { + + [global::ProtoBuf.ProtoEnum(Name=@"JVM", Value=0)] + JVM = 0, + + [global::ProtoBuf.ProtoEnum(Name=@"CLR", Value=1)] + CLR = 1 + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/Serializer.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/Serializer.cs b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/Serializer.cs new file mode 100644 index 0000000..093d0d3 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Protobuf/ReefProtocol/Serializer.cs @@ -0,0 +1,123 @@ +/** + * 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.CodeAnalysis; +using System.Globalization; +using System.IO; +using Org.Apache.REEF.Utilities; +using ProtoBuf; + +[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1403:FileMayOnlyContainASingleNamespace", Justification = "Serializers for all protobuf types")] +[module: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Serializers for all protobuf types")] + +namespace Org.Apache.REEF.Common.Protobuf.ReefProtocol +{ + /// <summary> + /// Add serializer/deserializer to REEFMessage + /// </summary> + public partial class REEFMessage + { + public REEFMessage(EvaluatorHeartbeatProto evaluatorHeartbeatProto) + { + _evaluatorHeartBeat = evaluatorHeartbeatProto; + } + + public static REEFMessage Deserialize(byte[] bytes) + { + REEFMessage pbuf = null; + using (var s = new MemoryStream(bytes)) + { + pbuf = Serializer.Deserialize<REEFMessage>(s); + } + return pbuf; + } + + public byte[] Serialize() + { + byte[] b = null; + using (var s = new MemoryStream()) + { + Serializer.Serialize<REEFMessage>(s, this); + b = new byte[s.Position]; + var fullBuffer = s.GetBuffer(); + Array.Copy(fullBuffer, b, b.Length); + } + return b; + } + } + + /// <summary> + /// Add serializer/deserializer to EvaluatorHeartbeatProto + /// </summary> + public partial class EvaluatorHeartbeatProto + { + public static EvaluatorHeartbeatProto Deserialize(byte[] bytes) + { + EvaluatorHeartbeatProto pbuf = null; + using (var s = new MemoryStream(bytes)) + { + pbuf = Serializer.Deserialize<EvaluatorHeartbeatProto>(s); + } + return pbuf; + } + + public byte[] Serialize() + { + byte[] b = null; + using (var s = new MemoryStream()) + { + Serializer.Serialize<EvaluatorHeartbeatProto>(s, this); + b = new byte[s.Position]; + var fullBuffer = s.GetBuffer(); + Array.Copy(fullBuffer, b, b.Length); + } + return b; + } + + public override string ToString() + { + string contextStatus = string.Empty; + string taskStatusMessage = string.Empty; + foreach (ContextStatusProto contextStatusProto in context_status) + { + contextStatus += string.Format(CultureInfo.InvariantCulture, "evaluator {0} has context {1} in state {2} with recovery flag {3}", + evaluator_status.evaluator_id, + contextStatusProto.context_id, + contextStatusProto.context_state, + contextStatusProto.recovery); + } + if (task_status != null && task_status.task_message != null && task_status.task_message.Count > 0) + { + foreach (TaskStatusProto.TaskMessageProto taskMessageProto in task_status.task_message) + { + taskStatusMessage += ByteUtilities.ByteArrarysToString(taskMessageProto.message); + } + } + return string.Format(CultureInfo.InvariantCulture, "EvaluatorHeartbeatProto: task_id=[{0}], task_status=[{1}], task_message=[{2}], evaluator_status=[{3}], context_status=[{4}], timestamp=[{5}], recoveryFlag =[{6}]", + task_status == null ? string.Empty : task_status.task_id, + task_status == null ? string.Empty : task_status.state.ToString(), + taskStatusMessage, + evaluator_status.state.ToString(), + contextStatus, + timestamp, + recovery); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Constants.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Constants.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Constants.cs new file mode 100644 index 0000000..4683f7f --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Constants.cs @@ -0,0 +1,40 @@ +/** + * 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.Common.Runtime.Evaluator +{ + public class Constants + { + public const string RootContextConfiguration = "RootContextConfiguration"; + + public const string EvaluatorIdentifier = "EvaluatorIdentifier"; + + public const string RootServiceConfiguration = "RootServiceConfiguration"; + + public const string TaskConfiguration = "TaskConfiguration"; + + public const string ContextIdentifier = "ContextIdentifier"; + + public const string ApplicationIdentifier = "ApplicationIdentifier"; + + public const int DefaultEvaluatorHeartbeatPeriodInMs = 4000; + + public const int DefaultEvaluatorHeartbeatMaxRetry = 3; + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextClientCodeException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextClientCodeException.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextClientCodeException.cs new file mode 100644 index 0000000..16375a1 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextClientCodeException.cs @@ -0,0 +1,70 @@ +/** + * 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.Tang.Interface; +using Org.Apache.REEF.Utilities; + +namespace Org.Apache.REEF.Common.Runtime.Evaluator.Context +{ + public class ContextClientCodeException : Exception + { + private readonly string _contextId; + private readonly Optional<string> _parentId; + + /// <summary> + /// construt the exception that caused the error + /// </summary> + /// <param name="contextId"> the id of the failed context.</param> + /// <param name="parentId"> the id of the failed context's parent, if any.</param> + /// <param name="message"> the error message </param> + /// <param name="cause"> the exception that caused the error</param> + public ContextClientCodeException( + string contextId, + Optional<string> parentId, + string message, + Exception cause) + : base("Failure in context '" + contextId + "': " + message, cause) + { + _contextId = contextId; + _parentId = parentId; + } + + public string ContextId + { + get { return _contextId; } + } + + public Optional<string> ParentId + { + get { return _parentId; } + } + + /// <summary> + /// Extracts a context id from the given configuration. + /// </summary> + /// <param name="c"></param> + /// <returns>the context id in the given configuration.</returns> + public static string GetId(IConfiguration c) + { + // TODO: update after TANG is available + return string.Empty; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextConfiguration.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextConfiguration.cs new file mode 100644 index 0000000..7191924 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextConfiguration.cs @@ -0,0 +1,140 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using Org.Apache.REEF.Tang.Formats.AvroConfigurationDataContract; +using Org.Apache.REEF.Tang.Interface; +using Org.Apache.REEF.Tang.Types; +using Org.Apache.REEF.Utilities.Logging; + +namespace Org.Apache.REEF.Common.Runtime.Evaluator.Context +{ + public class ContextConfiguration : IConfiguration + { + private static readonly Logger LOGGER = Logger.GetLogger(typeof(ContextConfiguration)); + + private Dictionary<string, string> _settings; + + public ContextConfiguration(string configString) + { + using (LOGGER.LogFunction("ContextConfiguration::ContextConfigurationn")) + { + ContainerDirectory = Directory.GetCurrentDirectory(); + + _settings = new Dictionary<string, string>(); + AvroConfiguration avroConfiguration = AvroConfiguration.GetAvroConfigurationFromEmbeddedString(configString); + foreach (ConfigurationEntry config in avroConfiguration.Bindings) + { + if (config.key.Contains(Constants.ContextIdentifier)) + { + config.key = Constants.ContextIdentifier; + LOGGER.Log(Level.Verbose, string.Format(CultureInfo.InvariantCulture, "{0} detected for context id with value {1}", config.key, config.value)); + } + _settings.Add(config.key, config.value); + } + if (!_settings.ContainsKey(Constants.ContextIdentifier)) + { + string msg = "Required parameter ContextIdentifier not provided."; + LOGGER.Log(Level.Error, msg); + Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException(msg), LOGGER); + } + } + } + + public string Id + { + get { return _settings[Constants.ContextIdentifier]; } + } + + public string ContainerDirectory { get; set; } + + public IConfigurationBuilder newBuilder() + { + throw new NotImplementedException(); + } + + public string GetNamedParameter(INamedParameterNode np) + { + throw new NotImplementedException(); + } + + public IClassHierarchy GetClassHierarchy() + { + throw new NotImplementedException(); + } + + public ISet<object> GetBoundSet(INamedParameterNode np) + { + throw new NotImplementedException(); + } + + public IClassNode GetBoundConstructor(IClassNode cn) + { + throw new NotImplementedException(); + } + + public IClassNode GetBoundImplementation(IClassNode cn) + { + throw new NotImplementedException(); + } + + public IConstructorDef GetLegacyConstructor(IClassNode cn) + { + throw new NotImplementedException(); + } + + public ICollection<IClassNode> GetBoundImplementations() + { + throw new NotImplementedException(); + } + + public ICollection<IClassNode> GetBoundConstructors() + { + throw new NotImplementedException(); + } + + public ICollection<INamedParameterNode> GetNamedParameters() + { + throw new NotImplementedException(); + } + + public ICollection<IClassNode> GetLegacyConstructors() + { + throw new NotImplementedException(); + } + + public IList<object> GetBoundList(INamedParameterNode np) + { + throw new NotImplementedException(); + } + + public IEnumerator<KeyValuePair<INamedParameterNode, object>> GetBoundSets() + { + throw new NotImplementedException(); + } + + public IDictionary<INamedParameterNode, IList<object>> GetBoundList() + { + throw new NotImplementedException(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7edb8570/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextLifeCycle.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextLifeCycle.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextLifeCycle.cs new file mode 100644 index 0000000..a6e6b4a --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextLifeCycle.cs @@ -0,0 +1,106 @@ +/** + * 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.Common.Context; +using Org.Apache.REEF.Common.Events; + +namespace Org.Apache.REEF.Common.Runtime.Evaluator.Context +{ + /// <summary> + /// This class is used to trigger all the context life-cycle dependent events. + /// </summary> + class ContextLifeCycle + { + private HashSet<IObserver<IContextStart>> _contextStartHandlers; + + private HashSet<IObserver<IContextStop>> _contextStopHandlers; + + private HashSet<IContextMessageSource> _contextMessageSources; + + // @Inject + public ContextLifeCycle( + string id, + HashSet<IObserver<IContextStart>> contextStartHandlers, + HashSet<IObserver<IContextStop>> contextStopHandlers, + HashSet<IContextMessageSource> contextMessageSources) + { + Id = id; + _contextStartHandlers = contextStartHandlers; + _contextStopHandlers = contextStopHandlers; + _contextMessageSources = contextMessageSources; + } + + public ContextLifeCycle(string contextId) + { + Id = contextId; + _contextStartHandlers = new HashSet<IObserver<IContextStart>>(); + _contextStopHandlers = new HashSet<IObserver<IContextStop>>(); + _contextMessageSources = new HashSet<IContextMessageSource>(); + } + + public string Id { get; private set; } + + public HashSet<IContextMessageSource> ContextMessageSources + { + get { return _contextMessageSources; } + } + + /// <summary> + /// Fires ContextStart to all registered event handlers. + /// </summary> + public void Start() + { + IContextStart contextStart = new ContextStartImpl(Id); + + // TODO: enable + //foreach (IObserver<IContextStart> startHandler in _contextStartHandlers) + //{ + // startHandler.OnNext(contextStart); + //} + } + + /// <summary> + /// Fires ContextStop to all registered event handlers. + /// </summary> + public void Close() + { + //IContextStop contextStop = new ContextStopImpl(Id); + //foreach (IObserver<IContextStop> startHandler in _contextStopHandlers) + //{ + // startHandler.OnNext(contextStop); + //} + } + + public void HandleContextMessage(byte[] message) + { + //contextMessageHandler.onNext(message); + } + + /// <summary> + /// get the set of ContextMessageSources configured + /// </summary> + /// <returns>(a shallow copy of) the set of ContextMessageSources configured.</returns> + public HashSet<IContextMessageSource> GetContextMessageSources() + { + return new HashSet<IContextMessageSource>(_contextMessageSources); + } + } +}
