Reference documentation and code samples for the Vision AI V1 API class Google::Cloud::VisionAI::V1::ResourceSpecification.
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.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#cpu
defcpu()->::String
Returns
(::String) — 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.
#cpu=
defcpu=(value)->::String
Parameter
value (::String) — 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.
Returns
(::String) — 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.
#cpu_limits
defcpu_limits()->::String
Returns
(::String) — CPU limit.
Examples:
"100m", "0.5", "1", "2", ... correspond to
0.1, half, 1, or 2 cpus.
Leave empty to indicate no limit.
#cpu_limits=
defcpu_limits=(value)->::String
Parameter
value (::String) — CPU limit.
Examples:
"100m", "0.5", "1", "2", ... correspond to
0.1, half, 1, or 2 cpus.
Leave empty to indicate no limit.
Returns
(::String) — CPU limit.
Examples:
"100m", "0.5", "1", "2", ... correspond to
0.1, half, 1, or 2 cpus.
Leave empty to indicate no limit.
#gpus
defgpus()->::Integer
Returns
(::Integer) — Number of gpus.
#gpus=
defgpus=(value)->::Integer
Parameter
value (::Integer) — Number of gpus.
Returns
(::Integer) — Number of gpus.
#latency_budget_ms
deflatency_budget_ms()->::Integer
Returns
(::Integer) — 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.
#latency_budget_ms=
deflatency_budget_ms=(value)->::Integer
Parameter
value (::Integer) — 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.
Returns
(::Integer) — 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Vision AI V1 API - Class Google::Cloud::VisionAI::V1::ResourceSpecification (v1.1.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.1.1 (latest)](/ruby/docs/reference/google-cloud-vision_ai-v1/latest/Google-Cloud-VisionAI-V1-ResourceSpecification)\n- [1.1.0](/ruby/docs/reference/google-cloud-vision_ai-v1/1.1.0/Google-Cloud-VisionAI-V1-ResourceSpecification)\n- [1.0.1](/ruby/docs/reference/google-cloud-vision_ai-v1/1.0.1/Google-Cloud-VisionAI-V1-ResourceSpecification)\n- [0.4.0](/ruby/docs/reference/google-cloud-vision_ai-v1/0.4.0/Google-Cloud-VisionAI-V1-ResourceSpecification)\n- [0.3.0](/ruby/docs/reference/google-cloud-vision_ai-v1/0.3.0/Google-Cloud-VisionAI-V1-ResourceSpecification)\n- [0.2.0](/ruby/docs/reference/google-cloud-vision_ai-v1/0.2.0/Google-Cloud-VisionAI-V1-ResourceSpecification)\n- [0.1.0](/ruby/docs/reference/google-cloud-vision_ai-v1/0.1.0/Google-Cloud-VisionAI-V1-ResourceSpecification) \nReference documentation and code samples for the Vision AI V1 API class Google::Cloud::VisionAI::V1::ResourceSpecification.\n\nResourceSpec collects a set of resources that can\nbe used to specify requests and requirements.\n\n\n\u003cbr /\u003e\n\nNote: Highly experimental as this can be runtime dependent.\nCan use the \"extras\" field to experiment first before trying\nto abstract it. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #cpu\n\n def cpu() -\u003e ::String\n\n**Returns**\n\n- (::String) --- CPU specification.\n\n Examples:\n \"100m\", \"0.5\", \"1\", \"2\", ... correspond to\n 0.1, half, 1, or 2 cpus.\n\n Leave empty to let the system decide.\n\n Note that this does *not* determine the cpu vender/make,\n or its underlying clock speed and specific SIMD features.\n It is only the amount time it requires in timeslicing.\n\n### #cpu=\n\n def cpu=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- CPU specification.\n\n\n Examples:\n \"100m\", \"0.5\", \"1\", \"2\", ... correspond to\n 0.1, half, 1, or 2 cpus.\n\n Leave empty to let the system decide.\n\n Note that this does *not* determine the cpu vender/make,\n or its underlying clock speed and specific SIMD features.\nIt is only the amount time it requires in timeslicing. \n**Returns**\n\n- (::String) --- CPU specification.\n\n Examples:\n \"100m\", \"0.5\", \"1\", \"2\", ... correspond to\n 0.1, half, 1, or 2 cpus.\n\n Leave empty to let the system decide.\n\n Note that this does *not* determine the cpu vender/make,\n or its underlying clock speed and specific SIMD features.\n It is only the amount time it requires in timeslicing.\n\n### #cpu_limits\n\n def cpu_limits() -\u003e ::String\n\n**Returns**\n\n- (::String) --- CPU limit.\n\n Examples:\n \"100m\", \"0.5\", \"1\", \"2\", ... correspond to\n 0.1, half, 1, or 2 cpus.\n\n Leave empty to indicate no limit.\n\n### #cpu_limits=\n\n def cpu_limits=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- CPU limit.\n\n\n Examples:\n \"100m\", \"0.5\", \"1\", \"2\", ... correspond to\n 0.1, half, 1, or 2 cpus.\n\nLeave empty to indicate no limit. \n**Returns**\n\n- (::String) --- CPU limit.\n\n Examples:\n \"100m\", \"0.5\", \"1\", \"2\", ... correspond to\n 0.1, half, 1, or 2 cpus.\n\n Leave empty to indicate no limit.\n\n### #gpus\n\n def gpus() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- Number of gpus.\n\n### #gpus=\n\n def gpus=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- Number of gpus. \n**Returns**\n\n- (::Integer) --- Number of gpus.\n\n### #latency_budget_ms\n\n def latency_budget_ms() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- The maximum latency that this operator may use to process an element.\n\n If non positive, then a system default will be used.\n Operator developers should arrange for the system compute resources to be\n aligned with this latency budget; e.g. if you want a ML model to produce\n results within 500ms, then you should make sure you request enough\n cpu/gpu/memory to achieve that.\n\n### #latency_budget_ms=\n\n def latency_budget_ms=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- The maximum latency that this operator may use to process an element.\n\n\n If non positive, then a system default will be used.\n Operator developers should arrange for the system compute resources to be\n aligned with this latency budget; e.g. if you want a ML model to produce\n results within 500ms, then you should make sure you request enough\ncpu/gpu/memory to achieve that. \n**Returns**\n\n- (::Integer) --- The maximum latency that this operator may use to process an element.\n\n If non positive, then a system default will be used.\n Operator developers should arrange for the system compute resources to be\n aligned with this latency budget; e.g. if you want a ML model to produce\n results within 500ms, then you should make sure you request enough\n cpu/gpu/memory to achieve that.\n\n### #memory\n\n def memory() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Memory specification (in bytes).\n\n Examples:\n \"128974848\", \"129e6\", \"129M\", \"123Mi\", ... correspond to\n 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.\n\n Leave empty to let the system decide.\n\n### #memory=\n\n def memory=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Memory specification (in bytes).\n\n\n Examples:\n \"128974848\", \"129e6\", \"129M\", \"123Mi\", ... correspond to\n 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.\n\nLeave empty to let the system decide. \n**Returns**\n\n- (::String) --- Memory specification (in bytes).\n\n Examples:\n \"128974848\", \"129e6\", \"129M\", \"123Mi\", ... correspond to\n 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.\n\n Leave empty to let the system decide.\n\n### #memory_limits\n\n def memory_limits() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Memory usage limits.\n\n Examples:\n \"128974848\", \"129e6\", \"129M\", \"123Mi\", ... correspond to\n 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.\n\n Leave empty to indicate no limit.\n\n### #memory_limits=\n\n def memory_limits=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Memory usage limits.\n\n\n Examples:\n \"128974848\", \"129e6\", \"129M\", \"123Mi\", ... correspond to\n 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.\n\nLeave empty to indicate no limit. \n**Returns**\n\n- (::String) --- Memory usage limits.\n\n Examples:\n \"128974848\", \"129e6\", \"129M\", \"123Mi\", ... correspond to\n 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes.\n\n Leave empty to indicate no limit."]]