RDC Prometheus plugin return errors when use the --rdc_gpu_indexes

When above option is used, the plugin returns errors:
  result = rdc.rdc_group_gpu_add(rdc_handle, gpu_group_id, gpu)
  ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: wrong type

The rdc_prometheus.py is changed to convert string to integer.
The RdcUtil.py is also changed to raise Exception properly.

Change-Id: I9535091ff1fc8882cccd32e5f2810da5241768c3


[ROCm/rdc commit: 7ca7a571a7]
此提交包含在:
Bill(Shuzhou) Liu authored and Shuzhou Liu committed 2021-02-23 14:15:04 -05:00
1 父節點 b9ac3ffbd9
當前提交 d53a9c4e21
2 file changed
+7 -4

No files matched your search

+4 -4
查看文件
@@ -54,13 +54,13 @@ class RdcUtil:
gpu_group_id = c_uint32()
result = rdc.rdc_group_gpu_create(rdc_handle, rdc_group_type_t.RDC_GROUP_EMPTY, gpu_group_name, gpu_group_id)
if rdc_status_t(result) != rdc_status_t.RDC_ST_OK:
raise Exception("Fail to create the GPU group " << group_name)
raise Exception("Fail to create the GPU group " + group_name)
#Add GPU index to the group
for gpu in gpu_indexes:
result = rdc.rdc_group_gpu_add(rdc_handle, gpu_group_id, gpu)
if rdc_status_t(result) != rdc_status_t.RDC_ST_OK:
raise Exception("Fail to add GPU index " << gpu <<" to group " << gpu_group_id)
raise Exception("Fail to add GPU index " + str(gpu) + " to group " + str(gpu_group_id))
return gpu_group_id, True
@@ -75,7 +75,7 @@ class RdcUtil:
group_info = rdc_field_group_info_t()
result = rdc.rdc_group_field_get_info(rdc_handle, field_group_id_list[index], pointer(group_info))
if rdc_status_t(result) != rdc_status_t.RDC_ST_OK:
raise Exception("Fail to get field group " << field_group_id_list[index] <<" info")
raise Exception("Fail to get field group " + str(field_group_id_list[index]) + " info")
if group_info.group_name.decode("utf-8") == field_group_name:
field_ids_ori = [ e.value for e in group_info.field_ids[:group_info.count] ]
# reuse the old field group
@@ -84,7 +84,7 @@ class RdcUtil:
else:
result = rdc.rdc_group_field_destroy(rdc_handle, field_group_id_list[index])
if rdc_status_t(result) != rdc_status_t.RDC_ST_OK:
raise Exception("Fail to delete field group " << field_group_id_list[index])
raise Exception("Fail to delete field group " + str(field_group_id_list[index]))
#Create new field group
fields_c_ids = []