Update maxNumber and add generate template script
This commit is contained in:
Родитель
9744ca3f61
Коммит
e1ae79e989
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash -e
|
||||
#TODO: Change path so it does not mess with permissions
|
||||
export HF_LOGDIR=/tmp/log
|
||||
export HF_CONFDIR=$HF_TOP/conf
|
||||
export HF_WORKDIR=/tmp/work
|
||||
mkdir -p $HF_LOGDIR
|
||||
mkdir -p $HF_WORKDIR
|
||||
cat <<EOF >/tmp/input.json
|
||||
{}
|
||||
EOF
|
||||
export PRO_LOG_DIR=${HF_LOGDIR}
|
||||
export PRO_CONF_DIR=${HF_CONFDIR}/providers/azurecc
|
||||
export PRO_DATA_DIR=${HF_WORKDIR}
|
||||
|
||||
env > /tmp/invoke2.env
|
||||
venv_path=/opt/ibm/spectrumcomputing/hostfactory/1.1/providerplugins/azurecc/venv/bin
|
||||
scriptDir=`dirname $0`
|
||||
export PYTHONPATH=$PYTHONPATH:$scriptDir/src
|
||||
# $scriptDir/./invoke_provider.sh generate_template $@
|
||||
. $venv_path/activate
|
||||
$venv_path/python3 -m cyclecloud_provider generate_template -f /tmp/input.json 1> /tmp/azureccprov_templates.json 2>> /tmp/template_generate.out
|
||||
if [ $? == 0 ]; then
|
||||
echo "Template generated successfully can be found in /tmp/azureccprov_templates.json"
|
||||
else
|
||||
echo "Template generation failed check logs in /tmp/template_generate.out"
|
||||
fi
|
||||
rm -rf $HF_LOGDIR
|
||||
rm -rf $HF_WORKDIR
|
||||
exit 0
|
|
@ -88,7 +88,6 @@ class CycleCloudProvider:
|
|||
if template_dict.get(bucket.nodearray) is None:
|
||||
template_dict[bucket.nodearray] = {}
|
||||
template_dict[bucket.nodearray]["templateId"] = bucket.nodearray
|
||||
template_dict[bucket.nodearray]["maxNumber"] = bucket.max_count
|
||||
template_dict[bucket.nodearray]["attributes"] = {}
|
||||
template_dict[bucket.nodearray]["attributes"]["type"] = ["String", "X86_64"]
|
||||
template_dict[bucket.nodearray]["attributes"]["nram"] = ["Numeric", "4096"]
|
||||
|
@ -96,6 +95,7 @@ class CycleCloudProvider:
|
|||
template_dict[bucket.nodearray]["attributes"]["ncores"] = ["Numeric", "1"]
|
||||
template_dict[bucket.nodearray]["vmTypes"] = {}
|
||||
weight = bucket.resources.get("ncores", bucket.vcpu_count)
|
||||
template_dict[bucket.nodearray]["maxNumber"] = (bucket.max_count * weight)
|
||||
template_dict[bucket.nodearray]["vmTypes"].update({bucket.vm_size: weight})
|
||||
else:
|
||||
weight = bucket.resources.get("ncores", bucket.vcpu_count)
|
||||
|
@ -125,15 +125,14 @@ class CycleCloudProvider:
|
|||
requests_store[request_id] = {"requestTime": calendar.timegm(self.clock()),
|
||||
"completedNodes": [],
|
||||
"allNodes": None,
|
||||
"completed": False,
|
||||
"lastNumNodes": input_json["template"]["machineCount"]}
|
||||
"completed": False}
|
||||
except:
|
||||
logger.exception("Could not open creation_json")
|
||||
sys.exit(1)
|
||||
try:
|
||||
use_weighted_templates = False
|
||||
vmTypes = {}
|
||||
if self.config.get("symphony.enable_weighted_templates", True):
|
||||
if self.config.get("symphony.enable_weighted_templates", False):
|
||||
pro_conf_dir=os.getenv('PRO_CONF_DIR', os.getcwd())
|
||||
conf_path = os.path.join(pro_conf_dir, "conf", "azureccprov_templates.json")
|
||||
with open(conf_path, 'r') as json_file:
|
||||
|
|
Загрузка…
Ссылка в новой задаче