import titanic

buildername = 'Ubuntu HW 12.04 x64 mozilla-inbound pgo talos svgr'
branch = 'mozilla-inbound'
delta = 30

# NOTE: This API might take long to run.
# Usually takes around a minute to run, may take longer
revList, buildList = titanic.runAnalysis(
    branch, buildername, '6ffcd2030ed8', delta)

# NOTE: runAnalysis argument 'delta' is optional.  If not provided, it will default to 7.
# See example below:
# revList, buildList = titanic.runAnalysis(
#     branch, buildername, 'ceff7d54080f')

for buildRev in buildList:
    print titanic.getBuildCommands(branch, buildername, buildRev)

for rev in revList:
    print titanic.getTriggerCommands(branch, buildername, rev)

# Uncomment the following lines if you want to test the trigger functionality 
# of the code
# print 'Building Rev ' + str(buildList[0])
# titanic.triggerBuild(branch, buildername, buildList[0])
# print 'You should find the status at this URL: \
#     https://secure.pub.build.mozilla.org/buildapi/self-serve/mozilla-inbound/rev/' \
#     + str(buildList[0])

import titanic
import sys

buildername = 'Windows 7 32-bit mozilla-central debug test mochitest-1'
branch = 'mozilla-central'
delta = 30
revision = 'cd2acc7ab2f8'

revList, buildList = titanic.runAnalysis(
    branch, buildername, revision, delta)

for rev in buildList:
    if not (titanic.isBuildPending(branch, buildername, rev) \
            or titanic.isBuildRunning(branch, buildername, rev)):
        titanic.triggerBuild(branch, buildername, rev)
    else:
        if not titanic.isBuildSuccessful(branch, buildername, revision):
            print 'Builds are yet to be completed for revision ' + rev + ' ...'
            print 'If the builds have been running for a very long time make sure the builds have not failed!'

if buildList != []:
    sys.exit(1)

print 'All builds are completed. Starting Jobs...'

for rev in revList:
    if not (titanic.isJobPending(branch, buildername, rev) \
            or titanic.isJobRunning(branch, buildername, rev)):
        titanic.triggerJob(branch, buildername, rev)
    else:
        print 'Job has already been triggered'

Update Sample Code for Backfill