Bug 1231361 - Remove reference data signature methods from refdata model

This commit is contained in:
William Lachance 2016-04-02 01:03:48 -04:00
Родитель 15ba5b10b9
Коммит 649e6bfcab
5 изменённых файлов: 9 добавлений и 81 удалений

Просмотреть файл

@ -2,11 +2,13 @@ import logging
import zlib
import simplejson as json
from django.forms import model_to_dict
from treeherder.etl.perf import (PERFORMANCE_ARTIFACT_TYPES,
load_perf_artifacts,
load_talos_artifacts)
from treeherder.model import utils
from treeherder.model.models import ReferenceDataSignatures
from .base import TreeherderModelBase
@ -106,17 +108,11 @@ class ArtifactsModel(TreeherderModelBase):
job_data.keys()
)
# Retrieve associated data in reference_data_signatures
reference_data = self.refdata_model.get_reference_data(
list(job_ref_data_signatures))
for perf_data in performance_artifact_placeholders:
job_guid = perf_data["job_guid"]
ref_data_signature = job_data[job_guid]['signature']
ref_data = reference_data[ref_data_signature]
if 'signature' in ref_data:
del ref_data['signature']
ref_data = model_to_dict(ReferenceDataSignatures.objects.get(
signature=ref_data_signature))
# adapt and load data into placeholder structures
if perf_data['name'] == 'talos_data':

Просмотреть файл

@ -170,14 +170,6 @@ class JobsModel(TreeherderModelBase):
)
return data
def get_job_reference_data(self, signature):
# Retrieve associated data in reference_data_signatures
result = self.refdata_model.get_reference_data([signature])
if result and signature in result:
return result[signature]
return None
def get_job_list(self, offset, limit,
conditions=None, exclusion_profile=None,
visibility="included"):

Просмотреть файл

@ -106,41 +106,3 @@ class RefDataManager(object):
key_column='option_collection_hash',
return_type='dict'
)
def get_reference_data_signature_names(self, signatures):
reference_data = {}
if signatures:
reference_data_signatures_where_in_clause = [
','.join(['%s'] * len(signatures))
]
reference_data = self.execute(
proc="reference.selects.get_reference_data_signature_names",
placeholders=signatures,
replace=reference_data_signatures_where_in_clause,
debug_show=self.DEBUG,
key_column='signature',
return_type='dict')
return reference_data
def get_reference_data(self, signatures):
# use job_id to map to reference data
reference_data = {}
if signatures:
reference_data_signatures_where_in_clause = [','.join(['%s'] * len(signatures))]
reference_data = self.execute(
proc="reference.selects.get_reference_data",
placeholders=signatures,
replace=reference_data_signatures_where_in_clause,
debug_show=self.DEBUG,
key_column='signature',
return_type='dict')
return reference_data

Просмотреть файл

@ -1,29 +1,5 @@
{
"selects":{
"get_reference_data_signature_names":{
"sql":"SELECT `name`, `signature` FROM `reference_data_signatures` WHERE `signature` IN (REP0)",
"host_type":"read_host"
},
"get_reference_data":{
"sql":"SELECT `signature`,
`build_os_name`,
`build_platform`,
`build_architecture`,
`machine_os_name`,
`machine_platform`,
`machine_architecture`,
`job_group_name`,
`job_group_symbol`,
`job_type_name`,
`job_type_symbol`,
`option_collection_hash`,
`build_system_type`,
`repository`
FROM reference_data_signatures WHERE signature IN (REP0)",
"host_type": "read_host"
},
"get_build_platforms":{
"sql": "SELECT `id`, `os_name`, `platform`, `architecture`
FROM `build_platform`

Просмотреть файл

@ -6,7 +6,8 @@ from django.core.management import call_command
from treeherder.model.error_summary import load_error_summary
from treeherder.model.exchanges import TreeherderPublisher
from treeherder.model.models import Repository
from treeherder.model.models import (ReferenceDataSignatures,
Repository)
from treeherder.model.pulse_publisher import load_schemas
# Load schemas for validation of messages published on pulse
@ -77,11 +78,12 @@ def publish_job_action(project, action, job_id, requester):
with JobsModel(project) as jm:
job = jm.get_job(job_id)[0]
refdata = jm.get_job_reference_data(job['signature'])
publisher.job_action(
version=1,
build_system_type=refdata['build_system_type'],
build_system_type=ReferenceDataSignatures.objects.values_list(
'build_system_type', flat=True).get(
signature=job['signature']),
project=project,
action=action,
job_guid=job['job_guid'],