文章

pythonCli_调用.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

pycmdbCli_file="$( cd $(dirname $0); pwd )/pycmdbCli.py"

#: '
# get_inst_info
echo "============================| get_inst_info |============================"
python3 $pycmdbCli_file get_inst_info -m xt_service -i freeswitchserv
# get_service_k8s_info
echo "============================| get_service_k8s_info |============================"
python3 $pycmdbCli_file get_service_k8s_info -m xt_service_k8s -i python,sitaiserver,dev,sit

# get_service_property_value
echo "============================| get_inst_property_value:aiserver-mnist-test:owner |============================"
service_info="$( python3 $pycmdbCli_file get_inst_info -m xt_service -i aiserver-mnist-test )"
python3 $pycmdbCli_file get_inst_property_value -p "${service_info}" --model_props owner

## 解析 json 字符串
echo "============================| get_inst_property_value:python,sitaiserver,dev,sit:mem_limit |============================"
service_k8s_info="$( python3 $pycmdbCli_file get_service_k8s_info -m xt_service_k8s -i python,sitaiserver,dev,sit )"
python3 $pycmdbCli_file get_inst_property_value -p "${service_k8s_info}" --model_props mem_limit 

# 通过服务获取 对应的属性值
echo "============================| get_service_property_single | get_service_k8s_property_single |============================"
python3 $pycmdbCli_file get_inst_property_single -m xt_service -i aiserver-faq-embedding --model_props owner
python3 $pycmdbCli_file get_service_k8s_property_single -m xt_service_k8s -i python,sitaiserver,dev,sit --model_props mem_limit

# 获取所有的key
echo "============================| get_inst_property_keys get_service_k8s_property_keys |============================"
ython3 $pycmdbCli_file get_inst_property_keys -m xt_service -i aiserver-faq-embedding
python3 $pycmdbCli_file get_service_k8s_property_keys -m xt_service_k8s -i python,sitaiserver,dev,sit

# 获取模型的属性
echo "============================| get_service_model |============================"
python3 $pycmdbCli_file get_inst_model -m xt_labels

# 获取指定服务的属性的值
echo "============================| fuzzy_query_property_single | accurate_query_property_single |============================"
python3 $pycmdbCli_file query_property_single -m xt_service --model_props bk_inst_name --return_model_props bk_inst_name -p "regex,^free"
python3 $pycmdbCli_file query_property_single -m xt_service --model_props bk_inst_name  --return_model_props bk_inst_name -p "in,freeswitchserv"

# 获取关联关系
echo "============================| get_service_active_asst |============================"
python3 $pycmdbCli_file get_inst_asst -m xt_resource_host -i freeswitch-002 --asst_modal xt_labels --asst_model_props xt_key 
python3 $pycmdbCli_file get_inst_asst -m xt_labels --asst_modal xt_resource_host -i kamailio=master --asst_model_props xt_key 

#根据指定信息 获取对应的关系值
echo "============================| get_inst_asst_property_single |============================"
python3 $pycmdbCli_file get_inst_asst_property_single -m xt_resource_host --asst_modal xt_labels -i freeswitch-001 --asst_model_props xt_key
python3 $pycmdbCli_file get_inst_asst_property_single -m xt_resource_host --asst_modal xt_labels -i freeswitch-001 --asst_model_props xt_value

python3 $pycmdbCli_file get_inst_asst_property_single -m xt_labels --asst_modal xt_resource_host -i kamailio=master,kamailio=slave  --asst_model_props bk_inst_name
python3 $pycmdbCli_file get_inst_asst_property_single -m xt_labels --asst_modal xt_resource_host -i kamailio=master,nginx_proxy_protocol=http   --asst_model_props host_innerip
python3 $pycmdbCli_file get_inst_asst_property_single -m xt_labels --asst_modal xt_resource_host -i kamailio=master,env=dev  --asst_model_props host_innerip

本文由作者按照 CC BY 4.0 进行授权