Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
made changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeads committed Dec 4, 2012
1 parent 6a72591 commit e5f9fbd
Show file tree
Hide file tree
Showing 17 changed files with 728 additions and 244 deletions.
2 changes: 1 addition & 1 deletion datazilla/controller/admin/metrics/perftest_metrics.py
Expand Up @@ -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) println(u"Cannot run {0}".format(test_name), debug)
return False return False


if rep_count < 3: if rep_count < 5:
#If we don't have more than one replicate we cannot #If we don't have more than one replicate we cannot
#run any of the existing metric tests #run any of the existing metric tests
println( println(
Expand Down
8 changes: 8 additions & 0 deletions datazilla/controller/admin/refdata/pushlog_refdata.py
Expand Up @@ -62,6 +62,14 @@ def get_all_branches():
plm.disconnect() plm.disconnect()
return branches 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(): def get_db_size():
"""Return the database size, on disk in MB""" """Return the database size, on disk in MB"""
Expand Down
74 changes: 54 additions & 20 deletions datazilla/controller/admin/testdata.py
Expand Up @@ -8,18 +8,18 @@
from datazilla.model import utils from datazilla.model import utils


def get_testdata( def get_testdata(
project, branch, revision, os_name=None, os_version=None, project, branch, revision, product_name=None, os_name=None,
branch_version=None, processor=None, build_type=None, test_name=None, os_version=None, branch_version=None, processor=None,
page_name=None): build_type=None, test_name=None, page_name=None):
"""Return test data based on the parameters and optional filters.""" """Return test data based on the parameters and optional filters."""


ptm = factory.get_ptm(project) ptm = factory.get_ptm(project)
ptrdm = factory.get_ptrdm(project) ptrdm = factory.get_ptrdm(project)


# get the testrun ids from perftest # get the testrun ids from perftest
test_run_ids = ptm.get_test_run_ids( test_run_ids = ptm.get_test_run_ids(
branch, [revision], os_name, os_version, branch_version, processor, branch, [revision], product_name, os_name, os_version,
build_type, test_name branch_version, processor, build_type, test_name
) )


blobs = ptrdm.get_object_json_blob_for_test_run(test_run_ids) blobs = ptrdm.get_object_json_blob_for_test_run(test_run_ids)
Expand Down Expand Up @@ -57,9 +57,9 @@ def get_testdata(




def get_metrics_data( def get_metrics_data(
project, branch, revision, os_name=None, os_version=None, project, branch, revision, product_name=None, os_name=None,
branch_version=None, processor=None, build_type=None, test_name=None, os_version=None, branch_version=None, processor=None, build_type=None,
page_name=None test_name=None, page_name=None
): ):
"""Return metrics data based on the parameters and optional filters.""" """Return metrics data based on the parameters and optional filters."""


Expand All @@ -68,8 +68,8 @@ def get_metrics_data(


# get the testrun ids from perftest # get the testrun ids from perftest
test_run_ids = ptm.get_test_run_ids( test_run_ids = ptm.get_test_run_ids(
branch, [revision], os_name, os_version, branch_version, processor, branch, [revision], product_name, os_name, os_version,
build_type, test_name branch_version, processor, build_type, test_name
) )


#test page metric #test page metric
Expand All @@ -83,33 +83,44 @@ def get_metrics_data(
return metrics_data return metrics_data


def get_metrics_summary( def get_metrics_summary(
project, branch, revision, os_name=None, os_version=None, project, branch, revision, product_name=None, os_name=None,
branch_version=None, processor=None, build_type=None, test_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.""" """Return a metrics summary based on the parameters and optional filters."""


plm = factory.get_plm(pushlog_project)
ptm = factory.get_ptm(project) ptm = factory.get_ptm(project)
mtm = factory.get_mtm(project) mtm = factory.get_mtm(project)


# get the testrun ids from perftest # get the testrun ids from perftest
test_run_ids = ptm.get_test_run_ids( test_run_ids = ptm.get_test_run_ids(
branch, [revision], os_name, os_version, branch_version, processor, branch, [revision], product_name, os_name, os_version,
build_type, test_name branch_version, processor, build_type, test_name
) )


#test page metric #test page metric
metrics_data = mtm.get_metrics_summary(test_run_ids) 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() ptm.disconnect()
mtm.disconnect() mtm.disconnect()


return metrics_data return metrics_data


def get_metrics_pushlog( def get_metrics_pushlog(
project, branch, revision, os_name=None, os_version=None, branch_version=None, project, branch, revision, product_name=None, os_name=None,
processor=None, build_type=None, test_name=None, page_name=None, os_version=None, branch_version=None, processor=None, build_type=None,
days_ago=None, pushes_before=None, pushes_after=None, numdays=None, test_name=None, page_name=None, days_ago=None, pushes_before=None,
pushlog_project=None pushes_after=None, numdays=None, pushlog_project=None
): ):
"""Return a metrics summary based on the parameters and optional filters.""" """Return a metrics summary based on the parameters and optional filters."""


Expand All @@ -134,6 +145,11 @@ def get_metrics_pushlog(


changesets = changeset_lookup[ node['pushlog_id'] ] 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 #truncate the revision strings and collect them
for cset_index, revision_data in enumerate(changesets['revisions']): for cset_index, revision_data in enumerate(changesets['revisions']):


Expand All @@ -151,8 +167,8 @@ def get_metrics_pushlog(


# get the testrun ids from perftest # get the testrun ids from perftest
filtered_test_run_ids = ptm.get_test_run_ids( filtered_test_run_ids = ptm.get_test_run_ids(
branch, all_revisions, os_name, os_version, branch_version, branch, all_revisions, product_name, os_name, os_version,
processor, build_type, test_name branch_version, processor, build_type, test_name
) )


# get the test run ids associated with the pushlog ids # get the test run ids associated with the pushlog ids
Expand Down Expand Up @@ -194,3 +210,21 @@ def get_application_log(project, revision):
log = mtm.get_application_log(revision) log = mtm.get_application_log(revision)
return log 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



74 changes: 66 additions & 8 deletions datazilla/model/base.py
Expand Up @@ -85,8 +85,6 @@ def create(cls, host=None, type=None, project=None):
use "MySQL-Engine", where "Engine" could be "InnoDB", "Aria", etc. Not use "MySQL-Engine", where "Engine" could be "InnoDB", "Aria", etc. Not
all contenttypes need to be represented; any that aren't will use the all contenttypes need to be represented; any that aren't will use the
default (``MySQL-InnoDB``). default (``MySQL-InnoDB``).
""" """


project = project or cls.DEFAULT_PROJECT project = project or cls.DEFAULT_PROJECT
Expand Down Expand Up @@ -137,6 +135,28 @@ def get_branch_list(self, branch=None):


return branch_list 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): def get_all_pushlogs(self):


Expand Down Expand Up @@ -251,18 +271,22 @@ def get_branch_pushlog_by_revision(
pushes_before_proc = 'hgmozilla.selects.get_push_ids_before_node' pushes_before_proc = 'hgmozilla.selects.get_push_ids_before_node'
pushes_after_proc = 'hgmozilla.selects.get_push_ids_after_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( pushes_before_data = self.hg_ds.dhub.execute(
proc=pushes_before_proc, proc=pushes_before_proc,
debug_show=self.DEBUG, debug_show=self.DEBUG,
return_type='tuple', 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( pushes_after_data = self.hg_ds.dhub.execute(
proc=pushes_after_proc, proc=pushes_after_proc,
debug_show=self.DEBUG, debug_show=self.DEBUG,
return_type='tuple', return_type='tuple',
placeholders=[push_id, branch_id, pushes_after] placeholders=[ push_id, after_boundary, branch_id ]
) )


#Combine all of the requested push data #Combine all of the requested push data
Expand Down Expand Up @@ -667,6 +691,19 @@ def get_products(self, key_column=None):


return products 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): def get_default_products(self):


Expand All @@ -684,6 +721,24 @@ def get_default_products(self):


return default_products 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): def get_machines(self):


Expand Down Expand Up @@ -901,9 +956,9 @@ def get_test_run_value_summary(self, test_run_id):




def get_test_run_ids( def get_test_run_ids(
self, branch, revisions, os_name=None, os_version=None, self, branch, revisions, product_name=None, os_name=None,
branch_version=None, processor=None, build_type=None, os_version=None, branch_version=None, processor=None,
test_name=None, page_name=None): build_type=None, test_name=None, page_name=None):


proc = 'perftest.selects.get_test_run_ids' proc = 'perftest.selects.get_test_run_ids'
placeholders = [branch] placeholders = [branch]
Expand All @@ -914,7 +969,10 @@ def get_test_run_ids(
self.get_replace_and_placeholders( self.get_replace_and_placeholders(
rep, placeholders, 'tr.revision', revision_string rep, placeholders, 'tr.revision', revision_string
) )

if product_name:
self.get_replace_and_placeholders(
rep, placeholders, 'p.product', product_name
)
if os_name: if os_name:
self.get_replace_and_placeholders( self.get_replace_and_placeholders(
rep, placeholders, 'os.name', os_name rep, placeholders, 'os.name', os_name
Expand Down
29 changes: 24 additions & 5 deletions datazilla/model/sql/hgmozilla.json
Expand Up @@ -77,15 +77,32 @@
"host":"read_host" "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":{ "get_push_ids_before_node":{


"sql":"SELECT p.id AS 'pushlog_id', "sql":"SELECT p.id AS 'pushlog_id',
p.push_id, p.push_id,
p.date, p.date,
p.user p.user
FROM pushlogs AS p FROM pushlogs AS p
WHERE p.push_id < ? AND p.branch_id = ? WHERE p.push_id < ? AND p.push_id >= ? AND p.branch_id = ?
LIMIT ?", ORDER BY p.push_id",


"host":"read_host" "host":"read_host"
}, },
Expand All @@ -97,8 +114,8 @@
p.date, p.date,
p.user p.user
FROM pushlogs AS p FROM pushlogs AS p
WHERE p.push_id > ? AND p.branch_id = ? WHERE p.push_id > ? AND p.push_id <= ? AND p.branch_id = ?
LIMIT ?", ORDER BY p.push_id",


"host":"read_host" "host":"read_host"
}, },
Expand Down Expand Up @@ -134,9 +151,11 @@
"sql":"SELECT p.id AS 'pushlog_id', "sql":"SELECT p.id AS 'pushlog_id',
p.push_id, p.push_id,
p.date, p.date,
p.user,
b.id AS 'branch_id', b.id AS 'branch_id',
b.name, b.name,
c.node c.node,
c.desc
FROM pushlogs AS p FROM pushlogs AS p
LEFT JOIN changesets AS c ON p.id = c.pushlog_id LEFT JOIN changesets AS c ON p.id = c.pushlog_id
LEFT JOIN branches AS b ON p.branch_id = b.id LEFT JOIN branches AS b ON p.branch_id = b.id
Expand Down

0 comments on commit e5f9fbd

Please sign in to comment.