buildapi.scripts package

Submodules

buildapi.scripts.buildapi-rest module

buildapi.scripts.l10n_report module

buildapi.scripts.l10n_report.main()[source]
buildapi.scripts.l10n_report.parse_builds_report(data, output, skip=(0, 5))[source]

buildapi.scripts.mailwaittimes module

buildapi.scripts.mailwaittimes.format_wait_times(wait_times)[source]

Format wait times statistics in a pretty human readable format.

The result is a tuple, first element being a short summary (e.g. subject for e-mails), the second is the actual text (e.g. message body).

Input: wait_times - wait times object Output: (title, text) - sting formatted wait times

buildapi.scripts.mailwaittimes.format_wait_times_stats(stats, mpb, maxb, total=0)[source]

Format wait time statistics for one platform only.

Input: stats - wait times for one platform, {‘block_no’: num,}
mpb - granularity of wait times blocks maxb - maximum block size total - number of all build requests for this platform

Ouput: string - formatted text

buildapi.scripts.mailwaittimes.mail_send(body, subject, sender, receivers, server, receivers_bcc=[])[source]

Sends an e-mail. This method will return normally if the mail is accepted for at least one recipient.

Input: body - message
subject - subject sender - sender’s e-mail address receivers - list of receiver e-mails receivers_bcc - list of BCC receiver e-mails server - SMTP server

Output: dictionary, with one entry for each recipient that was refused Raised Errors: any error raised by stmplib.STMP and stmp.sendmail. e.g.

SMTPConnectError, SMTPRecipientsRefused, SMTPSenderRefused, etc. (see stmplib documentation)
buildapi.scripts.mailwaittimes.mail_wait_times(server='localhost', sender='cltbld@build.mozilla.com', receivers=, []receivers_bcc=, []wt_service='http://localhost:5000/reports/waittimes', pool='buildpool', starttime=None, endtime=None, mpb=15, maxb=90, tries=1, sleep=10)[source]

Mails wait times. Main function to call for mailing wait times.

Input: server - SMTP server
sender - sender’s e-mail address receivers - list of receiver e-mails receivers_bcc - list of bcc receiver e-mails wt_service - wait times service base URL, e.g. http://domain/waittimes pool - pool name mpb - minutes per block maxb - maximum block starttime - start time in seconds since epoch, UTC (end time minus 24 hours, if not specified) endtime - end time in seconds since epoch, UTC (start time plus 24 hours, if not specified) tries - number of tries for sending e-mails, in case of errors, before giving up sleep - number of seconds to sleep before retrying to send e-mail, in case of failure
Output: Dictionary containing the status of the operation: success or error, and additional information.
In case of success, it looks like: {status: ‘success’, refused: refused_rcv} , where refused_rcv is a dictionary, with one entry for each recipient that was refused, thus empty if all recipients received the email. In case of error/failure, the result looks like: {status: ‘error’, msg: ‘reason’}, if all of the receivers were refused or an exception was raised.
buildapi.scripts.mailwaittimes.merge_platforms(platform1, platform2)[source]
buildapi.scripts.mailwaittimes.wtservice_fetch(url)[source]

Makes a HTTP request to the URL provided and fetches the wait times.

Input: url - request URL Output: wait times object (dictionary) Throws: urllib2.URLError - opening connection fails

ValueError - decoding JSON object response fails
buildapi.scripts.mailwaittimes.wtservice_get_full_url(wt_service='http://localhost:5000/reports/waittimes', pool='buildpool', starttime=None, endtime=None, mpb=None, maxb=None)[source]

Returns the full request URL to the service providing the wait times.

Input: wt_service - base URL for service, default: http://localhost:5000/reports/waittimes
pool - pool name, default: buildpool starttime - start time, default: None (server’s default will be used) endtime - end time, default: None (server’s default will be used) mpb - block granularity, default: None (server’s default will be used) maxb - maximum block size, default: None (server’s default will be used)

Output: string - full request URL

buildapi.scripts.reporter module

class buildapi.scripts.reporter.Cache[source]

Bases: object

