evergreen package

Subpackages

Submodules

evergreen.alias module

Representation of project aliases.

class evergreen.alias.DisplayTaskAlias(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a DisplayTask in an alias.

property execution_tasks: Any

value of ExecutionTasks

property name: Any

value of Name

class evergreen.alias.VariantAlias(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an alias for a particular build variant.

property display_tasks: List[DisplayTaskAlias]

Get a list of display tasks for the alias.

property tasks: Any

value of Tasks

property variant: Any

value of Variant

evergreen.api module

API for interacting with evergreen.

class evergreen.api.CachedEvergreenApi(api_server: str = 'https://evergreen.mongodb.com', auth: Optional[EvgAuth] = None, timeout: Optional[int] = None, log_on_error: bool = False)[source]

Bases: EvergreenApi

Access to the Evergreen API server that caches certain calls.

build_by_id(build_id: str) Build[source]

Get a build by id.

Parameters:

build_id – build id to query.

Returns:

Build queried for.

clear_caches() None[source]

Clear the cache.

tasks_by_build(build_id: str, fetch_all_executions: Optional[bool] = None) List[Task][source]

Get tasks by build.

Parameters:
  • build_id – Id of build to query.

  • fetch_all_executions – should fetch all executions of the tasks

Returns:

List of the queried tasks.

version_by_id(version_id: str) Version[source]

Get version by version id.

Parameters:

version_id – Id of version to query.

Returns:

Version queried for.

class evergreen.api.EvergreenApi(api_server: str = 'https://evergreen.mongodb.com', auth: Optional[EvgAuth] = None, timeout: Optional[int] = None, session: Optional[Session] = None, log_on_error: bool = False, use_default_logger_factory: bool = True)[source]

Bases: object

Base methods for building API objects.

abort_task(task_id: str) None[source]

Abort a task.

Parameters:

task_id – Id of the task to abort

alias_for_version(version_id: str, alias: str, include_deps: bool = False) List[VariantAlias][source]

Get the tasks and variants that an alias would select for an evergreen version.

Parameters:
  • version_id – Evergreen version to query against.

  • alias – Alias to query.

  • include_deps – If true, will also select tasks that are dependencies.

Returns:

List of Variant alias details.

all_distros() List[Distro][source]

Get all distros in evergreen.

Returns:

List of all distros in evergreen.

all_hosts(status: Optional[str] = None) List[Host][source]

Get all hosts in evergreen.

Parameters:

status – Only return hosts with specified status.

Returns:

List of all hosts in evergreen.

all_projects(project_filter_fn: Optional[Callable] = None) List[Project][source]

Get all projects in evergreen.

Parameters:

project_filter_fn – function to filter projects, should accept a project_id argument.

Returns:

List of all projects in evergreen.

all_user_permissions_for_resource(resource_id: str, resource_type: PermissionableResourceType) Dict[str, Dict[str, int]][source]

Get all users with their permissions to the resource.

The returned dict has the following structure -

{
  "username_1": {
     "project_tasks": 30,
     "project_patches": 10
    },
  "username_2": {
     "project_settings": 20,
     "project_patches": 10
  }
}
Parameters:
  • resource_id – Id of the resource to get users for.

  • resource_type – Resource type of the resource.

Returns:

A dict containing user to permissions mappings.

annotate_task(task_id: str, execution: Optional[int] = None, message: Optional[str] = None, issues: Optional[List[IssueLinkRequest]] = None, suspected_issues: Optional[List[IssueLinkRequest]] = None, metadata: Optional[Dict[str, Any]] = None, metadata_links: Optional[List[MetadataLinkRequest]] = None) None[source]

Annotate the specified task.

Parameters:
  • task_id – ID of task to annotate.

  • execution – Execution number of task to annotate (default to latest).

  • message – Message to add to the annotations.

  • issues – Issues to attach to the annotation.

  • suspected_issues – Suspected issues to add to the annotation.

  • metadata – Extra metadata to add to the issue.

  • metadata_links – Metadata link to add to the annotation.

build_by_id(build_id: str) Build[source]

Get a build by id.

Parameters:

build_id – build id to query.

Returns:

Build queried for.

builds_by_version(version_id: str, params: Optional[Dict] = None) List[Build][source]

Get all builds for a given Evergreen version_id.

Parameters:
  • version_id – Version Id to query for.

  • params – Dictionary of parameters to pass to query.

Returns:

List of builds for the specified version.

commit_queue_for_project(project_id: str) CommitQueue[source]

Get the current commit queue for the specified project.

Parameters:

project_id – Id of project to query.

Returns:

Current commit queue for project.

configure_patch(patch_id: str, variants: List[Dict[str, Union[str, List[str]]]], description: Optional[str] = None) None[source]

Update a patch.

Parameters:
  • patch_id – Id of the patch to update

  • variants – list of objects with keys “id” who’s value is the variant ID, and key “tasks” with value of a list of task names to configure for specified variant. See the documentation for more details https://github.com/evergreen-ci/evergreen/wiki/REST-V2-Usage#configureschedule-a-patch

  • description – If specified, will update the patch’s description with the string provided

configure_task(task_id: str, activated: Optional[bool] = None, priority: Optional[int] = None) None[source]

Update a task.

Parameters:
  • task_id – Id of the task to update

  • activated – If specified, will update the task to specified value True or False

  • priority – If specified, will update the task’s priority to specified number

delete_user_permissions(user_id: str, resource_type: RemovablePermission, resource_id: Optional[str] = None) None[source]

Delete all permissions of a given type for a user.

Parameters:
  • user_id – Id of the user whose permissions to remove.

  • resource_type – A permission that can be removed.

  • resource_id – Resource id for which to delete permissions. Required unless deleting all permissions.

file_ticket_for_task(task_id: str, execution: int, ticket_link: str, ticket_key: str) None[source]

Update an Evergreen task with information about a ticket created from it.

Parameters:
  • task_id – The id of the task to update.

  • execution – The execution of the task to update.

  • ticket_link – The url link to the created ticket.

  • ticket_key – The key of the created ticket.

classmethod get_api(auth: Optional[EvgAuth] = None, use_config_file: bool = False, config_file: Optional[str] = None, timeout: Optional[int] = 300, log_on_error: bool = False) EvergreenApi[source]

Get an evergreen api instance based on config file settings.

Parameters:
  • auth – EvgAuth with authentication to use.

  • use_config_file – attempt to read auth from default config file.

  • config_file – config file with authentication information.

  • timeout – Network timeout.

  • log_on_error – Flag to use for error logs.

Returns:

EvergreenApi instance.

get_patch_diff(patch_id: str) str[source]

Get the diff for a given patch.

Parameters:

patch_id – The id of the patch to request the diff for.

Returns:

The diff of the patch represented as plain text.

get_task_annotation(task_id: str, execution: Optional[int] = None, fetch_all_executions: Optional[bool] = None) List[TaskAnnotation][source]

Get the task annotations for the given task.

Parameters:
  • task_id – Id of task to query.

  • execution – Execution number of task to query (defaults to latest).

  • fetch_all_executions – Get annotations for all executions of this task.

Returns:

The task annotations for the given task, if any exists.

get_users_for_role(role: str) UsersForRole[source]

Get a list of users having an evergreen role.

Parameters:

role – Role to fetch users for.

give_permissions_to_user(user_id: str, resource_type: PermissionableResourceType, resources: List[str], permissions: Dict[str, int]) None[source]

Grant a user permissions to evergreen resources.

Parameters:
  • user_id – Id of the user to give permissions to.

  • resource_type – An evergreen resource type that supports permissions.

  • resources – A list of evergreen resources of type resource_type.

  • permissions – Permissions to grant. E.g. - [{“project_tasks”: 30, “project_patches”: 10}]

give_roles_to_user(user_id: str, roles: List[str], create_user: bool = False) None[source]

Add the specified role to the specified user.

Parameters:
  • user_id – Id of the user to give the roles to.

  • roles – A list of roles to give to the user.

  • create_user – If true, will also create a user document for the user.

host_by_id(host_id: str) Host[source]

Get evergreen host by id.

Parameters:

host_id – host ids, ‘i-000cba730e92eb85b’

Returns:

host document

json_by_task(task_id: str, json_key: str) Dict[str, Any][source]

Get the json reported for task {task_id} using the key {json_key}.

Parameters:
  • task_id – Id of task to query for.

  • json_key – The key that json was published under, e.g. “perf”.

Returns:

The json published for that task.

json_history_for_task(task_id: str, task_name: str, json_key: str) List[Dict[str, Any]][source]

Get the history of json reported for task {task_id} using the key {json_key}.

Parameters:
  • task_id – Id of task to query for.

  • task_name – Name of task to query for.

  • json_key – The key that json was published under, e.g. “perf”.

Returns:

A chronological list of json published for that task.

manifest(project_id: str, revision: str) Manifest[source]

Get the manifest for the given revision.

Parameters:
  • project_id – Project the revision belongs to.

  • revision – Revision to get manifest of.

Returns:

Manifest of the given revision of the given project.

manifest_for_task(task_id: str) Optional[Manifest][source]

Get the manifest for the given task.

Parameters:

task_id – Task Id fo query.

Returns:

Manifest for the given task.

num_of_tests_by_task(task_id: str) int[source]

Get the number of tests that ran as part of the given task.

Parameters:

task_id – Id of task to query for.

Returns:

Number of tests for the specified task.

patch_by_id(patch_id: str, params: Optional[Dict] = None) Patch[source]

Get a patch by patch id.

Parameters:
  • patch_id – Id of patch to query for.

  • params – Parameters to pass to endpoint.

Returns:

Patch queried for.

patch_from_diff(diff_file_path: str, params: dict[str, str], base: str, task: str, project: str, description: str, variant: str, author: Optional[str] = None) PatchCreationDetails[source]

Start a patch build based on a patch.

Parameters:
  • diff_file_path – The path to the diff.

  • params – The params to pass to the build.

  • base – The build’s base commit.

  • task – The task(s) to run.

  • project – The project to start the build for.

  • description – A description of the build.

  • variant – The variant(s) to build against.

  • author – The author to attribute for the build.

Raises:

Exception – If a build URL is not produced we raise an exception with the output included.

Returns:

The patch creation details.

patch_from_patch_id(patch_id: str, params: dict[str, str], task: str, project: str, description: str, variant: str, author: Optional[str] = None) PatchCreationDetails[source]

Start a patch build based on a diff.

Parameters:
  • patch_id – The patch_id to base this build on.

  • params – The params to pass to the build.

  • base – The build’s base commit.

  • task – The task(s) to run.

  • project – The project to start the build for.

  • description – A description of the build.

  • variant – The variant(s) to build against.

  • author – The author to attribute for the build.

Raises:

Exception – If a build URL is not produced we raise an exception with the output included.

Returns:

The patch creation details.

patches_by_project(project_id: str, params: Optional[Dict] = None) Iterable[Patch][source]

Get a list of patches for the specified project.

Parameters:
  • project_id – Id of project to query.

  • params – parameters to pass to endpoint.

Returns:

List of recent patches.

patches_by_project_time_window(project_id: str, before: datetime, after: datetime, params: Optional[Dict] = None, time_attr: str = 'create_time') Iterable[Patch][source]

Get an iterator over the patches for the given time window.

Parameters:
  • project_id – Id of project to query.

  • params – Parameters to pass to endpoint.

  • before – Return patches earlier than this timestamp

  • after – Return patches later than this timestamp.

  • time_attr – Attributes to use to window timestamps.

Returns:

Iterator for the given time window.

patches_by_user(user_id: str, start_at: Optional[datetime] = None, limit: Optional[int] = None) Iterable[Patch][source]

Get an iterable of recent patches by the given user.

Parameters:
  • user_id – Id of user to query.

  • start_at – If specified, query starting at the given date.

  • limit – If specified, limit the output per page.

performance_results_by_task(task_id: str) PerformanceData[source]

Get the ‘perf.json’ performance results for a given task_id.

Parameters:

task_id – Id of task to query for.

Returns:

Contents of ‘perf.json’

performance_results_by_task_name(task_id: str, task_name: str) List[PerformanceData][source]

Get the ‘perf.json’ performance results for a given task_id and task_name.

Parameters:
  • task_id – Id of task to query for.

  • task_name – Name of task to query for.

Returns:

Contents of ‘perf.json’

permissions_for_user(user_id: str) List[ResourceTypePermissions][source]

Get the permissions a user has on evergreen resources.

Parameters:

user_id – Id of the user whose permissions to get.

Returns:

List of permissions the user has.

project_by_id(project_id: str) Project[source]

Get a project by project_id.

Parameters:

project_id – Id of project to query.

Returns:

Project specified.

recent_versions_by_project(project_id: str, params: Optional[Dict] = None) RecentVersions[source]

Get recent versions created in specified project.

Parameters:
  • project_id – Id of project to query.

  • params – parameters to pass to endpoint.

Returns:

List of recent versions.

restart_task(task_id: str) None[source]

Restart a task.

Parameters:

task_id – Id of the task to restart

retrieve_task_log(log_url: str, raw: bool = False) str[source]

Get the request log file from a task.

Parameters:
  • log_url – URL of log to retrieve.

  • raw – Retrieve the raw version of the log

Returns:

Contents of specified log file.

send_email(recipients: List[str], sender: Optional[str] = None, subject: Optional[str] = None, body: Optional[str] = None, is_plain_text: Optional[bool] = None, headers: Optional[Dict[str, List[str]]] = None) None[source]

Send an email to a user.

Parameters:
  • recipients – Who to send the email to.

  • sender – Who the email should be sent on behalf of.

  • subject – The subject of the email to send.

  • body – What should be in the body of the email.

  • is_plain_text – If the email is in plain text or not. If true, will be text/plain. text/html otherwise.

  • headers – What email headers to attach.

send_slack_message(target: str, msg: str, attachments: Optional[List[SlackAttachment]] = None) None[source]

Send a Slack message to a user or channel in Slack.

Parameters:
  • target – The slack name of the user or channel to send the message to.

  • msg – The slack message to send.

  • attachments – What additional data to send to the specified target in Slack.

property session: Session

Get the shared session if it exists, else create a new session.

Returns:

Session to query the API with.

single_test_by_task_and_test_file(task_id: str, test_file: str) List[Tst][source]

Get a test for a given task.

Parameters:
  • task_id – Id of task to query for.

  • test_file – the name of the test_file of the test.

Returns:

the test for the specified task.

stream_log(log_url: str) Iterable[source]

Stream the given log url as a python generator.

Parameters:

log_url – URL of log file to stream.

Returns:

Iterable for contents of log_url.

task_by_id(task_id: str, fetch_all_executions: Optional[bool] = None, execution: Optional[int] = None) Task[source]

Get a task by task_id.

Parameters:
  • task_id – Id of task to query for.

  • execution – Will query for a specific task execution

  • fetch_all_executions – Should all executions of the task be fetched.

Returns:

Task queried for.

task_reliability_by_project(project_id: str, after_date: Optional[datetime] = None, before_date: Optional[datetime] = None, group_num_days: Optional[int] = None, requesters: Optional[Requester] = None, tasks: Optional[List[str]] = None, variants: Optional[List[str]] = None, distros: Optional[List[str]] = None, group_by: Optional[str] = None, sort: Optional[str] = None) List[TaskReliability][source]

Get task reliability scores.

Parameters:
  • project_id – Id of patch to query for.

  • after_date – Collect stats after this date.

  • before_date – Collect stats before this date, defaults to nothing.

  • group_num_days – Aggregate statistics to this size.

  • requesters – Filter by requesters (mainline, patch, trigger, or adhoc).

  • tasks – Only include specified tasks.

  • variants – Only include specified variants.

  • distros – Only include specified distros.

  • group_by – How to group results (test_task_variant, test_task, or test)

  • sort – How to sort results (earliest or latest).

Returns:

Patch queried for.

task_stats_by_project(project_id: str, after_date: datetime, before_date: datetime, group_num_days: Optional[int] = None, requesters: Optional[Requester] = None, tasks: Optional[List[str]] = None, variants: Optional[List[str]] = None, distros: Optional[List[str]] = None, group_by: Optional[str] = None, sort: Optional[str] = None) List[TaskStats][source]

Get task stats by project id.

Parameters:
  • project_id – Id of patch to query for.

  • after_date – Collect stats after this date.

  • before_date – Collect stats before this date.

  • group_num_days – Aggregate statistics to this size.

  • requesters – Filter by requestors (mainline, patch, trigger, or adhoc).

  • tasks – Only include specified tasks.

  • variants – Only include specified variants.

  • distros – Only include specified distros.

  • group_by – How to group results (test_task_variant, test_task, or test)

  • sort – How to sort results (earliest or latest).

Returns:

Patch queried for.

tasks_by_build(build_id: str, fetch_all_executions: Optional[bool] = None) List[Task][source]

Get all tasks for a given build.

Parameters:
  • build_id – build_id to query.

  • fetch_all_executions – Fetch all executions for a given task.

Returns:

List of tasks for the specified build.

tasks_by_project(project_id: str, statuses: Optional[List[str]] = None) List[Task][source]

Get all the tasks for a project.

Parameters:
  • project_id – The project’s id.

  • statuses – the types of statuses to get tasks for.

Returns:

The list of matching tasks.

tasks_by_project_and_commit(project_id: str, commit_hash: str, params: Optional[Dict] = None) List[Task][source]

Get all the tasks for a revision in specified project.

Parameters:
  • project_id – Project id associated with the revision

  • commit_hash – Commit to get tasks for

  • params – Dictionary of parameters to pass to query.

Returns:

The list of matching tasks.

tasks_by_project_and_name(project_id: str, task_name: str, build_variant: Optional[str] = None, num_versions: Optional[int] = None, start_at: Optional[int] = None) List[Task][source]

Get all the tasks for a project by task name.

Parameters:
  • project_id – Id of project to query.

  • task_name – Name of task to query for.

  • build_variant – Only include tasks that have run on this build variant.

  • num_versions – The number of latest versions to be searched. Defaults to 20.

  • start_at – The version order number to start returning results after.

test_stats_by_project(project_id: str, after_date: datetime, before_date: datetime, group_num_days: Optional[int] = None, requesters: Optional[Requester] = None, tests: Optional[List[str]] = None, tasks: Optional[List[str]] = None, variants: Optional[List[str]] = None, distros: Optional[List[str]] = None, group_by: Optional[str] = None, sort: Optional[str] = None) List[TestStats][source]

Get a patch by patch id.

Parameters:
  • project_id – Id of patch to query for.

  • after_date – Collect stats after this date.

  • before_date – Collect stats before this date.

  • group_num_days – Aggregate statistics to this size.

  • requesters – Filter by requestors (mainline, patch, trigger, or adhoc).

  • tests – Only include specified tests.

  • tasks – Only include specified tasks.

  • variants – Only include specified variants.

  • distros – Only include specified distros.

  • group_by – How to group results (test_task_variant, test_task, or test)

  • sort – How to sort results (earliest or latest).

Returns:

Patch queried for.

tests_by_task(task_id: str, status: Optional[str] = None, execution: Optional[int] = None) List[Tst][source]

Get all tests for a given task.

Parameters:
  • task_id – Id of task to query for.

  • status – Limit results to given status.

  • execution – Retrieve the specified task execution (defaults to 0).

Returns:

List of tests for the specified task.

update_patch_status(patch_id: str, activated: Optional[bool] = None, priority: Optional[int] = None) None[source]

Update a patch and set its status.

Parameters:
  • patch_id – Id of the patch to update

  • activated – If specified, will update the patch to specified value True or False

  • priority – If specified, will update the patch’s priority to specified number

version_by_id(version_id: str) Version[source]

Get version by version id.

Parameters:

version_id – Id of version to query.

Returns:

Version queried for.

versions_by_project(project_id: str, requester: Requester = Requester.GITTER_REQUEST, start: Optional[int] = None, limit: Optional[int] = None, revision_start: Optional[int] = None, revision_end: Optional[int] = None) Iterator[Version][source]

Get the versions created in the specified project.

Parameters:
  • project_id – Id of project to query.

  • requester – Type of versions to query.

  • start – Optional. The revision order number to start after, for pagination.

  • limit – Optional. The number of versions to be returned per page of pagination.

  • revision_start – Optional. The version order number to start at, for pagination.

  • revision_end – Optional. The version order number to end at, for pagination.

Returns:

Generator of versions.

versions_by_project_time_window(project_id: str, before: datetime, after: datetime, requester: Requester = Requester.GITTER_REQUEST, time_attr: str = 'create_time') Iterable[Version][source]

Get an iterator over the patches for the given time window.

Parameters:
  • project_id – Id of project to query.

  • requester – Type of version to query

  • before – Return versions earlier than this timestamp.

  • after – Return versions later than this timestamp.

  • time_attr – Attributes to use to window timestamps.

Returns:

Iterator for the given time window.

with_session() Generator[EvergreenApi, None, None][source]

Yield an instance of the API client with a shared session.

class evergreen.api.RetryingEvergreenApi(api_server: str = 'https://evergreen.mongodb.com', auth: Optional[EvgAuth] = None, timeout: Optional[int] = None, log_on_error: bool = False)[source]

Bases: EvergreenApi

An Evergreen Api that retries failed calls.

evergreen.api_requests module

Objects for making requests to the API.

class evergreen.api_requests.IssueLinkRequest(issue_key: str, url: str, confidence_score: Optional[float] = None)[source]

Bases: NamedTuple

Issue to add to a task annotation.

as_dict() Dict[str, Any][source]

Get a dictionary representation of the issue link.

confidence_score: Optional[float]

Alias for field number 2

issue_key: str

Alias for field number 0

url: str

Alias for field number 1

class evergreen.api_requests.MetadataLinkRequest(url: str, text: str)[source]

Bases: NamedTuple

Metadata Link to add to a task annotation.

text: str

Alias for field number 1

url: str

Alias for field number 0

class evergreen.api_requests.SlackAttachment(*, title: Optional[str] = None, title_link: Optional[str] = None, text: Optional[str] = None, fallback: Optional[str] = None, mrkdwn_in: Optional[List[str]] = None, color: Optional[str] = None, author_name: Optional[str] = None, author_icon: Optional[str] = None, fields: Optional[List[SlackAttachmentField]] = None)[source]

Bases: BaseModel

An attachment to be sent using Slack.

title: The attachment title. title_link: A URL that turns the title into a link. text: If fallback is empty, this is required. The main body text of the attachment as plain text, or with markdown using mrkdwn_in. fallback: If text is empty, this is required. A plain text summary of an attachment for clients that don’t show formatted text (eg. IRC, mobile notifications). mrkdwn_in: An array of fields that should be formatted with markdown. color: The message color. Can either be one of good (green), warning (yellow), danger (red), or any hex color code (eg. #439FE0). author_name: The display name of the author. author_icon: A URL that displays the author icon. Will only work if author_name is present. fields: Array of SlackAttachmentFields that get displayed in a table-like format.

author_icon: Optional[str]
author_name: Optional[str]
color: Optional[str]
fallback: Optional[str]
fields: Optional[List[SlackAttachmentField]]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'author_icon': FieldInfo(annotation=Union[str, NoneType], required=False), 'author_name': FieldInfo(annotation=Union[str, NoneType], required=False), 'color': FieldInfo(annotation=Union[str, NoneType], required=False), 'fallback': FieldInfo(annotation=Union[str, NoneType], required=False), 'fields': FieldInfo(annotation=Union[List[evergreen.api_requests.SlackAttachmentField], NoneType], required=False), 'mrkdwn_in': FieldInfo(annotation=Union[List[str], NoneType], required=False), 'text': FieldInfo(annotation=Union[str, NoneType], required=False), 'title': FieldInfo(annotation=Union[str, NoneType], required=False), 'title_link': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

mrkdwn_in: Optional[List[str]]
text: Optional[str]
title: Optional[str]
class evergreen.api_requests.SlackAttachmentField(*, title: Optional[str], value: Optional[str], short: Optional[bool])[source]

Bases: BaseModel

Slack fields that get displayed in a table-like format.

title: The field title. value: The field text. It can be formatted as plain text or with markdown by using mrkdwn_in. short: Indicates whether the field object is short enough to be displayed side-by-side with other field objects.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'short': FieldInfo(annotation=Union[bool, NoneType], required=True), 'title': FieldInfo(annotation=Union[str, NoneType], required=True), 'value': FieldInfo(annotation=Union[str, NoneType], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

short: Optional[bool]
title: Optional[str]
value: Optional[str]

evergreen.base module

Task representation of evergreen.

evergreen.base.evg_attrib(attrib_name: str, type_fn: Optional[Callable] = None) property[source]

Create an attribute for the given evergreen property.

This creates an attribute for the class that looks up the value via json. It is used to allow editors to show what attributes are available for a given evergreen object.

Parameters:
  • attrib_name – name of attribute.

  • type_fn – method to use to convert attribute by type.

evergreen.base.evg_date_attrib(attrib_name: str) property[source]

Create a date attribute for the given evergreen property.

Parameters:

attrib_name – Name of attribute.

evergreen.base.evg_datetime_attrib(attrib_name: str) property[source]

Create a datetime attribute for the given evergreen property.

Parameters:

attrib_name – Name of attribute.

evergreen.base.evg_short_datetime_attrib(attrib_name: str) property[source]

Create a shortened datetime attribute for the given evergreen property.

Parameters:

attrib_name – Name of attribute.

evergreen.build module

Representation of an evergreen build.

class evergreen.build.Build(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen build.

property activated: Any

value of activated

property activated_by: Any

value of activated_by

property activated_time: Any

value of activated_time

property actual_makespan_ms: Any

value of actual_makespan_ms

property branch: Any

value of branch

property build_variant: Any

value of build_variant

property create_time: Any

value of create_time

property display_name: Any

value of display_name

property finish_time: Any

value of finish_time

get_metrics(task_filter_fn: Optional[Callable] = None) Optional[BuildMetrics][source]

Get metrics for the build.

Metrics are only available on build that have finished running..

Parameters:

task_filter_fn – function to filter tasks included for metrics, should accept a task argument.

Returns:

Metrics for the build.

get_project_identifier() str[source]

Return the human-readable project id. Can also be accessed as an attribute.

Returns:

Human-readable project id.

get_tasks(fetch_all_executions: bool = False) List[Task][source]

Get all tasks for this build.

Parameters:

fetch_all_executions – fetch all executions for tasks.

Returns:

List of all tasks.

get_version() Version[source]

Get the version this build is a part of.

Returns:

Version that this build is a part of.

property git_hash: Any

value of git_hash

property id: Any

value of _id

is_completed() bool[source]

Determine if this build has completed running tasks.

Returns:

True if build has completed running tasks.

property order: Any

value of order

property origin: Any

value of origin

property predicted_makespan_ms: Any

value of predicted_makespan_ms

property project_id: Any

value of project_id

property project_identifier: Any

value of project_identifier

property start_time: Any

value of start_time

property status: Any

value of status

property status_counts: StatusCounts

Get the status counts of the build.

property tasks: Any

value of tasks

property time_taken_ms: Any

value of time_taken_ms

property version: Any

value of version

class evergreen.build.StatusCounts(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of Evergreen StatusCounts.

property dispatched: Any

value of dispatched

property failed: Any

value of failed

property inactivate: Any

value of inactive

property started: Any

value of started

property succeeded: Any

value of succeeded

property timed_out: Any

value of timed_out

property undispatched: Any

value of undispatched

evergreen.commitqueue module

Commit Queue representation of evergreen.

class evergreen.commitqueue.CommitQueue(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a commit queue from evergreen.

property queue: List[CommitQueueItem]

Retrieve the queue for this commit queue.

Returns:

Queue of commits in the commit queue.

property queue_id: Any

value of queue_id

class evergreen.commitqueue.CommitQueueItem(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an entry in a commit queue.

property issue: Any

value of issue

property modules: Any

value of modules

evergreen.config module

Get configuration about connecting to evergreen.

class evergreen.config.EvgAuth(username, api_key)

Bases: tuple

api_key

Alias for field number 1

username

Alias for field number 0

evergreen.config.get_auth() Optional[EvgAuth][source]

Get the evergreen authentication object from the default locations. Convenience function.

Returns:

Authentication information for evergreen.

evergreen.config.get_auth_from_config(config: Dict) EvgAuth[source]

Get the evergreen authentication from the specified config dict.

Parameters:

config – Evergreen configuration.

Returns:

Authentication information for evergreen.

evergreen.config.read_evergreen_config() Optional[Dict][source]

Search known location for the evergreen config file.

Returns:

First found evergreen configuration.

evergreen.config.read_evergreen_from_file(filename: str) Dict[source]

Read evergreen config from given filename.

Parameters:

filename – Filename to read config.

Returns:

Config read from file.

evergreen.distro module

Host representation of evergreen.

class evergreen.distro.AwsDistroSettings(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of AWS Distro Settings.

property ami: Any

value of ami

property aws_access_key_id: Any

value of aws_access_key_id

property aws_access_secret_id: Any

value of aws_access_secret_id

property bid_price: Any

value of bid_price

property instance_type: Any

value of instance_type

property ipv6: Any

value of ipv6

property is_vpc: Any

value of is_vpc

property key_name: Any

value of key_name

property mount_points: List[MountPoint]

Retrieve list of mount points for the distro.

Returns:

List of mount points.

property region: Any

value of region

property security_group: Any

value of security_group

property security_group_ids: Any

value of security_group_ids

property subnet_id: Any

value of subnet_id

property user_data: Any

value of user_data

property vpc_name: Any

value of vpc_name

class evergreen.distro.Distro(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen Distro.

property arch: Any

value of arch

property bootstrap_method: Any

value of bootstrap_method

property client_dir: Any

value of client_dir

property clone_method: Any

value of clone_method

property communication_method: Any

value of communication_method

property container_pool: Any

value of container_pool

property curator_dir: Any

value of curator_dir

property disabled: Any

value of disabled

property expansions: Optional[Dict[str, str]]

Retrieve dict of expansions for distro.

Returns:

dict of expansions.

property finder_settings: FinderSettings

Retrieve finder settings for distro.

Returns:

finder settings.

property image_id: Any

value of image_id

property jasper_credentials_path: Any

value of jasper_credentials_path

property name: Any

value of name

property planner_settings: PlannerSettings

Retrieve planner settings for distro.

Returns:

planner settings.

property pool_size: Any

value of pool_size

property provider: Any

value of provider

property settings: Optional[Any]

Retrieve the settings for the distro.

Returns:

settings for distro.

property setup: Any

value of setup

property setup_as_sudo: Any

value of setup_as_sudo

property shell_path: Any

value of shell_path

property ssh_key: Any

value of ssh_key

property ssh_options: Any

value of ssh_options

property teardown: Any

value of teardown

property user: Any

value of user

property user_spawn_allowed: Any

value of user_spawn_allowed

property work_dir: Any

value of work_dir

class evergreen.distro.DockerDistroSettings(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of docker distro settings.

property image_url: Any

value of image_url

class evergreen.distro.FinderSettings(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of finder settings.

property version: Any

value of version

class evergreen.distro.MountPoint(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of Mount Point in distro settings.

property device_name: Any

value of device_name

property size: Any

value of size

property virtual_name: Any

value of virtual_name

class evergreen.distro.PlannerSettings(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of planner settings.

property acceptable_host_idle_time: Any

value of acceptable_host_idle_time

property group_versions: Any

value of group_versions

property maximum_hosts: Any

value of maximum_hosts

property minimum_hosts: Any

value of minimum_hosts

property patch_zipper_factor: Any

value of patch_zipper_factor

property target_time: Any

value of target_time

property task_ordering: Any

value of task_ordering

property version: Any

value of version

class evergreen.distro.StaticDistroSettings(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of Evergreen static distro settings.

property hosts: List[str]

Retrieve Hosts of static distro.

Returns:

hosts of static distro.

evergreen.host module

Host representation of evergreen.

class evergreen.host.Host(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen host.

property distro: HostDistro

Get the distro on this host.

get_build() Build[source]

Get the build for the build using this host.

Returns:

build for task running on this host.

get_version() Version[source]

Get the version for the task using this host.

Returns:

version for task running on this host.

property host_id: Any

value of host_id

property host_type: Any

value of host_type

property host_url: Any

value of host_url

property provisioned: Any

value of provisioned

property running_task: RunningTask

Get the running task on this host.

property started_by: Any

value of started_by

property status: Any

value of status

property user: Any

value of user

property user_host: Any

value of user_host

class evergreen.host.HostDistro(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a distro.

property distro_id: Any

value of distro_id

property image_id: Any

value of image_id

property provider: Any

value of provider

class evergreen.host.RunningTask(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a running task.

property build_id: Any

value of build_id

property dispatch_time: Any

value of dispatch_time

get_build() Build[source]

Get build for the running task.

Returns:

build object for task.

get_version() Version[source]

Get version for the running task.

Returns:

version object for task.

property name: Any

value of name

property task_id: Any

value of task_id

property version_id: Any

value of version_id

evergreen.manifest module

Representation of evergreen manifest.

class evergreen.manifest.Manifest(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an evergreen manifest.

property branch: Any

value of branch

property id: Any

value of id

property modules: Optional[Dict[str, ManifestModule]]

Map of modules in this manifest.

property project: Any

value of project

property revision: Any

value of revision

class evergreen.manifest.ManifestModule(name: str, json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Represents a module in the evergreen manifest.

property branch: Any

value of branch

property owner: Any

value of owner

property repo: Any

value of repo

property revision: Any

value of revision

property url: Any

value of url

evergreen.patch module

Representation of an evergreen patch.

class evergreen.patch.FileDiff(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a file diff for a patch.

property additions: Any

value of additions

property deletions: Any

value of deletions

property description: Any

value of description

value of diff_link

property file_name: Any

value of file_name

class evergreen.patch.GithubPatchData(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of github patch data in a patch object.

property author: Any

value of author

property base_owner: Any

value of base_owner

property base_repo: Any

value of base_repo

property head_hash: Any

value of head_hash

property head_owner: Any

value of head_owner

property head_repo: Any

value of head_repo

property pr_number: Any

value of pr_number

class evergreen.patch.ModuleCodeChanges(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of the module code changes for a patch.

property branch_name: Any

value of branch_name

property commit_messages: Any

value of commit_messages

property file_diffs: List[FileDiff]

Retrieve a list of the file diffs for this patch.

value of html_link

value of raw_link

class evergreen.patch.Patch(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen patch.

property activated: Any

value of activated

property alias: Any

value of alias

property author: Any

value of author

property branch: Any

value of branch

property builds: Any

value of builds

property commit_queue_position: Any

value of commit_queue_position

property create_time: Any

value of create_time

property description: Any

value of description

property finish_time: Any

value of finish_time

get_version() Version[source]

Get version for this patch.

Returns:

Version object.

property git_hash: Any

value of git_hash

property github_patch_data: GithubPatchData

Retrieve the github patch data for this patch.

Returns:

Github Patch Data for this patch.

is_in_commit_queue() bool[source]

Check whether this patch is currently in the commit queue.

Returns:

True if in the commit queue, False otherwise.

property module_code_changes: List[ModuleCodeChanges]

Retrieve the modele code changes for this patch.

Returns:

Module code changes for this patch.

property patch_id: Any

value of patch_id

property patch_number: Any

value of patch_number

property project_id: Any

value of project_id

property start_time: Any

value of start_time

property status: Any

value of status

task_list_for_variant(variant: str) Set[str][source]

Retrieve the list of tasks for the given variant.

Parameters:

variant – name of variant to search for.

Returns:

list of tasks belonging to the specified variant.

property tasks: Any

value of tasks

property variants_tasks: List[VariantsTasks]

Retrieve the variants tasks for this patch.

Returns:

variants tasks for this patch.

property version: Any

value of version

class evergreen.patch.PatchCreationDetails(url: str, id: str)[source]

Bases: NamedTuple

Details of a patch creation.

id: str

Alias for field number 1

url: str

Alias for field number 0

class evergreen.patch.VariantsTasks(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a variants tasks object.

property name: Any

value of name

property tasks: Set[str]

Retrieve the set of all tasks for this variant.

Returns:

Set of all tasks for this variant.

evergreen.performance_results module

Performance results representation of evergreen.

class evergreen.performance_results.PerformanceData(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of performance data from Evergreen.

property create_time: Any

value of create_time

property name: Any

value of name

property order: Any

value of order

property project_id: Any

value of project_id

property revision: Any

value of revision

property tag: Any

value of tag

property task_id: Any

value of task_id

property task_name: Any

value of task_name

property test_batch: PerformanceTestBatch

Get the performance test batch.

property variant: Any

value of variant

property version_id: Any

value of version_id

class evergreen.performance_results.PerformanceTestBatch(json: Dict[str, Any], api: EvergreenApi, parent: PerformanceData)[source]

Bases: _BaseEvergreenObject

Representation of a batch of tests from Evergreen.

property end: Any

value of end

property errors: Any

value of errors

property start: Any

value of start

property storage_engine: Any

value of storageEngine

property test_runs: List[PerformanceTestRun]

Get a list of test runs.

test_runs_matching(tests: List[str]) List[PerformanceTestRun][source]

Get a list of test run for the given tests.

Parameters:

tests – List of tests to match against.

Returns:

List of test runs for the given tests.

class evergreen.performance_results.PerformanceTestResult(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a test result from Evergreen.

property mean_value: Any

value of mean_value

property measurement: Any

value of measurement

property recorded_values: Any

value of recorded_values

property thread_level: Any

value of thread_level

class evergreen.performance_results.PerformanceTestRun(test_result: Dict, api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a test run from Evergreen.

property end: Optional[Any]

Get the start time for the given test run.

property start: Optional[Any]

Get the start time for the given test run.

property test_name: Any

value of name

property test_results: List[PerformanceTestResult]

Get the performance test results for this run.

property workload: Any

value of workload

evergreen.project module

Evergreen representation of a project.

class evergreen.project.Project(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen project.

property admins: Any

value of admins

property batch_time: Any

value of batch_time

property branch_name: Any

value of branch_name

property commit_queue: Any

value of commit_queue

property deactivated_previous: Any

value of deactivate_previous

property display_name: Any

value of display_name

property enabled: Any

value of enabled

property id: Any

value of id

property identifier: Any

value of identifier

most_recent_version() Version[source]

Fetch the most recent version.

Returns:

Version queried for.

property owner_name: Any

value of owner_name

property pr_testing_enabled: Any

value of pr_testing_enabled

property private: Any

value of private

property remote_path: Any

value of remote_path

property repo_name: Any

value of repo_name

property tracked: Any

value of tracked

property tracks_push_events: Any

value of tracks_push_events

evergreen.resource_type_permissions module

Evergreen representation of a user’s permissions.

class evergreen.resource_type_permissions.PermissionableResourceType(value)[source]

Bases: str, Enum

Represents resource types that a user can be granted permissions to.

DISTRO = 'distro'
PROJECT = 'project'
SUPERUSER = 'superuser'
class evergreen.resource_type_permissions.RemovablePermission(value)[source]

Bases: str, Enum

Represents a permission that can be removed from a user.

ALL = 'all'
DISTRO = 'distro'
PROJECT = 'project'
SUPERUSER = 'superuser'
class evergreen.resource_type_permissions.ResourceTypePermissions(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a user’s permissions on resources of a specific type.

property permissions: Any

value of permissions

property resource_type: Any

value of type

evergreen.stats module

Stats representation of evergreen.

class evergreen.stats.TaskStats(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen task stats object.

property avg_duration_pass: Any

value of avg_duration_success

property date: Any

value of date

property distro: Any

value of distro

property num_fail: Any

value of num_failed

property num_pass: Any

value of num_success

property num_total: Any

value of num_total

property task_name: Any

value of task_name

property variant: Any

value of variant

class evergreen.stats.TestStats(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen test stats object.

property avg_duration_pass: Any

value of avg_duration_pass

property date: Any

value of date

property distro: Any

value of distro

property num_fail: Any

value of num_fail

property num_pass: Any

value of num_pass

property task_name: Any

value of task_name

property test_file: Any

value of test_file

property test_name: Any

value of test_name

property variant: Any

value of variant

evergreen.task module

Task representation of evergreen.

class evergreen.task.Artifact(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a task artifact from evergreen.

property content_type: Any

value of content_type

property ignore_for_fetch: Any

value of ignore_for_fetch

property name: Any

value of name

stream(decode_unicode: bool = True, chunk_size: Optional[int] = None, is_binary: Optional[bool] = None) Iterable[str][source]

Retrieve an iterator of the streamed contents of this artifact.

Parameters:
  • decode_unicode – determines if we decode as unicode

  • chunk_size – the size of the chunks to be read

  • is_binary – explicit variable, overrides information from content type

Returns:

Iterable to stream contents of artifact.

property url: Any

value of url

property visibility: Any

value of visibility

class evergreen.task.OomTrackerInfo(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a task’s OOM Tracker Info from evergreen.

property detected: Any

value of detected

property pids: Any

value of pids

class evergreen.task.StatusDetails(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a task status details from evergreen.

property desc: Any

value of desc

property oom_tracker_info: OomTrackerInfo

Retrieve the OOM tracker info from the status details for the given task.

Returns:

OOM Tracker Info.

property status: Any

value of status

property timed_out: Any

value of timed_out

property type: Any

value of type

class evergreen.task.StatusScore(value)[source]

Bases: IntEnum

Integer score of the task status.

FAILURE = 2
FAILURE_SYSTEM = 3
FAILURE_TIMEOUT = 4
SUCCESS = 1
UNDISPATCHED = 5
classmethod get_task_status_score(task: Task) StatusScore[source]

Retrieve the status score based on the task status.

Returns:

Status score.

class evergreen.task.Task(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen task.

property activated: Any

value of activated

property activated_by: Any

value of activated_by

annotate(message: Optional[str] = None, issues: Optional[List[IssueLinkRequest]] = None, suspected_issues: Optional[List[IssueLinkRequest]] = None, metadata: Optional[Dict[str, Any]] = None, metadata_links: Optional[List[MetadataLinkRequest]] = None) None[source]

Annotate the specified task.

Parameters:
  • message – Message to add to the annotations.

  • issues – Issues to attach to the annotation.

  • suspected_issues – Suspected issues to add to the annotation.

  • metadata – Extra metadata to add to the issue.

  • metadata_links – Metadata links to add to the annotation.

property artifacts: List[Artifact]

Retrieve the artifacts for the given task.

Returns:

List of artifacts.

property build_id: Any

value of build_id

property build_variant: Any

value of build_variant

property build_variant_display_name: Any

value of build_variant_display_name

property create_time: Any

value of create_time

property depends_on: Any

value of depends_on

property dispatch_time: Any

value of dispatch_time

property display_name: Any

value of display_name

property display_only: Any

value of display_only

property display_status: Any

value of display_status

property distro_id: Any

value of distro_id

property est_wait_to_start_ms: Any

value of est_wait_to_start_ms

property execution: Any

value of execution

property execution_tasks: Any

value of execution_tasks

property expected_duration_ms: Any

value of expected_duration_ms

property finish_time: Any

value of finish_time

property generate_task: Any

value of generate_task

property generated_by: Any

value of generated_by

get_execution(execution: int) Optional[Task][source]

Get the task info for the specified execution.

Parameters:

execution – Index of execution.

Returns:

Task info for specified execution.

get_execution_or_self(execution: int) Task[source]

Get the specified execution if it exists.

If the specified execution does not exist, return self.

Parameters:

execution – Index of execution.

Returns:

Task info for specified execution or self.

get_execution_tasks(filter_fn: Optional[Callable[[Task], bool]] = None) Optional[List[Task]][source]

Get a list of execution tasks associated with this task.

If this is a display task, return the tasks execution tasks associated with it. If this is not a display task, returns None.

Parameters:

filter_fn – Function to filter returned results.

Returns:

List of execution tasks.

get_manifest() Optional[Manifest][source]

Get the Manifest for this task.

get_num_of_tests() int[source]

Get the number of tests that ran as part of this task.

Returns:

Number of tests for the task.

get_oom_pids() List[int][source]

Get the OOM PIDs for this task.

get_project_identifier() str[source]

Return the human-readable project id. Can also be accessed as an attribute.

Returns:

Human-readable project id.

get_status_score() StatusScore[source]

Retrieve the status score enum for the given task.

Returns:

Status score.

get_task_annotation() List[TaskAnnotation][source]

Get the task annotation for this task.

get_tests(status: Optional[str] = None, execution: Optional[int] = None) List[Tst][source]

Get the test results for this task.

Parameters:
  • status – Only return tests with the given status.

  • execution – Return results for specified execution, if specified.

Returns:

List of test results for the task.

has_oom() bool[source]

Determine if the given task has an OOM failure.

Returns:

True if task has an OOM failure.

property host_id: Any

value of host_id

property ingest_time: Any

value of ingest_time

is_active() bool[source]

Determine if the given task is active.

Returns:

True if task is active.

is_completed() bool[source]

Whether task is completed.

Returns:

True if task is completed.

is_setup_failure() bool[source]

Whether task is a setup failure.

Returns:

True if task is a setup failure.

is_success() bool[source]

Whether task was successful.

Returns:

True if task was successful.

is_system_failure() bool[source]

Whether task resulted in a system failure.

Returns:

True if task was a system failure.

is_test_failure() bool[source]

Whether task was a test failure.

Returns:

True is task was a test failure.

is_timeout() bool[source]

Whether task results in a timeout.

Returns:

True if task was a timeout.

is_undispatched() bool[source]

Whether the task was undispatched.

Returns:

True is task was undispatched.

property log_map: Dict

Retrieve a dict of all the logs.

Returns:

Dictionary of the logs.

property mainline: Any

value of mainline

property order: Any

value of order

property parent_task_id: Any

value of parent_task_id

property priority: Any

value of priority

property project_id: Any

value of project_id

property project_identifier: Any

value of project_identifier

property restarts: Any

value of restarts

retrieve_log(log_name: str, raw: bool = False) str[source]

Retrieve the contents of the specified log.

Parameters:
  • log_name – Name of log to retrieve.

  • raw – Retrieve raw version of log.

Returns:

Contents of the specified log.

property revision: Any

value of revision

property scheduled_time: Any

value of scheduled_time

property start_time: Any

value of start_time

property status: Any

value of status

property status_details: StatusDetails

Retrieve the status details for the given task.

Returns:

Status details.

stream_log(log_name: str) Iterable[str][source]

Retrieve an iterator of a streamed log contents for the given log.

Parameters:

log_name – Log to stream.

Returns:

Iterable log contents.

property task_group: Any

value of task_group

property task_group_max_hosts: Any

value of task_group_max_hosts

property task_id: Any

value of task_id

property time_taken_ms: Any

value of time_taken_ms

property version_id: Any

value of version_id

wait_time() Optional[timedelta][source]

Get the time taken until the task started running.

Returns:

Time taken until task started running.

wait_time_once_unblocked() Optional[timedelta][source]

Get the time taken until the task started running.

Once it is unblocked by task dependencies.

Returns:

Time taken until task started running.

evergreen.task_annotations module

Models to working with task annotations.

Bases: _BaseEvergreenObject

Representation of a issue added as a task annotation.

property issue_key: Any

value of issue_key

property source: Source

Get the source of this issue link.

property url: Any

value of url

Bases: _BaseEvergreenObject

Representation of a metadata link associated with a task annotation.

property source: Source

Get the source of this metadata link.

property text: Any

value of text

property url: Any

value of url

class evergreen.task_annotations.Note(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a note associated with a task annotation.

property message: Any

value of message

property source: Source

Get the source of this note.

class evergreen.task_annotations.Source(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Source of where an annotation was generated.

property author: Any

value of author

property requester: Any

value of requester

property time: Any

value of time

class evergreen.task_annotations.TaskAnnotation(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a task annotation.

property issues: List[IssueLink]

Get the issues this task has been annotated with.

property metadata: Dict[str, Any]

Get metadata associated with this annotation.

Get metadata links for this annotation.

property note: Note

Get a note about this annotation.

property suspected_issues: List[IssueLink]

Get the suspected issues this task has been annotated with.

property task_execution: Any

value of task_execution

property task_id: Any

value of task_id

evergreen.task_reliability module

Stats representation of evergreen.

class evergreen.task_reliability.TaskReliability(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen task reliability object.

property avg_duration_pass: Any

value of avg_duration_pass

property distro: Any

value of distro

property num_failed: Any

value of num_failed

property num_setup_failed: Any

value of num_setup_failed

property num_success: Any

value of num_success

property num_system_failed: Any

value of num_system_failed

property num_test_failed: Any

value of num_test_failed

property num_timeout: Any

value of num_timeout

property num_total: Any

value of num_total

property success_rate: Any

value of success_rate

property task_name: Any

value of task_name

property test_file: Any

value of test_file

property variant: Any

value of variant

evergreen.tst module

Test representation of evergreen.

class evergreen.tst.Logs(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of test logs from evergreen.

property line_num: Any

value of line_num

property log_id: Any

value of log_id

stream() Iterable[str][source]

Retrieve an iterator of the streamed contents of this log.

Returns:

Iterable to stream contents of log.

property url: Any

value of url

property url_lobster: Any

value of url_lobster

property url_parsley: Any

value of url_parsley

property url_raw: Any

value of url_raw

class evergreen.tst.Tst(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a test object from evergreen.

property end_time: Any

value of end_time

property exit_code: Any

value of exit_code

property logs: Logs

Get the log object for the given test.

Returns:

log object for test.

property start_time: Any

value of start_time

property status: Any

value of status

property task_id: Any

value of task_id

property test_file: Any

value of test_file

evergreen.users_for_role module

Representation of users having an evergreen role.

class evergreen.users_for_role.UsersForRole(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a list of users having an evergreen role.

property users: Any

value of users

evergreen.util module

Useful utilities for interacting with Evergreen.

evergreen.util.evergreen_input_to_output(input_date: str) str[source]

Convert a date from evergreen to a date to send back to evergreen.

Parameters:

input_date – date to convert.

Returns:

date to send to evergreen.

evergreen.util.format_evergreen_date(when: datetime) str[source]

Convert a datetime object into a string date that evergreen understands.

Parameters:

when – Datetime object to convert.

Returns:

string version of given date.

evergreen.util.format_evergreen_datetime(when: datetime) str[source]

Convert a datetime object into an evergreen consumable string.

Parameters:

when – datetime to convert.

Returns:

string evergreen can understand.

evergreen.util.iterate_by_time_window(iterator: Iterable, before: datetime, after: datetime, time_attr: str) Iterable[source]

Iterate over a window of time.

For a given iterator, generate the items that are within the specified time window.

Note: Since most evergreen iterators start with the most recent items and then look backwards in time, start and end refer to the start and end of when items will be seen (i.e. start should be later in time than end since we will start seeing new items first.

Parameters:
  • iterator – Iterator to window.

  • before – Return items earlier than this timestamp.

  • after – Return items later than this timestamp.

  • time_attr – Attribute of items in the iterator containing timestamp to check.

Returns:

Iterator for items in the given time window.

evergreen.util.parse_evergreen_date(evg_date: Optional[str]) Optional[date][source]

Convert an evergreen date string into a date object.

Parameters:

evg_date – String to convert to a date.

Returns:

date version of date.

evergreen.util.parse_evergreen_datetime(evg_date: Optional[Any]) Optional[datetime][source]

Convert an evergreen datetime string into a datetime object.

Parameters:

evg_date – String to convert to a datetime.

Returns:

datetime version of date.

evergreen.util.parse_evergreen_short_datetime(evg_date: Optional[str]) Optional[datetime][source]

Convert an evergreen datetime string into a datetime object.

Parameters:

evg_date – String to convert to a datetime.

Returns:

datetime version of date.

evergreen.version module

Version representation of evergreen.

class evergreen.version.BuildVariantStatus(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of a Build Variants status.

property build_id: Any

value of build_id

property build_variant: Any

value of build_variant

get_build() Build[source]

Get the build object for this build variants status.

class evergreen.version.RecentVersionRow(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Wrapper for a row of the RecentVersions endpoint.

property build_variant: Any

value of build_variant

property builds: Dict[str, Build]

Get a map of build IDs to build objects.

class evergreen.version.RecentVersions(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Wrapper for the data object returned by /projects/{project_id}/recent_versions.

property build_variants: Any

value of build_variants

property row_map: Dict[str, RecentVersionRow]

Get a map of build names to RecentVersionRows.

property rows: Any

value of rows

property versions: List[Version]

Get the list of versions from the recent versions response object.

Returns:

List of versions from the response object

class evergreen.version.Requester(value)[source]

Bases: str, Enum

Requester that created version.

AD_HOC = 'ad_hoc'
GITHUB_PULL_REQUEST = 'github_pull_request'
GITTER_REQUEST = 'gitter_request'
MERGE_TEST = 'merge_test'
PATCH_REQUEST = 'patch_request'
TRIGGER_REQUEST = 'trigger_request'
UNKNOWN = 'UNKNOWN'
evg_value() str[source]

Get the evergreen value for a requester.

stats_value() str[source]

Get the value for the stats endpoints.

class evergreen.version.Version(json: Dict[str, Any], api: EvergreenApi)[source]

Bases: _BaseEvergreenObject

Representation of an Evergreen Version.

property aborted: Any

value of aborted

property author: Any

value of author

property author_email: Any

value of author_email

property branch: Any

value of branch

build_by_variant(build_variant: str) Build[source]

Get a build object for the specified variant.

Parameters:

build_variant – Build variant to get build for.

Returns:

Build object for variant.

property build_variants_status: List[BuildVariantStatus]

Get a list of build variant statuses.

property create_time: Any

value of create_time

property errors: Any

value of errors

property finish_time: Any

value of finish_time

get_builds() List[Build][source]

Get all the builds that are a part of this version.

Returns:

List of build that are a part of this version.

get_manifest() Manifest[source]

Get the manifest for this version.

Returns:

Manifest for this version.

get_metrics(task_filter_fn: Optional[Callable] = None) Optional[VersionMetrics][source]

Calculate the metrics for this version.

Metrics are only available on versions that have finished running.

Parameters:

task_filter_fn – function to filter tasks included for metrics, should accept a task argument.

Returns:

Metrics for this version.

get_modules() Optional[Dict[str, ManifestModule]][source]

Get the modules for this version.

Returns:

ManifestModules for this version.

get_patch() Optional[Patch][source]

Get the patch information for this version.

Returns:

Patch for this version.

property ignored: Any

value of ignored

is_completed() bool[source]

Determine if this version has completed running tasks.

Returns:

True if version has completed.

is_patch() bool[source]

Determine if this version from a patch build.

Returns:

True if this version is a patch build.

property message: Any

value of message

property order: Any

value of order

property parameters: Any

value of parameters

property project: Any

value of project

property project_identifier: Any

value of project_identifier

property repo: Any

value of repo

property requester: Requester

Get the requester of this version.

property revision: Any

value of revision

property start_time: Any

value of start_time

property status: Any

value of status

property version_id: Any

value of version_id

property warnings: Any

value of warnings

Module contents

Evergreen API Module.