Class ResourceSpecification.Builder (0.2.0)

public static final class ResourceSpecification.Builder extends GeneratedMessageV3.Builder<ResourceSpecification.Builder> implements ResourceSpecificationOrBuilder

ResourceSpec collects a set of resources that can be used to specify requests and requirements.

Note: Highly experimental as this can be runtime dependent. Can use the "extras" field to experiment first before trying to abstract it.

Protobuf type google.cloud.visionai.v1.ResourceSpecification

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public ResourceSpecification.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
ResourceSpecification.Builder
Overrides

build()

public ResourceSpecification build()
Returns
Type Description
ResourceSpecification

buildPartial()

public ResourceSpecification buildPartial()
Returns
Type Description
ResourceSpecification

clear()

public ResourceSpecification.Builder clear()
Returns
Type Description
ResourceSpecification.Builder
Overrides

clearCpu()

public ResourceSpecification.Builder clearCpu()

CPU specification.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to let the system decide.

Note that this does not determine the cpu vender/make, or its underlying clock speed and specific SIMD features. It is only the amount time it requires in timeslicing.

string cpu = 1;

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

clearCpuLimits()

public ResourceSpecification.Builder clearCpuLimits()

CPU limit.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to indicate no limit.

string cpu_limits = 5;

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public ResourceSpecification.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
ResourceSpecification.Builder
Overrides

clearGpus()

public ResourceSpecification.Builder clearGpus()

Number of gpus.

int32 gpus = 3;

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

clearLatencyBudgetMs()

public ResourceSpecification.Builder clearLatencyBudgetMs()

The maximum latency that this operator may use to process an element.

If non positive, then a system default will be used. Operator developers should arrange for the system compute resources to be aligned with this latency budget; e.g. if you want a ML model to produce results within 500ms, then you should make sure you request enough cpu/gpu/memory to achieve that.

int32 latency_budget_ms = 4;

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

clearMemory()

public ResourceSpecification.Builder clearMemory()

Memory specification (in bytes).

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to let the system decide.

string memory = 2;

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

clearMemoryLimits()

public ResourceSpecification.Builder clearMemoryLimits()

Memory usage limits.

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to indicate no limit.

string memory_limits = 6;

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public ResourceSpecification.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
ResourceSpecification.Builder
Overrides

clone()

public ResourceSpecification.Builder clone()
Returns
Type Description
ResourceSpecification.Builder
Overrides

getCpu()

public String getCpu()

CPU specification.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to let the system decide.

Note that this does not determine the cpu vender/make, or its underlying clock speed and specific SIMD features. It is only the amount time it requires in timeslicing.

string cpu = 1;

Returns
Type Description
String

The cpu.

getCpuBytes()

public ByteString getCpuBytes()

CPU specification.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to let the system decide.

Note that this does not determine the cpu vender/make, or its underlying clock speed and specific SIMD features. It is only the amount time it requires in timeslicing.

string cpu = 1;

Returns
Type Description
ByteString

The bytes for cpu.

getCpuLimits()

public String getCpuLimits()

CPU limit.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to indicate no limit.

string cpu_limits = 5;

Returns
Type Description
String

The cpuLimits.

getCpuLimitsBytes()

public ByteString getCpuLimitsBytes()

CPU limit.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to indicate no limit.

string cpu_limits = 5;

Returns
Type Description
ByteString

The bytes for cpuLimits.

getDefaultInstanceForType()

public ResourceSpecification getDefaultInstanceForType()
Returns
Type Description
ResourceSpecification

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getGpus()

public int getGpus()

Number of gpus.

int32 gpus = 3;

Returns
Type Description
int

The gpus.

getLatencyBudgetMs()

public int getLatencyBudgetMs()

The maximum latency that this operator may use to process an element.

If non positive, then a system default will be used. Operator developers should arrange for the system compute resources to be aligned with this latency budget; e.g. if you want a ML model to produce results within 500ms, then you should make sure you request enough cpu/gpu/memory to achieve that.

int32 latency_budget_ms = 4;

Returns
Type Description
int

The latencyBudgetMs.

getMemory()

public String getMemory()

Memory specification (in bytes).

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to let the system decide.

string memory = 2;

Returns
Type Description
String

The memory.

getMemoryBytes()

