Skip to content

Commit

Permalink
Merge pull request mozilla#247 from adusca/pycharm-warnings
Browse files Browse the repository at this point in the history
Code clean up
  • Loading branch information
armenzg committed Jun 8, 2015
2 parents abe9eca + 9768eb2 commit 6e1b573
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ _build

# coverage
.coverage
.idea
4 changes: 2 additions & 2 deletions docs/roadmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ We have filed `issue 69`_ to track this.

**NOTE:** This will be needed once someone picks up `bug 983802`_.

.. _bug 983802 : https://bugzilla.mozilla.org/show_bug.cgi?id=983802
.. _bug 983802: https://bugzilla.mozilla.org/show_bug.cgi?id=983802
.. _issue 69: https://github.com/armenzg/mozilla_ci_tools/issues/69

Integrate backfilling feature into treeherder
Expand All @@ -182,7 +182,7 @@ This is very important for monitoring jobs going through various states.

We have filed `issue 126`_ to track this.

.. _issue 126 : https://github.com/armenzg/mozilla_ci_tools/issues/126
.. _issue 126: https://github.com/armenzg/mozilla_ci_tools/issues/126

Add ability to monitor jobs
---------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Usage::
--trigger-build-if-missing
flag to also trigger jobs without build jobs available
on try

generate_triggercli.py
^^^^^^^^^^^^^^^^^^^^^^
This script allows you to generate a bunch of command line commands that would allow you to investigate
Expand Down
4 changes: 1 addition & 3 deletions mozci/scripts/alltalos.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@


def parse_args(argv=None):
'''
Parse command line options.
'''
"""Parse command line options."""
parser = ArgumentParser()

parser.add_argument("--repo-name",
Expand Down
2 changes: 1 addition & 1 deletion mozci/scripts/generate_triggercli.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def search_bug(bug_no):
first_comment = comment.text
break
except:
Exception("Issue getting comments for bug %s" % bug.id)
raise Exception("Issue getting comments for bug %s" % bug.id)

buildername = None
rev = None
Expand Down
14 changes: 7 additions & 7 deletions mozci/scripts/misc/dump_buildjson_endtimes.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from mozci.sources.buildjson import _fetch_buildjson_day_file
from mozci.sources.buildjson import _fetch_data, BUILDS_DAY_FILE
from mozci.utils.tzone import pacific_time as pt
from mozci.utils.tzone import utc_time as ut

builds = _fetch_buildjson_day_file("2015-02-23")
builds = _fetch_data(BUILDS_DAY_FILE % "2015-02-23")

list = []
endtimes_list = []
for job in builds:
list.append(job["endtime"])
endtimes_list.append(job["endtime"])

list.sort()
print "%s %s %s" % (list[0], ut(list[0]), pt(list[0]))
print "%s %s %s" % (list[-1], ut(list[-1]), pt(list[-1]))
endtimes_list.sort()
print "%s %s %s" % (endtimes_list[0], ut(endtimes_list[0]), pt(endtimes_list[0]))
print "%s %s %s" % (endtimes_list[-1], ut(endtimes_list[-1]), pt(endtimes_list[-1]))
6 changes: 4 additions & 2 deletions mozci/scripts/misc/dump_jobs_info_for_buildjson_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from mozci.sources.buildjson import _fetch_buildjson_day_file
jobs = _fetch_buildjson_day_file("2015-03-03")
from mozci.sources.buildjson import _fetch_data, BUILDS_DAY_FILE


jobs = _fetch_data(BUILDS_DAY_FILE % "2015-03-03")

for job in jobs:
req_id = sorted(job.get("request_ids", []))
Expand Down
6 changes: 3 additions & 3 deletions mozci/sources/allthethings.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ def _verify_file_integrity():
def list_builders():
"""Return a list of all builders running in the buildbot CI."""
j = fetch_allthethings_data()
list = j["builders"].keys()
assert len(list) > 0, "The list of builders cannot be empty."
return list
builders_list = j["builders"].keys()
assert len(builders_list) > 0, "The list of builders cannot be empty."
return builders_list
4 changes: 1 addition & 3 deletions mozci/sources/buildapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ def _builders_api_url(repo_name, builder, revision):


def _jobs_api_url(job_id):
'''
This is the URL to a self-serve job request (scheduling, canceling, etc).
'''
"""This is the URL to a self-serve job request (scheduling, canceling, etc)."""
return r'''%s/jobs/%s''' % (HOST_ROOT, job_id)


Expand Down
4 changes: 1 addition & 3 deletions mozci/sources/buildjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,16 @@ def _find_job(request_id, jobs, loaded_from):
loaded_from is simply to indicate where those jobs were loaded from.
"""
found = None
LOG.debug("We are going to look for %s in %s." % (request_id, loaded_from))

for job in jobs:
# XXX: Issue 104 - We have an unclear source of request ids
prop_req_ids = job["properties"].get("request_ids", [])
root_req_ids = job["request_ids"]
if request_id in list(set(prop_req_ids + root_req_ids)):
found = job
return job

return found
return None


def query_job_data(complete_at, request_id):
Expand Down
2 changes: 1 addition & 1 deletion mozci/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _public_url(url):
return url


def _all_urls_reachable(urls, auth=None):
def _all_urls_reachable(urls):
"""Determine if the URLs are reachable."""
for url in urls:
url_tested = _public_url(url)
Expand Down
4 changes: 1 addition & 3 deletions mozci/utils/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def _fetch_and_load_file(req, filename):


def _load_json_file(filepath):
'''
This is a helper function to load json contents from a file
'''
"""This is a helper function to load json contents from a file."""
LOG.debug("About to load %s." % filepath)
try:
return json.load(open(filepath))
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import mozci
from setuptools import setup, find_packages

setup(
Expand Down

0 comments on commit 6e1b573

Please sign in to comment.