Checks Package

Authenticator

class checks.Authenticator(pem, git_app_id)

Bases: object

Authenticator class: creates, stores and updates JWT and INSTALLATION tokens for use in the Github App API calls

INSTALL_EXP_THRESHOLD = 2
JWT_EXP_THRESHOLD = 2
_checkInstallToken()

Checks Install token for expiry date and creates new one if necessary

_checkJWT()

Checks if the passed JWT is still current and either returns the old one or creates and returns a new one

_newInstallToken()

Generates new Install Token valid for an hour to auth API requests

_newJWT()

Creates new JWT for authentication based on private key and GIT APP ID

getToken()

Check expiry date of existing install token and create new one if needed, returns valid token.

getTokenHeader()

Returns fully formed header with valid installation token

updateInstallID(id)

Update Installation ID of Github App to be used for auth (usually send with webhook)

CheckFlow

class checks.CheckFlow(initRepo=False)

Bases: object

AUTOPAS = '../../AutoPas'
DB = 'database.config'
GIT_APP_ID = '-1'
PEM = 'private-key.pem'
PERF_THRESHOLD = 0.9
_checkCommits(url)

Gets list of pull request commits and runs checks :param url: url to receive commits from :return: if worker is needed

_compareConfigs(base: mongoDocuments.Config.Config, test: mongoDocuments.Config.Config)

Given two configs, find all overlapping results and compare them

Parameters
  • base – PR Base SHA config

  • test – Commit in PR to compare to base

Returns

static _compareResults(base: mongoDocuments.Result.Result, test: mongoDocuments.Result.Result)

Compare invididual matching results

Parameters
  • base

  • test

Returns

Speedups

_createCheckRun(sha, name)
comparePerformance(sha, compareUrl)
receiveHook(request)

on receive of pull_request event

runCheck(sha, runUrl)

Commit

class checks.Commit(repo: git.repo.base.Repo, sha: str)

Bases: object

baseDir = ''
build()
buildDir = 'perfBuild'
generatePlot()

Quick overview plot for commit :return:

mdFlexDir = ''
measure(setup: mongoDocuments.Setup.Setup)
parse_and_upload()
save_failed_config(failure: str)

Saving failed configs to not re-run them again :param failure: Failure Mode :return:

updateStatus(code, header, message, image=None)

ImgurUploader

class checks.ImgurUploader

Bases: object

Class to upload images to imgur

upload(image: bytes)

Upload an image anonymously to imgur

Return type

(str, str)

Parameters

image – byte data for image

Returns

imgur link, deleteHash

Repository

class checks.Repository(gitPath, branch='master')

Bases: object

_testCommit(c: checks.Commit.Commit)
checkoutBranch(branch)
testLast(last)
testNewest()
testSHA(sha)

Worker

class checks.Worker

Bases: object

Worker class running all performance measurements currently in queue

checkQueue()

Checks Queue for remaining tests recursively :return: True if queue is

YamlSetups - uploadSetups