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
This commit is contained in:
Bill(Shuzhou) Liu
2021-02-09 13:36:57 -05:00
zatwierdzone przez Shuzhou Liu
rodzic 26b32f5a08
commit 7ca7a571a7
2 zmienionych plików z 7 dodań i 4 usunięć
+4 -4
Wyświetl plik
@@ -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 = []