You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ke...@apache.org on 2017/10/26 17:10:59 UTC

[2/6] beam git commit: [BEAM-3005] Add resource limits to provision proto

[BEAM-3005] Add resource limits to provision proto


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/28fbb016
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/28fbb016
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/28fbb016

Branch: refs/heads/master
Commit: 28fbb01604bd4065d954eee73353185fb3a79477
Parents: d5aff5d
Author: Henning Rohde <he...@google.com>
Authored: Fri Oct 20 14:38:54 2017 -0700
Committer: Henning Rohde <he...@google.com>
Committed: Thu Oct 26 08:12:10 2017 -0700

----------------------------------------------------------------------
 .../src/main/proto/beam_provision_api.proto     |  38 +++++
 .../fnexecution_v1/beam_provision_api.pb.go     | 160 ++++++++++++++++---
 2 files changed, 177 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/28fbb016/model/fn-execution/src/main/proto/beam_provision_api.proto
----------------------------------------------------------------------
diff --git a/model/fn-execution/src/main/proto/beam_provision_api.proto b/model/fn-execution/src/main/proto/beam_provision_api.proto
index d203c85..086af10 100644
--- a/model/fn-execution/src/main/proto/beam_provision_api.proto
+++ b/model/fn-execution/src/main/proto/beam_provision_api.proto
@@ -58,4 +58,42 @@ message ProvisionInfo {
     // (required) Pipeline options. For non-template jobs, the options are
     // identical to what is passed to job submission.
     google.protobuf.Struct pipeline_options = 3;
+
+    // (optional) Resource limits that the SDK harness worker should respect.
+    // Runners may -- but are not required to -- enforce any limits provided.
+    Resources resource_limits = 4;
+}
+
+// Resources specify limits for local resources, such memory and cpu. It
+// is used to inform SDK harnesses of their allocated footprint.
+message Resources {
+    // Memory limits.
+    message Memory {
+        // (optional) Hard limit in bytes. A zero value means unspecified.
+        uint64 size = 1;
+
+        // TOOD(herohde) 10/20/2017: consider soft limits, shm usage?
+    }
+    // (optional) Memory usage limits. SDKs can use this value to configure
+    // internal buffer sizes and language specific sizes.
+    Memory memory = 1;
+
+    // CPU limits.
+    message Cpu {
+        // (optional) Shares of a cpu to use. Fractional values, such as "0.2"
+        // or "2.5", are fine. Any value <= 0 means unspecified.
+        float shares = 1;
+
+        // TODO(herohde) 10/20/2017: consider cpuset?
+    }
+    // (optional) CPU usage limits.
+    Cpu cpu = 2;
+
+    // Disk limits.
+    message Disk {
+        // (optional) Hard limit in bytes. A zero value means unspecified.
+        uint64 size = 1;
+    }
+    // (optional) Disk size limits for the semi-persistent location.
+    Disk semi_persistent_disk = 3;
 }

http://git-wip-us.apache.org/repos/asf/beam/blob/28fbb016/sdks/go/pkg/beam/model/fnexecution_v1/beam_provision_api.pb.go
----------------------------------------------------------------------
diff --git a/sdks/go/pkg/beam/model/fnexecution_v1/beam_provision_api.pb.go b/sdks/go/pkg/beam/model/fnexecution_v1/beam_provision_api.pb.go
index ccabfb1..0087fcf 100644
--- a/sdks/go/pkg/beam/model/fnexecution_v1/beam_provision_api.pb.go
+++ b/sdks/go/pkg/beam/model/fnexecution_v1/beam_provision_api.pb.go
@@ -26,6 +26,7 @@ It has these top-level messages:
 	GetProvisionInfoRequest
 	GetProvisionInfoResponse
 	ProvisionInfo
+	Resources
 */
 package fnexecution_v1
 
@@ -86,6 +87,9 @@ type ProvisionInfo struct {
 	// (required) Pipeline options. For non-template jobs, the options are
 	// identical to what is passed to job submission.
 	PipelineOptions *google_protobuf.Struct `protobuf:"bytes,3,opt,name=pipeline_options,json=pipelineOptions" json:"pipeline_options,omitempty"`
+	// (optional) Resource limits that the SDK harness worker should respect.
+	// Runners may -- but are not required to -- enforce any limits provided.
+	ResourceLimits *Resources `protobuf:"bytes,4,opt,name=resource_limits,json=resourceLimits" json:"resource_limits,omitempty"`
 }
 
 func (m *ProvisionInfo) Reset()                    { *m = ProvisionInfo{} }
@@ -114,10 +118,114 @@ func (m *ProvisionInfo) GetPipelineOptions() *google_protobuf.Struct {
 	return nil
 }
 
