Share via


ComputeNode 類別

Batch 服務中的計算節點。

繼承
ComputeNode

建構函式

ComputeNode(*, id: str = None, url: str = None, state=None, scheduling_state=None, state_transition_time=None, last_boot_time=None, allocation_time=None, ip_address: str = None, affinity_id: str = None, vm_size: str = None, total_tasks_run: int = None, running_tasks_count: int = None, running_task_slots_count: int = None, total_tasks_succeeded: int = None, recent_tasks=None, start_task=None, start_task_info=None, certificate_references=None, errors=None, is_dedicated: bool = None, endpoint_configuration=None, node_agent_info=None, virtual_machine_info=None, **kwargs)

參數

id
str
必要

新增至集區的每個計算節點都會獲指派唯一識別碼。 每當從集區中移除計算節點時,其所有本機檔案都會遭到刪除,而且會回收識別碼,而且可以重複使用給新的計算節點。

url
str
必要
state
strComputeNodeState
必要

現成/低優先順序計算節點已優先佔用。 當另一個計算節點可供使用時,將會重新排程在計算節點上執行的工作。 可能的值包括:'idle'、'rebooting'、'reimaging'、'running'、'unusable'、'create'、'starting'、'waitingForStartTask'、'startTaskFailed'、'unknown'、'leavingPool'、'offline'、'preempted'

scheduling_state
strSchedulingState
必要

可能的值包括:'enabled'、'disabled'

state_transition_time
datetime
必要
last_boot_time
datetime
必要

如果計算節點狀態無法使用,則此屬性可能不存在。

allocation_time
datetime
必要

這是一開始配置計算節點的時間,而且在設定後不會變更。 計算節點在服務修復或先占時不會更新。

ip_address
str
必要

新增至集區的每個計算節點都會指派唯一的 IP 位址。 每當從集區中移除計算節點時,其所有本機檔案都會遭到刪除,而且會回收 IP 位址,而且可以重複使用給新的計算節點。

affinity_id
str
必要

請注意,這只是軟式親和性。 如果目標計算節點在排程工作時忙碌或無法使用,工作將會排程到其他地方。

vm_size
str
必要

如需集區中虛擬機器可用大小的相關資訊,請參閱在Azure Batch集區中為計算節點選擇 VM 大小 (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes) 。

total_tasks_run
int
必要

計算節點上完成的作業工作總數。 這包括作業管理員工作和一般工作,但不包括作業準備、作業發行或啟動工作。

running_tasks_count
int
必要

計算節點上目前正在執行的作業工作總數。 這包括作業管理員工作和一般工作,但不包括作業準備、作業發行或啟動工作。

running_task_slots_count
int
必要

目前在計算節點上執行作業工作所使用的排程位置總數。 這包括作業管理員工作和一般工作,但不包括作業準備、作業發行或啟動工作。

total_tasks_succeeded
int
必要

計算節點上的 exitCode 0) 成功完成的作業工作總數 (。 這包括作業管理員工作和一般工作,但不包括作業準備、作業發行或啟動工作。

recent_tasks
list[TaskInformation]
必要

只有當此計算節點上至少有一個工作已于指派給集區之後,才會存在這個屬性。

start_task
StartTask
必要

在加入集區時,在計算節點上執行的指定工作。

start_task_info
StartTaskInformation
必要

執行時間資訊,說明在計算節點上執行 StartTask。

certificate_references
list[CertificateReference]
必要

針對 Windows 節點,Batch 服務會將憑證安裝至指定的憑證存放區和位置。 針對 Linux 計算節點,憑證會儲存在工作工作目錄內的目錄中,而AZ_BATCH_CERTIFICATES_DIR環境變數會提供給工作查詢此位置。 對於可見度為 'remoteUser' 的憑證,會在使用者的主目錄中建立 'certs' 目錄 (,例如 /home/{user-name}/certs) ,且憑證會放在該目錄中。 警告:此屬性已被取代,將在 2024 年 2 月之後移除。請改用 Azure KeyVault 擴充功能

errors
list[ComputeNodeError]
必要
is_dedicated
bool
必要

這個計算節點是否為專用的計算節點。 如果為 false,則計算節點是現成/低優先順序的計算節點。

endpoint_configuration
ComputeNodeEndpointConfiguration
必要

計算節點的端點組態。

node_agent_info
NodeAgentInformation
必要

計算節點代理程式版本的相關資訊,以及計算節點升級至新版本的時間。

virtual_machine_info
VirtualMachineInfo
必要

虛擬機器目前狀態的相關資訊。

方法

as_dict

使用 json.dump 傳回可以是 JSONify 的聽寫。

進階用法可以選擇性地使用回呼作為參數:

索引鍵是 Python 中使用的屬性名稱。 Attr_desc是中繼資料的聽寫。 目前包含具有 msrest 類型的 'type',以及具有 RestAPI 編碼金鑰的 'key'。 Value 是這個 物件中的目前值。

傳回的字串將用來序列化索引鍵。 如果傳回類型是清單,則會將此視為階層式結果聽寫。

請參閱此檔案中的三個範例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

deserialize

使用 RestAPI 語法剖析 str 並傳回模型。

enable_additional_properties_sending
from_dict

使用指定的金鑰擷取器剖析聽寫會傳回模型。

根據預設,請考慮金鑰擷取器 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)

is_xml_model
serialize

傳回會從此模型傳送至 Azure 的 JSON。

這是 as_dict (full_restapi_key_transformer別名,keep_readonly=False)

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

validate

以遞迴方式驗證此模型,並傳回 ValidationError 的清單。

as_dict

使用 json.dump 傳回可以是 JSONify 的聽寫。

進階用法可以選擇性地使用回呼作為參數:

索引鍵是 Python 中使用的屬性名稱。 Attr_desc是中繼資料的聽寫。 目前包含具有 msrest 類型的 'type',以及具有 RestAPI 編碼金鑰的 'key'。 Value 是這個 物件中的目前值。

傳回的字串將用來序列化索引鍵。 如果傳回類型是清單,則會將此視為階層式結果聽寫。

請參閱此檔案中的三個範例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

參數

key_transformer
<xref:function>

金鑰轉換器函式。

keep_readonly
預設值: True

傳回

與聽寫 JSON 相容的物件

傳回類型

deserialize

使用 RestAPI 語法剖析 str 並傳回模型。

deserialize(data, content_type=None)

參數

data
str
必要

使用 RestAPI 結構的 str。 JSON 預設為 。

content_type
str
預設值: None

JSON 預設會設定 application/xml if XML。

傳回

此模型的實例

例外狀況

DeserializationError if something went wrong

enable_additional_properties_sending

enable_additional_properties_sending()

from_dict

使用指定的金鑰擷取器剖析聽寫會傳回模型。

根據預設,請考慮金鑰擷取器 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)

from_dict(data, key_extractors=None, content_type=None)

參數

data
dict
必要

使用 RestAPI 結構的聽寫

content_type
str
預設值: None

JSON 預設會設定 application/xml if XML。

key_extractors
預設值: None

傳回

此模型的實例

例外狀況

DeserializationError if something went wrong

is_xml_model

is_xml_model()

serialize

傳回會從此模型傳送至 Azure 的 JSON。

這是 as_dict (full_restapi_key_transformer別名,keep_readonly=False)

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

serialize(keep_readonly=False, **kwargs)

參數

keep_readonly
bool
預設值: False

如果您想要序列化唯讀屬性

傳回

與聽寫 JSON 相容的物件

傳回類型

validate

以遞迴方式驗證此模型,並傳回 ValidationError 的清單。

validate()

傳回

驗證錯誤清單

傳回類型