зеркало из https://github.com/mozilla/treeherder.git
code cleanup
This commit is contained in:
Родитель
c86771e05b
Коммит
1f4dae6807
|
@ -1,8 +1,7 @@
|
|||
import pytest
|
||||
import json
|
||||
|
||||
|
||||
from .sample_data_generator import job_json, job_data, ref_data_json
|
||||
from .sample_data_generator import job_json
|
||||
|
||||
|
||||
def test_unicode(jm):
|
||||
|
@ -75,7 +74,7 @@ def test_mark_object_complete(jm):
|
|||
|
||||
|
||||
def test_process_objects(jm):
|
||||
"""Claims and processes a chunk of unprocessed JSON test data blobs."""
|
||||
"""Claims and processes a chunk of unprocessed JSON jobs data blobs."""
|
||||
# Load some rows into the objectstore
|
||||
blobs = [
|
||||
job_json(submit_timestamp="1330454755"),
|
||||
|
@ -106,6 +105,7 @@ def test_process_objects(jm):
|
|||
|
||||
|
||||
def test_process_objects_invalid_json(jm):
|
||||
"""process_objects fail for invalid json"""
|
||||
jm.store_job_data("invalid json")
|
||||
row_id = jm._get_last_insert_id("objectstore")
|
||||
|
||||
|
@ -122,6 +122,7 @@ def test_process_objects_invalid_json(jm):
|
|||
|
||||
|
||||
def test_process_objects_unknown_error(jm, monkeypatch):
|
||||
"""process_objects fail for unknown reason"""
|
||||
jm.store_job_data("{}")
|
||||
row_id = jm._get_last_insert_id("objectstore")
|
||||
|
||||
|
@ -143,6 +144,7 @@ def test_process_objects_unknown_error(jm, monkeypatch):
|
|||
|
||||
|
||||
def test_ingest_sample_data(jm, sample_data):
|
||||
"""Process all job structures in the job_data.txt file"""
|
||||
for blob in sample_data.job_data:
|
||||
# print blob
|
||||
jm.store_job_data(json.dumps(blob))
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.conf import settings
|
|||
from treeherder.model.models import Datasource
|
||||
from treeherder.model.derived.refdata import RefDataManager
|
||||
|
||||
|
||||
class TreeherderModelBase(object):
|
||||
"""
|
||||
Base model class for all derived models
|
||||
|
@ -23,7 +24,6 @@ class TreeherderModelBase(object):
|
|||
self.DEBUG = settings.DEBUG
|
||||
self.refdata_model = RefDataManager()
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
"""Unicode representation is project name."""
|
||||
return self.project
|
||||
|
|
|
@ -32,21 +32,7 @@ class JobsModel(TreeherderModelBase):
|
|||
"""
|
||||
Create all the datasource tables for this project.
|
||||
|
||||
``hosts`` is an optional dictionary mapping contenttype names to the
|
||||
database server host on which the database for that contenttype should
|
||||
be created. Not all contenttypes need to be represented; any that
|
||||
aren't will use the default (``TREEHERDER_DATABASE_HOST``).
|
||||
|
||||
``types`` is an optional dictionary mapping contenttype names to the
|
||||
type of database that should be created. For MySQL/MariaDB databases,
|
||||
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``).
|
||||
|
||||
|
||||
"""
|
||||
hosts = hosts or {}
|
||||
types = types or {}
|
||||
|
||||
for ct in [cls.CT_JOBS, cls.CT_OBJECTSTORE]:
|
||||
dataset = Datasource.get_latest_dataset(project, ct)
|
||||
|
|
Загрузка…
Ссылка в новой задаче