+func (m *ProvisionInfo) GetResourceLimits() *Resources {
+	if m != nil {
+		return m.ResourceLimits
+	}
+	return nil
+}
+
+// Resources specify limits for local resources, such memory and cpu. It
+// is used to inform SDK harnesses of their allocated footprint.
+type Resources struct {
+	// (optional) Memory usage limits. SDKs can use this value to configure
+	// internal buffer sizes and language specific sizes.
+	Memory *Resources_Memory `protobuf:"bytes,1,opt,name=memory" json:"memory,omitempty"`
+	// (optional) CPU usage limits.
+	Cpu *Resources_Cpu `protobuf:"bytes,2,opt,name=cpu" json:"cpu,omitempty"`
+	// (optional) Disk size limits for the semi-persistent location.
+	SemiPersistentDisk *Resources_Disk `protobuf:"bytes,3,opt,name=semi_persistent_disk,json=semiPersistentDisk" json:"semi_persistent_disk,omitempty"`
+}
+
+func (m *Resources) Reset()                    { *m = Resources{} }
+func (m *Resources) String() string            { return proto.CompactTextString(m) }
+func (*Resources) ProtoMessage()               {}
+func (*Resources) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+
+func (m *Resources) GetMemory() *Resources_Memory {
+	if m != nil {
+		return m.Memory
+	}
+	return nil
+}
+
+func (m *Resources) GetCpu() *Resources_Cpu {
+	if m != nil {
+		return m.Cpu
+	}
+	return nil
+}
+
+func (m *Resources) GetSemiPersistentDisk() *Resources_Disk {
+	if m != nil {
+		return m.SemiPersistentDisk
+	}
+	return nil
+}
+
+// Memory limits.
+type Resources_Memory struct {
+	// (optional) Hard limit in bytes. A zero value means unspecified.
+	Size uint64 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
+}
+
+func (m *Resources_Memory) Reset()                    { *m = Resources_Memory{} }
+func (m *Resources_Memory) String() string            { return proto.CompactTextString(m) }
+func (*Resources_Memory) ProtoMessage()               {}
+func (*Resources_Memory) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} }
+
+func (m *Resources_Memory) GetSize() uint64 {
+	if m != nil {
+		return m.Size
+	}
+	return 0
+}
+
+// CPU limits.
+type Resources_Cpu struct {
+	// (optional) Shares of a cpu to use. Fractional values, such as "0.2"
+	// or "2.5", are fine. Any value <= 0 means unspecified.
+	Shares float32 `protobuf:"fixed32,1,opt,name=shares" json:"shares,omitempty"`
+}
+
+func (m *Resources_Cpu) Reset()                    { *m = Resources_Cpu{} }
+func (m *Resources_Cpu) String() string            { return proto.CompactTextString(m) }
+func (*Resources_Cpu) ProtoMessage()               {}
+func (*Resources_Cpu) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 1} }
+
+func (m *Resources_Cpu) GetShares() float32 {
+	if m != nil {
+		return m.Shares
+	}
+	return 0
+}
+
+// Disk limits.
+type Resources_Disk struct {
+	// (optional) Hard limit in bytes. A zero value means unspecified.
+	Size uint64 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
+}
+
+func (m *Resources_Disk) Reset()                    { *m = Resources_Disk{} }
+func (m *Resources_Disk) String() string            { return proto.CompactTextString(m) }
+func (*Resources_Disk) ProtoMessage()               {}
+func (*Resources_Disk) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 2} }
+
+func (m *Resources_Disk) GetSize() uint64 {
+	if m != nil {
+		return m.Size
+	}
+	return 0
+}
+
 func init() {
 	proto.RegisterType((*GetProvisionInfoRequest)(nil), "org.apache.beam.model.fn_execution.v1.GetProvisionInfoRequest")
 	proto.RegisterType((*GetProvisionInfoResponse)(nil), "org.apache.beam.model.fn_execution.v1.GetProvisionInfoResponse")
 	proto.RegisterType((*ProvisionInfo)(nil), "org.apache.beam.model.fn_execution.v1.ProvisionInfo")
+	proto.RegisterType((*Resources)(nil), "org.apache.beam.model.fn_execution.v1.Resources")
+	proto.RegisterType((*Resources_Memory)(nil), "org.apache.beam.model.fn_execution.v1.Resources.Memory")
+	proto.RegisterType((*Resources_Cpu)(nil), "org.apache.beam.model.fn_execution.v1.Resources.Cpu")
+	proto.RegisterType((*Resources_Disk)(nil), "org.apache.beam.model.fn_execution.v1.Resources.Disk")
 }
 
 // Reference imports to suppress errors if they are not otherwise used.
@@ -197,25 +305,35 @@ var _ProvisionService_serviceDesc = grpc.ServiceDesc{
 func init() { proto.RegisterFile("beam_provision_api.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-	// 311 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x90, 0xcd, 0x4a, 0x03, 0x31,
-	0x14, 0x85, 0x19, 0x7f, 0xaa, 0xc6, 0xbf, 0x12, 0x90, 0x4e, 0x8b, 0x0b, 0x29, 0x0a, 0xae, 0x52,
-	0x5a, 0x5d, 0x2b, 0x16, 0x41, 0xbb, 0x51, 0x69, 0x77, 0x6e, 0x42, 0x32, 0x73, 0xa7, 0xa6, 0x74,
-	0x72, 0xe3, 0x24, 0x33, 0xf8, 0x02, 0x3e, 0x81, 0x2f, 0xe1, 0x63, 0x4a, 0x33, 0x4c, 0x69, 0x95,
-	0x42, 0x71, 0x9b, 0x73, 0xcf, 0x97, 0x73, 0x0e, 0x09, 0x25, 0x88, 0x94, 0x9b, 0x0c, 0x0b, 0x65,
-	0x15, 0x6a, 0x2e, 0x8c, 0x62, 0x26, 0x43, 0x87, 0xf4, 0x02, 0xb3, 0x31, 0x13, 0x46, 0x44, 0x6f,
-	0xc0, 0x66, 0x47, 0x2c, 0xc5, 0x18, 0xa6, 0x2c, 0xd1, 0x1c, 0x3e, 0x20, 0xca, 0x9d, 0x42, 0xcd,
-	0x8a, 0x6e, 0xeb, 0x74, 0x8c, 0x38, 0x9e, 0x42, 0xc7, 0x9b, 0x64, 0x9e, 0x74, 0xac, 0xcb, 0xf2,
-	0xc8, 0x95, 0x90, 0x76, 0x93, 0x34, 0x1e, 0xc0, 0xbd, 0x54, 0xf8, 0x81, 0x4e, 0x70, 0x08, 0xef,
-	0x39, 0x58, 0xd7, 0x8e, 0x49, 0xf8, 0x57, 0xb2, 0x06, 0xb5, 0x05, 0xfa, 0x48, 0xb6, 0x94, 0x4e,
-	0x30, 0x0c, 0xce, 0x82, 0xcb, 0xfd, 0xde, 0x35, 0x5b, 0x2b, 0x0a, 0x5b, 0x66, 0x79, 0x42, 0xfb,
-	0x33, 0x20, 0x87, 0x4b, 0xef, 0xf4, 0x84, 0xd4, 0x26, 0x28, 0xb9, 0x8a, 0x3d, 0x7d, 0x6f, 0xb8,
-	0x3d, 0x41, 0x39, 0x88, 0x69, 0x93, 0xec, 0xce, 0x9e, 0xb5, 0x48, 0x21, 0xdc, 0xf0, 0xc2, 0xce,
-	0x04, 0xe5, 0x93, 0x48, 0x81, 0xf6, 0x49, 0xdd, 0x28, 0x03, 0x53, 0xa5, 0x81, 0xa3, 0x99, 0xfd,
-	0x66, 0xc3, 0x4d, 0x9f, 0xac, 0xc1, 0xca, 0xf6, 0xac, 0x6a, 0xcf, 0x46, 0xbe, 0xfd, 0xf0, 0xb8,
-	0x32, 0x3c, 0x97, 0xf7, 0xbd, 0xef, 0x80, 0xd4, 0xe7, 0x39, 0x46, 0x90, 0x15, 0x2a, 0x02, 0xfa,
-	0x15, 0x90, 0xfa, 0xef, 0x0d, 0xe8, 0xcd, 0x9a, 0x6d, 0x57, 0xec, 0xda, 0xba, 0xfd, 0xb7, 0xbf,
-	0x1c, 0xbf, 0x7f, 0x4f, 0xce, 0x57, 0x11, 0x16, 0x01, 0xfd, 0x83, 0xb9, 0xfd, 0xce, 0xa8, 0xd7,
-	0xa3, 0x05, 0x95, 0x17, 0x5d, 0x59, 0xf3, 0x93, 0x5c, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2e,
-	0xae, 0x1f, 0x23, 0x61, 0x02, 0x00, 0x00,
+	// 469 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcf, 0x6e, 0xd3, 0x40,
+	0x10, 0xc6, 0xe5, 0xc6, 0x18, 0x3a, 0x40, 0x1b, 0xad, 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