public ByteString getMemoryBytes()

Memory specification (in bytes).

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to let the system decide.

string memory = 2;

Returns
Type Description
ByteString

The bytes for memory.

getMemoryLimits()

public String getMemoryLimits()

Memory usage limits.

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to indicate no limit.

string memory_limits = 6;

Returns
Type Description
String

The memoryLimits.

getMemoryLimitsBytes()

public ByteString getMemoryLimitsBytes()

Memory usage limits.

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to indicate no limit.

string memory_limits = 6;

Returns
Type Description
ByteString

The bytes for memoryLimits.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(ResourceSpecification other)

public ResourceSpecification.Builder mergeFrom(ResourceSpecification other)
Parameter
Name Description
other ResourceSpecification
Returns
Type Description
ResourceSpecification.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public ResourceSpecification.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ResourceSpecification.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public ResourceSpecification.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
ResourceSpecification.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final ResourceSpecification.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
ResourceSpecification.Builder
Overrides

setCpu(String value)

public ResourceSpecification.Builder setCpu(String value)

CPU specification.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to let the system decide.

Note that this does not determine the cpu vender/make, or its underlying clock speed and specific SIMD features. It is only the amount time it requires in timeslicing.

string cpu = 1;

Parameter
Name Description
value String

The cpu to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setCpuBytes(ByteString value)

public ResourceSpecification.Builder setCpuBytes(ByteString value)

CPU specification.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to let the system decide.

Note that this does not determine the cpu vender/make, or its underlying clock speed and specific SIMD features. It is only the amount time it requires in timeslicing.

string cpu = 1;

Parameter
Name Description
value ByteString

The bytes for cpu to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setCpuLimits(String value)

public ResourceSpecification.Builder setCpuLimits(String value)

CPU limit.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to indicate no limit.

string cpu_limits = 5;

Parameter
Name Description
value String

The cpuLimits to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setCpuLimitsBytes(ByteString value)

public ResourceSpecification.Builder setCpuLimitsBytes(ByteString value)

CPU limit.

Examples: "100m", "0.5", "1", "2", ... correspond to 0.1, half, 1, or 2 cpus.

Leave empty to indicate no limit.

string cpu_limits = 5;

Parameter
Name Description
value ByteString

The bytes for cpuLimits to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public ResourceSpecification.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
ResourceSpecification.Builder
Overrides

setGpus(int value)

public ResourceSpecification.Builder setGpus(int value)

Number of gpus.

int32 gpus = 3;

Parameter
Name Description
value int

The gpus to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setLatencyBudgetMs(int value)

public ResourceSpecification.Builder setLatencyBudgetMs(int value)

The maximum latency that this operator may use to process an element.

If non positive, then a system default will be used. Operator developers should arrange for the system compute resources to be aligned with this latency budget; e.g. if you want a ML model to produce results within 500ms, then you should make sure you request enough cpu/gpu/memory to achieve that.

int32 latency_budget_ms = 4;

Parameter
Name Description
value int

The latencyBudgetMs to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setMemory(String value)

public ResourceSpecification.Builder setMemory(String value)

Memory specification (in bytes).

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to let the system decide.

string memory = 2;

Parameter
Name Description
value String

The memory to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setMemoryBytes(ByteString value)

public ResourceSpecification.Builder setMemoryBytes(ByteString value)

Memory specification (in bytes).

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to let the system decide.

string memory = 2;

Parameter
Name Description
value ByteString

The bytes for memory to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setMemoryLimits(String value)

public ResourceSpecification.Builder setMemoryLimits(String value)

Memory usage limits.

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to indicate no limit.

string memory_limits = 6;

Parameter
Name Description
value String

The memoryLimits to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setMemoryLimitsBytes(ByteString value)

public ResourceSpecification.Builder setMemoryLimitsBytes(ByteString value)

Memory usage limits.

Examples: "128974848", "129e6", "129M", "123Mi", ... correspond to 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.

Leave empty to indicate no limit.

string memory_limits = 6;

Parameter
Name Description
value ByteString

The bytes for memoryLimits to set.

Returns
Type Description
ResourceSpecification.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public ResourceSpecification.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
ResourceSpecification.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final ResourceSpecification.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
ResourceSpecification.Builder
Overrides