get(key)[source]
static new(config)[source]
put(key, val, expire=0)[source]
class buildapi.scripts.reporter.MemcacheCache(hosts)[source]

Bases: buildapi.scripts.reporter.Cache

_utf8(s)[source]
get(key)[source]
put(key, val, expire=0)[source]
buildapi.scripts.reporter.avg(l)[source]
buildapi.scripts.reporter.build_report(cache, session, scheduler_db, starttime, endtime, include_steps=False)[source]
buildapi.scripts.reporter.dt2epoch(dt)[source]
buildapi.scripts.reporter.encode_dates(dt)[source]
buildapi.scripts.reporter.get_request_info(scheduler_db, build, props)[source]
buildapi.scripts.reporter.get_slave_name(cache, session, slave_id)[source]
buildapi.scripts.reporter.req2json(r)[source]
buildapi.scripts.reporter.td2secs(td)[source]

Return the number of seconds in the given timedelta object

buildapi.scripts.selfserve-agent module

buildapi.scripts.selfserve_agent module

selfserve-agent.py [options]

Gets any messages and executes them.

class buildapi.scripts.selfserve_agent.BuildAPIAgent(db, masters_url, buildbot, sendchange_master, publisher, branches_url, clobberer_url)[source]
_can_cancel_build(claimed_by_name, builder_name, build_number, who, comments)[source]
_cancel_build(claimed_by_name, builder_name, build_number, who, comments)[source]
_cancel_request(who, request)[source]
_clobber_slave(slavename, builder_name)[source]
_create_build_for_revision(who, branch, revision, priority, builder_expression, builder_exclusions=None)[source]
_get_build_url(claimed_by_name, builder_name, build_number)[source]
_get_cancel_url(claimed_by_name, builder_name, build_number)[source]
_get_master_pb(name)[source]
_get_master_url(claimed_by_name)[source]
_get_repo_path(branch)[source]
_get_slave_name(claimed_by_name, builder_name, build_number)[source]
_refresh()[source]
_should_clobber_build(builder_name)[source]

Return True if this builder needs to be clobbered via clobberer when a build is cancelled via self-serve

do_cancel_build(message_data, message)[source]
do_cancel_request(message_data, message)[source]
do_cancel_revision(message_data, message)[source]
do_new_build_at_revision(message_data, message)[source]
do_new_build_for_builder(message_data, message)[source]
do_new_nightly_at_revision(message_data, message)[source]
do_new_pgobuild_at_revision(message_data, message)[source]
do_rebuild_build(message_data, message)[source]
do_rebuild_request(message_data, message)[source]
do_reprioritize(message_data, message)[source]
receive_message(message_data, message)[source]
class buildapi.scripts.selfserve_agent.NoRedirects[source]

Bases: urllib2.HTTPErrorProcessor

Helper class that eats HTTP 302 redirects so we don’t follow redirects

http_response(request, response)[source]
buildapi.scripts.selfserve_agent.create_buildset(db, idstring, reason, ssid, submitted_at)[source]
buildapi.scripts.selfserve_agent.genBuildID(now=None)[source]

Return a buildid based on the current time

buildapi.scripts.selfserve_agent.genBuildUID()[source]

Return a unique build uid

buildapi.scripts.selfserve_agent.main()[source]

buildapi.scripts.tzone module

class buildapi.scripts.tzone.Pacific[source]

Bases: buildapi.scripts.tzone.USTimeZone

class buildapi.scripts.tzone.USTimeZone(hours, reprname, stdname, dstname)[source]

Bases: datetime.tzinfo

DSTEND = datetime.datetime(1, 10, 25, 1, 0)
DSTSTART = datetime.datetime(1, 4, 1, 2, 0)
_first_sunday_on_or_after(dt)[source]
dst(dt)[source]
tzname(dt)[source]
utcoffset(dt)[source]
buildapi.scripts.tzone.pacific_time(timestamp)[source]

Convert a time expressed in seconds since the epoch to a string representing Pacific time. If secs is not provided or None, the current time as returned by time() is used.

Module contents