Permalink
Browse files

made changes

  • Loading branch information...
jeads committed Dec 4, 2012
1 parent 6a72591 commit e5f9fbd32c79cbf5b3a533603375be8e6f9a3297
@@ -139,7 +139,7 @@ def check_run_conditions(test_name, rep_count, push_node, branch, debug):
println(u"Cannot run {0}".format(test_name), debug)
return False
- if rep_count < 3:
+ if rep_count < 5:
#If we don't have more than one replicate we cannot
#run any of the existing metric tests
println(
@@ -62,6 +62,14 @@ def get_all_branches():
plm.disconnect()
return branches
+def get_branch_uri(branch):
+ """Return the requested branch uri. If no branch is requested return all
+ branch uris."""
+ plm = factory.get_plm()
+ branches = plm.get_branch_uri(branch)
+ plm.disconnect()
+ return branches
+
def get_db_size():
"""Return the database size, on disk in MB"""
@@ -8,18 +8,18 @@
from datazilla.model import utils
def get_testdata(
- project, branch, revision, os_name=None, os_version=None,
- branch_version=None, processor=None, build_type=None, test_name=None,
- page_name=None):
+ project, branch, revision, product_name=None, os_name=None,
+ os_version=None, branch_version=None, processor=None,
+ build_type=None, test_name=None, page_name=None):
"""Return test data based on the parameters and optional filters."""
ptm = factory.get_ptm(project)
ptrdm = factory.get_ptrdm(project)
# get the testrun ids from perftest
test_run_ids = ptm.get_test_run_ids(
- branch, [revision], os_name, os_version, branch_version, processor,
- build_type, test_name
+ branch, [revision], product_name, os_name, os_version,
+ branch_version, processor, build_type, test_name
)
blobs = ptrdm.get_object_json_blob_for_test_run(test_run_ids)
@@ -57,9 +57,9 @@ def get_testdata(
def get_metrics_data(
- project, branch, revision, os_name=None, os_version=None,
- branch_version=None, processor=None, build_type=None, test_name=None,
- page_name=None
+ project, branch, revision, product_name=None, os_name=None,
+ os_version=None, branch_version=None, processor=None, build_type=None,
+ test_name=None, page_name=None
):
"""Return metrics data based on the parameters and optional filters."""
@@ -68,8 +68,8 @@ def get_metrics_data(
# get the testrun ids from perftest
test_run_ids = ptm.get_test_run_ids(
- branch, [revision], os_name, os_version, branch_version, processor,
- build_type, test_name
+ branch, [revision], product_name, os_name, os_version,
+ branch_version, processor, build_type, test_name
)
#test page metric
@@ -83,33 +83,44 @@ def get_metrics_data(
return metrics_data
def get_metrics_summary(
- project, branch, revision, os_name=None, os_version=None,
- branch_version=None, processor=None, build_type=None, test_name=None
+ project, branch, revision, product_name=None, os_name=None,
+ os_version=None, branch_version=None, processor=None, build_type=None,
+ test_name=None, pushlog_project=None
):
"""Return a metrics summary based on the parameters and optional filters."""
+ plm = factory.get_plm(pushlog_project)
ptm = factory.get_ptm(project)
mtm = factory.get_mtm(project)
# get the testrun ids from perftest
test_run_ids = ptm.get_test_run_ids(
- branch, [revision], os_name, os_version, branch_version, processor,
- build_type, test_name
+ branch, [revision], product_name, os_name, os_version,
+ branch_version, processor, build_type, test_name
)
#test page metric
metrics_data = mtm.get_metrics_summary(test_run_ids)
+ #get push info
+ push_data = plm.get_node_from_revision(revision, branch)
+ metrics_data['push_data'] = push_data
+
+ #get the products associated with this revision/branch combination
+ products = ptm.get_revision_products(revision, branch)
+ metrics_data['products'] = products
+
+ plm.disconnect()
ptm.disconnect()
mtm.disconnect()
return metrics_data
def get_metrics_pushlog(
- project, branch, revision, os_name=None, os_version=None, branch_version=None,
- processor=None, build_type=None, test_name=None, page_name=None,
- days_ago=None, pushes_before=None, pushes_after=None, numdays=None,
- pushlog_project=None
+ project, branch, revision, product_name=None, os_name=None,
+ os_version=None, branch_version=None, processor=None, build_type=None,
+ test_name=None, page_name=None, days_ago=None, pushes_before=None,
+ pushes_after=None, numdays=None, pushlog_project=None
):
"""Return a metrics summary based on the parameters and optional filters."""
@@ -134,6 +145,11 @@ def get_metrics_pushlog(
changesets = changeset_lookup[ node['pushlog_id'] ]
+ #The revisions associated with a push are returned in reverse order
+ #from the pushlog web service. This orders them the same way tbpl
+ #does.
+ changesets['revisions'].reverse()
+
#truncate the revision strings and collect them
for cset_index, revision_data in enumerate(changesets['revisions']):
@@ -151,8 +167,8 @@ def get_metrics_pushlog(
# get the testrun ids from perftest
filtered_test_run_ids = ptm.get_test_run_ids(
- branch, all_revisions, os_name, os_version, branch_version,
- processor, build_type, test_name
+ branch, all_revisions, product_name, os_name, os_version,
+ branch_version, processor, build_type, test_name
)
# get the test run ids associated with the pushlog ids
@@ -194,3 +210,21 @@ def get_application_log(project, revision):
log = mtm.get_application_log(revision)
return log
+def get_default_version(project, branch, product_name):
+
+ ptm = factory.get_ptm(project)
+
+ default_version = ptm.get_default_branch_version(
+ branch, product_name
+ )
+
+ ptm.disconnect()
+
+ version = ""
+ if 'version' in default_version:
+ version = default_version['version']
+
+ return version
+
+
+
View
@@ -85,8 +85,6 @@ def create(cls, host=None, type=None, project=None):
use "MySQL-Engine", where "Engine" could be "InnoDB", "Aria", etc. Not
all contenttypes need to be represented; any that aren't will use the
default (``MySQL-InnoDB``).
-
-
"""
project = project or cls.DEFAULT_PROJECT
@@ -137,6 +135,28 @@ def get_branch_list(self, branch=None):
return branch_list
+ def get_branch_uri(self, branch=None):
+
+ if branch:
+
+ proc = 'hgmozilla.selects.get_branch_uri'
+
+ data = self.hg_ds.dhub.execute(
+ proc=proc,
+ debug_show=self.DEBUG,
+ placeholders=[branch],
+ return_type='tuple',
+ )
+ else:
+ proc = 'hgmozilla.selects.get_all_branch_uris'
+
+ data = self.hg_ds.dhub.execute(
+ proc=proc,
+ debug_show=self.DEBUG,
+ return_type='tuple',
+ )
+
+ return data
def get_all_pushlogs(self):
@@ -251,18 +271,22 @@ def get_branch_pushlog_by_revision(
pushes_before_proc = 'hgmozilla.selects.get_push_ids_before_node'
pushes_after_proc = 'hgmozilla.selects.get_push_ids_after_node'
+ before_boundary = push_id - pushes_before
+
pushes_before_data = self.hg_ds.dhub.execute(
proc=pushes_before_proc,
debug_show=self.DEBUG,
return_type='tuple',
- placeholders=[push_id, branch_id, pushes_before]
+ placeholders=[ push_id, before_boundary, branch_id ]
)
+ after_boundary = push_id + pushes_after
+
pushes_after_data = self.hg_ds.dhub.execute(
proc=pushes_after_proc,
debug_show=self.DEBUG,
return_type='tuple',
- placeholders=[push_id, branch_id, pushes_after]
+ placeholders=[ push_id, after_boundary, branch_id ]
)
#Combine all of the requested push data
@@ -667,6 +691,19 @@ def get_products(self, key_column=None):
return products
+ def get_revision_products(self, revision, branch):
+
+ proc = 'perftest.selects.get_revision_products'
+
+ products = self.sources["perftest"].dhub.execute(
+ proc=proc,
+ debug_show=self.DEBUG,
+ return_type='tuple',
+ placeholders=[revision, branch]
+ )
+
+ return products
+
def get_default_products(self):
@@ -684,6 +721,24 @@ def get_default_products(self):
return default_products
+ def get_default_branch_version(self, branch, product_name):
+
+ proc = 'perftest.selects.get_default_products'
+
+ products = self.sources["perftest"].dhub.execute(
+ proc=proc,
+ debug_show=self.DEBUG,
+ return_type='tuple'
+ )
+
+ target_product = {}
+
+ for product in products:
+ if (product['branch'] == branch) and (product['product'] == product_name):
+ target_product = product
+ break
+
+ return target_product
def get_machines(self):
@@ -901,9 +956,9 @@ def get_test_run_value_summary(self, test_run_id):
def get_test_run_ids(
- self, branch, revisions, os_name=None, os_version=None,
- branch_version=None, processor=None, build_type=None,
- test_name=None, page_name=None):
+ self, branch, revisions, product_name=None, os_name=None,
+ os_version=None, branch_version=None, processor=None,
+ build_type=None, test_name=None, page_name=None):
proc = 'perftest.selects.get_test_run_ids'
placeholders = [branch]
@@ -914,7 +969,10 @@ def get_test_run_ids(
self.get_replace_and_placeholders(
rep, placeholders, 'tr.revision', revision_string
)
-
+ if product_name:
+ self.get_replace_and_placeholders(
+ rep, placeholders, 'p.product', product_name
+ )
if os_name:
self.get_replace_and_placeholders(
rep, placeholders, 'os.name', os_name
@@ -77,15 +77,32 @@
"host":"read_host"
},
+ "get_branch_uri":{
+
+ "sql":"SELECT b.name, b.uri
+ FROM branches AS b
+ WHERE b.name = ?",
+
+ "host":"read_host"
+ },
+
+ "get_all_branch_uris":{
+
+ "sql":"SELECT b.name, b.uri
+ FROM branches AS b",
+
+ "host":"read_host"
+ },
+
"get_push_ids_before_node":{
"sql":"SELECT p.id AS 'pushlog_id',
p.push_id,
p.date,
p.user
FROM pushlogs AS p
- WHERE p.push_id < ? AND p.branch_id = ?
- LIMIT ?",
+ WHERE p.push_id < ? AND p.push_id >= ? AND p.branch_id = ?
+ ORDER BY p.push_id",
"host":"read_host"
},
@@ -97,8 +114,8 @@
p.date,
p.user
FROM pushlogs AS p
- WHERE p.push_id > ? AND p.branch_id = ?
- LIMIT ?",
+ WHERE p.push_id > ? AND p.push_id <= ? AND p.branch_id = ?
+ ORDER BY p.push_id",
"host":"read_host"
},
@@ -134,9 +151,11 @@
"sql":"SELECT p.id AS 'pushlog_id',
p.push_id,
p.date,
+ p.user,
b.id AS 'branch_id',
b.name,
- c.node
+ c.node,
+ c.desc
FROM pushlogs AS p
LEFT JOIN changesets AS c ON p.id = c.pushlog_id
LEFT JOIN branches AS b ON p.branch_id = b.id
Oops, something went wrong.

0 comments on commit e5f9fbd

Please sign in to comment.