buildapi.model package

Submodules

buildapi.model.buildapidb module

class buildapi.model.buildapidb.JobRequest(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.buildapidb.JobRequest'> at 30a9120>
action
asDict()[source]
complete_data
completed_at
id
what
when
who

buildapi.model.builders module

class buildapi.model.builders.BuilderTypeReport(buildername=None, platform=None, build_type=None, job_type=None, starttime=None, endtime=None, detail_level=4)[source]

Bases: buildapi.model.reports.Report

add(br, summary=False, exclude=(0, 1))[source]
get_avg_run_time()[source]
get_max_run_time()[source]
get_min_run_time()[source]
get_ptg_results()[source]
get_sum_run_time()[source]
get_total_build_requests()[source]
to_dict(summary=False)[source]
buildapi.model.builders.BuildersQuery(starttime, endtime, branch_name)[source]

Constructs the sqlalchemy query for fetching all build requests in the specified time interval for the specified branch.

Input: starttime - start time, UNIX timestamp (in seconds)
endtime - end time, UNIX timestamp (in seconds) branch_name - branch name

Output: query

class buildapi.model.builders.BuildersReport(starttime, endtime, branch_name, detail_level=4)[source]

Bases: buildapi.model.reports.Report

_passes_filters(path)[source]
_traverse_tree(node, blist, leafs_only, max_level, level)[source]
add(br)[source]
get_builders(leafs_only=True, detail_level=None)[source]
get_path(b)[source]
get_sum_run_time()[source]
jsonify(summary=False, leafs_only=True, detail_level=None)[source]
set_filters(filters)[source]
to_dict(summary=False, leafs_only=True, detail_level=None)[source]
buildapi.model.builders.BuildersTypeQuery(starttime, endtime, buildername)[source]

Constructs the sqlalchemy query for fetching all build requests in the specified time interval for the specified buildername.

Input: starttime - start time, UNIX timestamp (in seconds)
endtime - end time, UNIX timestamp (in seconds) buildername - builder’s name

Output: query

buildapi.model.builders.GetBuilderTypeReport(starttime=None, endtime=None, buildername=None)[source]

Get the average time per builder report for one builder for the speficied time interval. The builder is specified by its buildername.

Input: starttime - start time (UNIX timestamp in seconds), if not
specified, endtime minus 24 hours
endtime - end time (UNIX timestamp in seconds), if not specified,
starttime plus 24 hours or current time (if starttime is not specified either)

buildername - buildername

Output: BuilderTypeReport

buildapi.model.builders.GetBuildersReport(starttime=None, endtime=None, branch_name='mozilla-central', platform=None, build_type=None, job_type=None, detail_level='builder')[source]

Get the average time per builder report for the speficied time interval and branch.

Input: starttime - start time (UNIX timestamp in seconds), if not
specified, endtime minus 24 hours
endtime - end time (UNIX timestamp in seconds), if not specified,
starttime plus 24 hours or current time (if starttime is not specified either)

branch_name - branch name, default vaue is ‘mozilla-central’

Output: BuildersReport

class buildapi.model.builders.Node(name, info=None)[source]

Bases: object

buildapi.model.buildrequest module

class buildapi.model.buildrequest.BuildRequest(author=None, bid=None, branch=None, brid=None, buildername=None, buildsetid=None, category=None, changeid=None, changes_revision=None, claimed_at=None, claimed_by_name=None, comments=None, complete=0, complete_at=None, finish_time=None, number=None, project=None, revlink=None, revision=None, reason=None, repository=None, results=None, submitted_at=None, ssid=None, start_time=None, when_timestamp=None)[source]

Bases: object

_compute_status()[source]
add_author(author)[source]
add_changeid(changeid)[source]
get_duration()[source]
get_run_time()[source]
get_wait_time()[source]
to_dict(summary=False)[source]
buildapi.model.buildrequest.BuildRequestsQuery(revision=None, branch_name=None, starttime=None, endtime=None, changeid_all=False)[source]

Constructs the sqlalchemy query for fetching build requests.

It can return multiple rows for one build request, one for each build (if the build request has multiple builds) and one for each changeid (if there are multiple changes for one build request), if an only if changeid_all is True. If changeid_all if False, only one changeid will be returned per build request.

You should use function GetBuildRequests, which groups all rows into appropiate build request POPOs, and returns them as a dictionary.

Input: (if any of the parameters are not specified (None), no restrictions

will be applied for them): revision - sourcestamp revision, or list of revisions branch_name - branch name starttime - start time (UNIX timestamp in seconds) endtime - end time (UNIX timestamp in seconds) changeid_all - if True, the query will return 1 row per changeid,

thus multiple rows for one build request; if False (the default value), only one row will be returned per build request, with only one of the changeids at random

Output: query

buildapi.model.buildrequest.GetBuildRequests(revision=None, branch_name=None, starttime=None, endtime=None, changeid_all=False)[source]

Fetches all build requests matching the parameters, and returns them as a dictionary of build request POPOs, keyed by (br.brid, br.bid) - (build request id, build id). There will be one object per build (so if one build request has multiple builds, there will be more than one object).

Each build request object will contain the changeids as a set of values.

Input: (if any of the parameters are not specified (None), no restrictions

will be applied for them): revision - sourcestamp revision, or list of revisions branch_name - branch name starttime - start time (UNIX timestamp in seconds) endtime - end time (UNIX timestamp in seconds) changeid_all - if True, the query will return 1 row per changeid,

thus multiple rows for one build request; if False (the default value), only one row will be returned per build request, with only one of the changeids at random

Output: dictionary of BuildRequest objects, keyed by (br.brid, br.bid)

buildapi.model.builds module

buildapi.model.builds.buildFromRow(row, requestProps=False)[source]
buildapi.model.builds.getBuild(branch, build_id)[source]
buildapi.model.builds.getBuilders(branch, starttime=None, endtime=None)[source]

Returns a lits of builders available on branch between starttime and endtime.

If starttime and enddtime are None, default to two months ago to now

buildapi.model.builds.getBuilds(branch, starttime=None, endtime=None, limit=None)[source]
buildapi.model.builds.getBuildsForUser(branch, user, starttime=None, endtime=None, limit=None)[source]
buildapi.model.builds.getBuildsQuery(branch, starttime=None, endtime=None, limit=None)[source]
buildapi.model.builds.getPendingQuery(branch, starttime=None, endtime=None, limit=None)[source]
buildapi.model.builds.getRequest(branch, request_id)[source]
buildapi.model.builds.getRequestProperties(request_id)[source]
buildapi.model.builds.getRevision(branch, revision, starttime=None, endtime=None, limit=None)[source]
buildapi.model.builds.requestFromRow(row)[source]

buildapi.model.changes module

class buildapi.model.changes.Change(changeid=None, revision=None, branch=None, when_timestamp=None, ss_revision=None)[source]

Bases: object

buildapi.model.changes.ChangesQuery(revision=None, branch_name=None, starttime=None, endtime=None)[source]

Constructs the sqlalchemy query for fetching changes.

Input: (if any of the parameters are not specified (None), no restrictions
will be applied for them): revision - sourcestamp revision, or list of revisions branch_name - branch name starttime - start time (UNIX timestamp in seconds) endtime - end time (UNIX timestamp in seconds)

Output: query

buildapi.model.changes.GetChanges(revision=None, branch_name=None, starttime=None, endtime=None, pending_only=False)[source]

Fetches all changes matching the parameters, and returns them as a dictionary of changes tuples, keyed by the changeid.

Input: (if any of the parameters are not specified (None), no restrictions
will be applied for them): revision - sourcestamp revision, or list of revisions branch_name - branch name starttime - start time (UNIX timestamp in seconds) endtime - end time (UNIX timestamp in seconds)

Output: dictionary of Change objects keyed by changeid

buildapi.model.changes.PendingChangesQuery(revision=None, branch_name=None, starttime=None, endtime=None)[source]

Constructs the sqlalchemy query for fetching pending changes (changes with no build requests yet).

Input: (if any of the parameters are not specified (None), no restrictions
will be applied for them): revision - sourcestamp revision, or list of revisions branch_name - branch name starttime - start time (UNIX timestamp in seconds) endtime - end time (UNIX timestamp in seconds)

Output: query

buildapi.model.endtoend module

class buildapi.model.endtoend.BuildRun(revision, branch_name)[source]

Bases: buildapi.model.reports.Report

add(br)[source]
get_duration()[source]
get_total_build_requests()[source]
get_unique_total_build_requests()[source]
is_complete()[source]
outdated = -1
set_incomplete(incomplete=True, change=None)[source]
to_dict(summary=False)[source]
class buildapi.model.endtoend.EndtoEndTimesReport(starttime, endtime, branch_name)[source]

Bases: buildapi.model.reports.Report

_init_report()[source]
add_build_request(br)[source]
get_avg_duration()[source]
get_total_build_requests()[source]
get_total_build_runs()[source]
get_unique_total_build_requests()[source]
outdated = -1
parse_incomplete(changes)[source]

For any change in changes list that has no build request created, find the most likely build run it will belong to and mark is as incomplete. Also memorize these changes into self.pending_changes.

to_dict(summary=False)[source]
buildapi.model.endtoend.GetBuildRun(branch_name=None, revision=None)[source]

Get build run report. The build run report is specified by its sourcestamps.revision number.

Input: branch_name - branch name
revision - sourcestamps.revision (first 12 chars are enough), or
None for nigthtlies

Output: BuildRun

buildapi.model.endtoend.GetEndtoEndTimes(starttime=None, endtime=None, branch_name='mozilla-central')[source]

Get end to end times report for the speficied time interval and branch.

Input: starttime - start time (UNIX timestamp in seconds), if not
specified, endtime minus 24 hours
endtime - end time (UNIX timestamp in seconds), if not specified,
starttime plus 24 hours or current time (if starttime is not specified either)

branch_name - branch name, default vaue is ‘mozilla-central’

Output: EndtoEndTimesReport

buildapi.model.idlejobs module

buildapi.model.idlejobs.GetIdleJobsReport(starttime=None, endtime=None, int_size=0)[source]

Get test metrics for idlejobs jobs in a given time interval Input: starttime - start time (UNIX timestamp in seconds), if not specified, endtime minus 24 hours

endtime - end time (UNIX timestamp in seconds), if not specified, starttime plus 24 hours
current time (if starttime is not specified either)

int_size - break down results per interval (in seconds), if specified

Output: idlejobs report

buildapi.model.idlejobs.GetTimeStamp(date_time)[source]
buildapi.model.idlejobs.IdleJobsQuery(starttime, endtime)[source]

Constructs the sqlalchemy query for fetching all idlejobs jobs in the specified time interval. Input: starttime - start time, UNIX timestamp (in seconds)

endtime - end time, UNIX timestamp (in seconds)

Output: query

class buildapi.model.idlejobs.IdleJobsReport(starttime, endtime, int_size=0, builders=None)[source]

Bases: object

add(builder, row)[source]
get_interval_indices(stime, etime)[source]
get_interval_timestamp(int_idx)[source]
jsonify()[source]

buildapi.model.jsoncol module

class buildapi.model.jsoncol.JSONColumn(*args, **kwargs)[source]

Bases: sqlalchemy.types.TypeDecorator

Simple type that encodes/decodes JSON data in a SQL Text column

copy()[source]
impl

alias of Text

process_bind_param(value, dialect)[source]
process_result_value(value, dialect)[source]

buildapi.model.meta module

SQLAlchemy Metadata

buildapi.model.pushes module

buildapi.model.pushes.GetPushes(starttime=None, endtime=None, int_size=0, branches=None)[source]

Get pushes and statistics.

Input: starttime - start time (UNIX timestamp in seconds), if not
specified, endtime minus 24 hours
endtime - end time (UNIX timestamp in seconds), if not specified,
starttime plus 24 hours or current time (if starttime is not specified either)

int_size - break down results per interval (in seconds), if specified branches - filter by list of branches, if not spefified fetches all

branches

Output: pushes report

class buildapi.model.pushes.Push(stime, branch_name, revision)[source]

Bases: object

buildapi.model.pushes.PushesQuery(starttime, endtime, branches=None)[source]

Constructs the sqlalchemy query for fetching all pushes in the specified time interval.

One push is identified by changes.when_timestamp and branch name. Unittests and talos build requests are excluded.

Input: starttime - start time, UNIX timestamp (in seconds)

endtime - end time, UNIX timestamp (in seconds) branches - filter by list of branches, if not spefified fetches

all branches

Output: query

class buildapi.model.pushes.PushesReport(starttime, endtime, int_size=0, branches=None)[source]

Bases: buildapi.model.reports.IntervalsReport

_init_branch(branch)[source]
add(push)[source]
get_intervals(branch=None)[source]
get_total(branch=None)[source]
to_dict(summary=False)[source]

buildapi.model.query module

buildapi.model.query.GetAllBranches()[source]
buildapi.model.query.GetBranchName(longname)[source]
buildapi.model.query.GetBuilds(branch=None, type='pending', rev=None)[source]
buildapi.model.query.GetHistoricBuilds(slave, count=20)[source]
buildapi.model.query.GetPushes(branch, fromtime, totime)[source]

buildapi.model.reports module

class buildapi.model.reports.IntervalsReport(starttime, endtime, int_size=0)[source]

Bases: buildapi.model.reports.Report

Reports that have a starttime, endtime and some kind of statistics on time intervals (int_size - interval size in seconds).

get_interval_index(stime)[source]

Returns the index of a certain interval, based on its timestamp.

get_interval_timestamp(int_idx)[source]

Returns the timestamp of a certain interval, based on its index.

class buildapi.model.reports.Report[source]

Bases: object

Basic Report Class.

jsonify(summary=False)[source]

Returns the JSON representation of the report.

to_dict(summary=False)[source]

Create a POPO representation of the report.

buildapi.model.slaves module

buildapi.model.statusdb_orm module

class buildapi.model.statusdb_orm.Build(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Build'> at 4095d00>
builder
builder_id
buildnumber
endtime
classmethod fromBBBuild(session, build, builderName, master_id, request_mapping=None)[source]

Create a database Build object from a buildbot Build

id
lost
master
master_id
properties
reason
requests
result
slave
slave_id
source
source_id
starttime
steps
updateFromBBBuild(session, build)[source]
class buildapi.model.statusdb_orm.Builder(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Builder'> at 4675630>
category
classmethod get(session, name, master_id)[source]

Retrieve the Builder for the given name and master_id. If the builder doesn’t exist, it will be created and added to the session, but not committed.

id
master
master_id
name
slaves
class buildapi.model.statusdb_orm.BuilderSlave(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.BuilderSlave'> at 45ace50>
added
builder
builder_id
id
removed
slave
slave_id
class buildapi.model.statusdb_orm.Change(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Change'> at 45f94c0>
branch
comments
equals(bbChange)[source]

Returns True if this Change refers to the same thing as a buildbot Change object

files
classmethod fromBBChange(session, change)[source]

Return a Change database object that reflects a buildbot Change object object.

id
number
revision
when
who
class buildapi.model.statusdb_orm.File(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.File'> at 48219b0>
classmethod get(session, path)[source]

Retrieve a File object given its path. If the path doesn’t exist yet in the database, it is created and added to the session, but not committed.

id
path
class buildapi.model.statusdb_orm.Master(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Master'> at 4e339b0>
classmethod get(session, url)[source]
id
name
url
class buildapi.model.statusdb_orm.MasterSlave(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.MasterSlave'> at 3feb3c0>
connected
disconnected
id
master
master_id
classmethod setConnected(session, master_id, name, t=None)[source]
classmethod setDisconnected(session, master_id, name, t=None)[source]
slave
slave_id
class buildapi.model.statusdb_orm.Patch(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Patch'> at 4e3c5c0>
id
patch
patchlevel
class buildapi.model.statusdb_orm.Property(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Property'> at 43d9a40>
static equals(dbprops, bbprops)[source]

Returns True if the list of database Property objects dbprops matches the buildbot Properties bbprops

classmethod fromBBProperties(session, props)[source]

Return a list of Property objects that reflect a buildbot Properties object.

classmethod get(session, name, source, value)[source]

Retrieve the Property for the given name, source, and value. If the property doesn’t exist, it will be created and added to the session, but not committed.

id
name
source
value
class buildapi.model.statusdb_orm.Request(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Request'> at 43d6650>
builder
builder_id
cancelled
classmethod fromBBRequest(session, builder, req)[source]

Create a database Request object from a buildbot Request

classmethod get(session, builder, submittime, source)[source]

Retrieve a Request for the given builder and submittime. If the request doesn’t exist, None is returned

id
lost
properties
source
source_id
startcount
submittime
class buildapi.model.statusdb_orm.Slave(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Slave'> at 3ac9960>
classmethod get(session, name)[source]

Retrieve the Slave with the given name. If the slave doesn’t exist, it will be created and added to the session, but not committed.

id
name
class buildapi.model.statusdb_orm.SourceChange(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.SourceChange'> at 42caf30>
change
change_id
order
source_id
class buildapi.model.statusdb_orm.SourceStamp(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.SourceStamp'> at 4369a60>
branch
changes
equals(bbSource)[source]

Returns True if this SourceStamp refers to the same thing as a buildbot SourceStamp object

classmethod fromBBSourcestamp(session, ss)[source]

Return a database SourceStamp object that reflect a buildbot SourceStamp

id
patch
patch_id
revision
class buildapi.model.statusdb_orm.Step(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.Base

_sa_class_manager = <ClassManager of <class 'buildapi.model.statusdb_orm.Step'> at 4033f70>
build_id
description
endtime
classmethod get(session, name, build_id)[source]
id
name
order
starttime
status
buildapi.model.statusdb_orm.connect(url, drop_all=False, **kwargs)[source]

buildapi.model.testruns module

buildapi.model.testruns.GetTestRuns(starttime=None, endtime=None, int_size=0, category=None, platform=None, group=False, btype=None)[source]

Get test run metrics for a given interval Input: starttime - start time (UNIX timestamp in seconds), if not specified, endtime minus 24 hours

endtime - end time (UNIX timestamp in seconds), if not specified, starttime plus 24 hours
current time (if starttime is not specified either)

int_size - break down results per interval (in seconds), if specified category - filter by list of builder categories, if not specified fetches all categories platform - filter by platform, if not specified, fetch all platforms group - group results together by test suite if specified, otherwise fetch all builders uniquely btype - filter by build type (opt/debug/etc), if not specified, return all

Output: pushes report

buildapi.model.testruns.TestRunsQuery(starttime, endtime, category)[source]

Constructs the sqlalchemy query for fetching all pushes in the specified time interval.

Input: starttime - start time, UNIX timestamp (in seconds)
endtime - end time, UNIX timestamp (in seconds) category - filter by list of builder categories, if not spefified fetches all builder categories

Output: query

class buildapi.model.testruns.TestRunsReport(starttime, endtime, builders=None, category=None, platform=None, group=False, btype=None)[source]

Bases: object

add(builder, testrun)[source]
get_platform(builder)[source]
get_ratio(builder)[source]
get_test_time(builder)[source]
get_total_time(builder)[source]
jsonify()[source]
buildapi.model.testruns.get_build_type(buildername)[source]

Returns the build type (opt/debug/etc) for a given buildername Input: buildername - buildername field value from builders status_db table Output: build type (str)

buildapi.model.testruns.get_platform(buildername)[source]

Returns the platform name for a buildername.

Input: buildername - buildername field value from builders status_db table Output: platform (one in PLATFORMS_BUILDERNAME keys: linux, linux64, ...)

buildapi.model.trychooser module

class buildapi.model.trychooser.TryChooserBuildRun(revision, branch_name)[source]

Bases: buildapi.model.endtoend.BuildRun

add(br)[source]
get_used_trychooser()[source]
to_dict(summary=False)[source]
class buildapi.model.trychooser.TryChooserEndtoEndTimesReport(starttime, endtime, branch_name)[source]

Bases: buildapi.model.endtoend.EndtoEndTimesReport

_update_trychooser(force=False)[source]
add_build_request(br)[source]
get_never_used_trychooser()[source]
get_not_used_trychooser()[source]
get_runs_used_trychooser()[source]
get_used_trychooser()[source]
uptodate = -2
buildapi.model.trychooser.TryChooserGetEndtoEndTimes(starttime=None, endtime=None, branch_name='mozilla-central')[source]

Get end to end times report for the speficied time interval and branch.

Input: starttime - start time (UNIX timestamp in seconds), if not
specified, endtime minus 24 hours
endtime - end time (UNIX timestamp in seconds), if not specified,
starttime plus 24 hours or current time (if starttime is not specified either)

branch_name - branch name, default vaue is ‘mozilla-central’

Output: EndtoEndTimesReport

buildapi.model.util module

buildapi.model.util.get_branch_name(text)[source]

Returns the branch name.

Input: text - field value from schedulerdb table Output: branch (one in SOURCESTAMPS_BRANCH keys: mozilla-central,

mozilla-1.9.1, or text if not found
buildapi.model.util.get_build_type(buildername)[source]

Returns the build type based on the buildername.

Build requests are matched to a build type, as following: * opt, if buildername contains ‘opt’, ‘build’ not preceded by ‘leak test’,

‘talos’ (all talos tests are for opt), ‘nightly’ or ‘xulrunner’ (last 2 are all nightlies)
  • debug, if buildername contains ‘debug’ or ‘leak test build’ (debug build)
Input: buildername - buildername field value from buildrequests
schedulerdb table

Output: build type (one in BUILD_TYPE_BUILDERNAME keys: opt or debug)

buildapi.model.util.get_job_type(buildername)[source]

Returns the job type based on the buildername.

Build requests are matched to a job type, as following: * build, if buildername contains ‘build’, ‘nightly’ or ‘xulrunner’

(last 2 are all nightlies)
  • unittest, if buildername contains ‘test’, but not preceded by ‘leak’

    (it would make it a build)

  • talos, if buildername contains ‘talos’

Input: buildername - buildername field value from buildrequests
schedulerdb table

Output: job type (one in JOB_TYPE_BUILDERNAME keys: build, unittest or talos)

buildapi.model.util.get_platform(buildername)[source]

Returns the platform name for a buildername.

Input: buildername - buildername field value from buildrequests
schedulerdb table

Output: platform (one in PLATFORMS_BUILDERNAME keys: linux, linux64, ...)

buildapi.model.util.get_revision(revision)[source]

Returns at most the first 12 characters of the revision number, the rest are not signifiant, or None, if revision is None.

buildapi.model.util.get_silos(slave_name)[source]

Returns the silos name based on the slave name.

buildapi.model.util.get_time_interval(starttime, endtime)[source]

Returns (sarttime2, endtime2) tuple, where the starttime2 is the exact value of input parameter starttime if specified, or endtime minus 24 hours if not. endtime2 is the exact value of input parameter endtime if specified, or starttime plus 24 hours or current time (if starttime is not specified either).

Input: stattime - start time (UNIX timestamp in seconds)
endtime - end time (UNIX timestamp in seconds)

Output: (stattime2, endtime2)

buildapi.model.util.results_to_str(results)[source]

Return the results as string.

Input: results - results int value, one of: NO_RESULT, SUCCESS, WARNINGS,
FAILURE, SKIPPED, EXCEPTION, RETRY

Output: results string representation

buildapi.model.util.status_to_str(status)[source]

Return the status as string.

Input: status - status int value, one of: PENDING, RUNNING, COMPLETE,
CANCELLED, INTERRUPTED, MISC

Output: status string representation

buildapi.model.waittimes module

buildapi.model.waittimes.GetWaitTimes(pool='buildpool', mpb=15, starttime=None, endtime=None, int_size=0, maxb=0)[source]

Get wait times and statistics for buildpool.

Input: pool - name of the pool (e.g. buildpool, or trybuildpool)

mpb - minutes per block, length of wait time block in minutes starttime - start time (UNIX timestamp in seconds), if not

specified, endtime minus 24 hours
endtime - end time (UNIX timestamp in seconds), if not specified,
starttime plus 24 hours or current time (if starttime is not specified either)

int_size - break down results per interval (in seconds), if specified maxb - maximum block size; for wait times larger than maxb, group

into the largest block

Output: wait times report

class buildapi.model.waittimes.WaitTime(stime, etime, platform, buildername=None, has_no_changes=False)[source]

Bases: object

class buildapi.model.waittimes.WaitTimeIntervals(int_no)[source]

Bases: object

to_dict()[source]
update(idx)[source]
buildapi.model.waittimes.WaitTimesQuery(starttime, endtime, pool)[source]

Constructs the sqlalchemy query for fetching all wait times for a buildpool in the specified time interval.

Input: pool - name of the pool (e.g. buildpool, or trybuildpool)
starttime - start time, UNIX timestamp (in seconds) endtime - end time, UNIX timestamp (in seconds) pool - fetches the builds only for masters in pool

Output: query

class buildapi.model.waittimes.WaitTimesReport(pool, starttime, endtime, mpb=15, maxb=0, int_size=0, masters=None)[source]

Bases: buildapi.model.reports.IntervalsReport

_get_block_no(stime, etime)[source]
_init_report()[source]
_is_unknownbuilder(buildername)[source]
_update_wait_times(platform, block_no, int_idx)[source]
add(wt)[source]
get_blocks(platform=None)[source]
get_platforms()[source]
get_total(platform=None)[source]
get_wait_times(block_no, platform=None)[source]
to_dict(summary=False)[source]
buildapi.model.waittimes.get_pending_buildrequests_query_clause(br_table, pool)[source]

Pending jobs don’t have buildrequests.claimed_by_name specified, therefore we need to catch the pool it belongs to by looking at buildrequests.buildername fields:

  • buildpool: br.claimed_by_name == None and br.buildername NOT LIKE

    Rev3% and NOT LIKE % tryserver %

  • trybuildpool: br.claimed_by_name == None and br.buildername NOT LIKE

    Rev3% and LIKE % tryserver %

  • testpool: br.claimed_by_name == None and br.buildername LIKE Rev3%

Module contents

The application’s model objects

buildapi.model.init_buildapi_model(engine)[source]
buildapi.model.init_scheduler_model(engine)[source]
buildapi.model.init_status_model(engine)[source]