Skip to content

Commit

Permalink
Bug 1348360 - Fix flake8 linter errors in update_job_priority.py
Browse files Browse the repository at this point in the history
These were hidden by the use of `# flake8: noqa`.

treeherder/seta/update_job_priority.py:12:1: F401 'copy' imported but unused
treeherder/seta/update_job_priority.py:14:1: F401 'json' imported but unused
treeherder/seta/update_job_priority.py:16:1: F401 'os' imported but unused
treeherder/seta/update_job_priority.py:17:1: F401 'time' imported but unused
treeherder/seta/update_job_priority.py:54:1: E302 expected 2 blank lines, found 1
treeherder/seta/update_job_priority.py:104:1: E302 expected 2 blank lines, found 1
treeherder/seta/update_job_priority.py:126:1: E302 expected 2 blank lines, found 1
treeherder/seta/update_job_priority.py:129:1: E302 expected 2 blank lines, found 1
treeherder/seta/update_job_priority.py:144:1: E302 expected 2 blank lines, found 1
treeherder/seta/update_job_priority.py:192:23: E127 continuation line over-indented for visual indent
  • Loading branch information
Ed Morley committed Mar 17, 2017
1 parent e328bff commit 8ff5ee6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions treeherder/seta/update_job_priority.py
Expand Up @@ -9,12 +9,8 @@
the same set of jobs. Unfortunately, this is less than ideal if we want to make this
work for project repositories.
'''
import copy
import datetime
import json
import logging
import os
import time

from treeherder.etl.seta import (parse_testtype,
valid_platform)
Expand Down Expand Up @@ -51,6 +47,7 @@ def _unique_key(job):
buildtype=str(job['platform_option']),
platform=str(job['platform']))


def _sanitize_data(runnable_jobs_data):
"""We receive data from runnable jobs api and return the sanitized data that meets our needs.
Expand Down Expand Up @@ -101,6 +98,7 @@ def _sanitize_data(runnable_jobs_data):

return sanitized_list


def query_sanitized_data(repo_name='mozilla-inbound'):
"""Return sanitized jobs data based on runnable api. None if failed to obtain or no new data.
Expand All @@ -123,9 +121,11 @@ def query_sanitized_data(repo_name='mozilla-inbound'):
runnable_jobs = RunnableJobsClient().query_runnable_jobs(repo_name)
return _sanitize_data(runnable_jobs)


def _two_weeks_from_now():
return datetime.datetime.now() + datetime.timedelta(days=14)


def _initialize_values():
logger.info('Fetch all rows from the job priority table.')
# Get all rows of job priorities
Expand All @@ -141,6 +141,7 @@ def _initialize_values():
# into high value jobs.
return jp_index, SETA_LOW_VALUE_PRIORITY, None


def _update_table(data):
"""Add new jobs to the priority table and update the build system if required.
data - it is a list of dictionaries that describe a job type
Expand Down Expand Up @@ -189,7 +190,7 @@ def _update_table(data):
failed_changes += 1

logger.info('We have {} new jobs and {} updated jobs out of {} total jobs '
'processed.'.format(new_jobs, updated_jobs, total_jobs))
'processed.'.format(new_jobs, updated_jobs, total_jobs))

if failed_changes != 0:
logger.warning('We have failed {} changes out of {} total jobs processed.'.format(
Expand Down

0 comments on commit 8ff5ee6

Please sign in to comment.