Skip to content

Instantly share code, notes, and snippets.

@jayunit100
Created January 28, 2016 20:31
Show Gist options
  • Save jayunit100/201936a594955bcd238e to your computer and use it in GitHub Desktop.
Save jayunit100/201936a594955bcd238e to your computer and use it in GitHub Desktop.
commit 331cd87e58147e3665d132b74a1220d0da4624db
Author: Jay Vyas <[email protected]>
Date: Thu Jan 28 15:00:19 2016 -0500
ASDF
ASDF
diff --git a/openshift_scalability/pyconfig.yaml b/openshift_scalability/pyconfig.yaml
index e550800..46ce7eb 100644
--- a/openshift_scalability/pyconfig.yaml
+++ b/openshift_scalability/pyconfig.yaml
@@ -1,12 +1,13 @@
projects:
- - num: 1
- basename: clusterproject
- tuning: default
- templates:
- - num: 1
- file: ./content/deploymentConfigTemplate.json
- parameters:
- - IMAGE: hello-openshift
+ - basename: clusterproject1
+ num: 10
+ tuning: default
+ templates:
+ -
+ file: ./content/deploymentConfigTemplate.json
+ num: 1
+ parameters:
+ - IMAGE: hello-openshift
tuningsets:
- name: default
diff --git a/openshift_scalability/utils.py b/openshift_scalability/utils.py
index 0a8b2c1..865de20 100644
--- a/openshift_scalability/utils.py
+++ b/openshift_scalability/utils.py
@@ -39,22 +39,27 @@ def create_template(templatefile, num, parameters, globalvars):
templatejson = json.loads(processedstr)
with open('/tmp/processed_template.json', 'w') as outfile:
json.dump(templatejson, outfile)
+
+ print "creating template " , i
check = subprocess.call( \
"oc create -f /tmp/processed_template.json " + \
"--namespace %s" % namespace, shell=True)
if "tuningset" in globalvars:
- templatestuningset = globalvars["tuningset"]["templates"]
- if "stepping" in templatestuningset:
- stepsize = templatestuningset["stepping"]["stepsize"]
- pause = templatestuningset["stepping"]["pause"]
- globalvars["totaltemplates"] = globalvars["totaltemplates"] + 1
- templates_created = int(globalvars["totaltemplates"])
- if templates_created % stepsize == 0:
- time.sleep(calc_time(pause))
- if "rate_limit" in templatestuningset:
- delay = templatestuningset["rate_limit"]["delay"]
- time.sleep(calc_time(delay))
+ if "templates" in globalvars["tuningset"]:
+ templatestuningset = globalvars["tuningset"]["templates"]
+ if "stepping" in templatestuningset:
+ stepsize = templatestuningset["stepping"]["stepsize"]
+ pause = templatestuningset["stepping"]["pause"]
+ globalvars["totaltemplates"] = globalvars["totaltemplates"] + 1
+ templates_created = int(globalvars["totaltemplates"])
+ if templates_created % stepsize == 0:
+ time.sleep(calc_time(pause))
+ if "rate_limit" in templatestuningset:
+ delay = templatestuningset["rate_limit"]["delay"]
+ time.sleep(calc_time(delay))
+ else:
+ print "No template in tuning set. not doing stepping/ratelimit logic."
i = i + 1
@@ -258,13 +263,15 @@ def template_handler(templates, globalvars):
num = int(template["num"])
templatefile = template["file"]
parameters = template["parameters"]
- if "tuningset" in globalvars:
+ if "templates" in globalvars["tuningset"]:
if "stepping" in globalvars["tuningset"]["templates"]:
globalvars["totaltemplates"] = 0
create_template(templatefile, num, parameters, globalvars)
- del (globalvars["totaltemplates"])
+ # todo, is it even possible to test templates without totaltemplates?
+ if "totaltemplates" in globalvars:
+ del (globalvars["totaltemplates"])
def service_handler(inputservs, globalvars):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment