зеркало из https://github.com/mozilla/treeherder.git
Bug 1388862 - Management command to initialize SETA locally
This populates the job priority table with data locally. It puts all jobs into the table without considerations of analyzing failures. That can follow up in the future. Update docs accordingly.
This commit is contained in:
Родитель
16c182b6ab
Коммит
63a6692e71
|
@ -34,37 +34,26 @@ APIs
|
|||
|
||||
Local set up
|
||||
------------
|
||||
After you set up Treeherder, ssh into the provisioned VM and follow these steps:
|
||||
After you set up Treeherder, ssh (3 different tabs) into the provisioned VM and follow these steps:
|
||||
|
||||
* Choose a couple of consecutive revisions from one of the Firefox development repositories
|
||||
1st tab
|
||||
-------
|
||||
./manage.py runserver
|
||||
|
||||
* Import these jobs to your local setup. For example:
|
||||
2nd tab
|
||||
-------
|
||||
yarn install --no-bin-links
|
||||
yarn start:local
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./manage.py ingest_push mozilla-inbound d70bb3fba851
|
||||
./manage.py ingest_push mozilla-inbound 5a5d50943bbc
|
||||
|
||||
NOTE: Make sure these are pushes with jobs that have run in the last 4 hours
|
||||
|
||||
NOTE: This will only import Buildbot jobs
|
||||
|
||||
* Start the server with ./manage.py runserver
|
||||
* Open `http://localhost:8000/#/jobs?repo=mozilla-inbound <http://localhost:8000/#/jobs?repo=mozilla-inbound>`_.
|
||||
* Make sure you log in
|
||||
* Select few failed jobs from the older push
|
||||
* Tag the jobs as fixed by commit and make a reference to the newer push
|
||||
* Back inside of vagrant run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./manage.py analyze_failures
|
||||
|
||||
NOTE: preseed.json gets loaded automatically on start up.
|
||||
3rd tab
|
||||
-------
|
||||
./manage.py initialize_seta
|
||||
|
||||
* Test the different APIs:
|
||||
|
||||
* http://localhost:8000/api/project/mozilla-inbound/seta/v1/job-priorities/?build_system_type=buildbot
|
||||
* http://localhost:8000/api/project/mozilla-inbound/seta/v1/job-priorities/?build_system_type=taskcluster
|
||||
* http://localhost:8000/api/project/mozilla-inbound/seta/v1/job-types/
|
||||
* http://localhost:8000/api/seta/v1/failures-fixed-by-commit/
|
||||
* http://localhost:8000/api/seta/v1/failures-fixed-by-commit/
|
||||
|
||||
* This one won't work until https://bugzilla.mozilla.org/show_bug.cgi?id=1389123 is fixed
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
import logging
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from treeherder.etl.runnable_jobs import RunnableJobsProcess
|
||||
from treeherder.seta.models import JobPriority
|
||||
from treeherder.seta.preseed import load_preseed
|
||||
from treeherder.seta.update_job_priority import update_job_priority_table
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initialize or update SETA data; It causes no harm to run on production'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Command, self).__init__(*args, **kwargs)
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--clear-job-priority-table',
|
||||
action='store_true',
|
||||
dest='clear_jp_table',
|
||||
default=False,
|
||||
help='Delete all entries in the JobPriority table.',
|
||||
)
|
||||
|
||||
def clear_job_priority_table(self):
|
||||
logger.info('Number of items in table: %d' % JobPriority.objects.count())
|
||||
logger.info('Deleting all entries in the job priority table.')
|
||||
JobPriority.objects.all().delete()
|
||||
logger.info('Number of items in table: %d' % JobPriority.objects.count())
|
||||
|
||||
def initialize_seta(self):
|
||||
logger.info('Updating runnable jobs table (this will take few minutes).')
|
||||
RunnableJobsProcess().run()
|
||||
logger.info('Updating JobPriority table.')
|
||||
logger.info('Number of items in table: %d' % JobPriority.objects.count())
|
||||
update_job_priority_table()
|
||||
logger.info('Loading preseed table.')
|
||||
logger.info('Number of items in table: %d' % JobPriority.objects.count())
|
||||
load_preseed()
|
||||
logger.info('Number of items in table: %d' % JobPriority.objects.count())
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if options['clear_jp_table']:
|
||||
self.clear_job_priority_table()
|
||||
else:
|
||||
self.initialize_seta()
|
Загрузка…
Ссылка в новой задаче