foundry_dev_tools.clients.build2 module#

Implementation of the build2 API.

class foundry_dev_tools.clients.build2.Build2Client[source]#

Bases: APIClient

Build2Client class implements the ‘build2’ API.

api_name: ClassVar[str] = 'build2'#
api_get_build_report(build_rid, **kwargs)[source]#

Returns the build report.

Parameters:
  • build_rid (api_types.Rid) – the build RID

  • **kwargs – gets passed to APIClient.api_request()

Return type:

requests.Response

api_get_job_report(job_rid, **kwargs)[source]#

Returns the report for a job.

Parameters:
  • job_rid (api_types.Rid) – the job RID

  • **kwargs – gets passed to APIClient.api_request()

Return type:

requests.Response

api_submit_build(job_spec_selections, submission_id=None, build_group_rid=None, branch='master', branch_fallbacks=None, force_build=None, ignore_build_policy=False, finish_on_failure=None, num_run_job_attempts=None, force_retry=None, retry_backoff_duration=None, build_parameters=None, suppress_notifications=None, exceeded_duration_mode=None, input_failure_strategies=None, output_queue_strategy=None, **kwargs)[source]#

Request to submit a build.

Parameters:
  • job_spec_selections (list[api_types.DatasetsJobSpecSelection | api_types.JobSpecJobSpecsSelection | api_types.UpstreamJobSpecSelection | api_types.ConnectingJobSpecSelection]) –

    A set of job spec selection for which the build service will determine the job specs to run based off of the information provided in the selection. There are several types of job spec selections to choose from:

    1. DatasetsJobSpecSelection: The build service will determine the job specs to run, based on the dataset rids provided

    2. JobSpecJobSpecsSelection: The build service will directly run the specified job spec rids

    3. UpstreamJobSpecSelection: A list of downstream dataset rids can be defined to start from searching for job specs. A separate list of dataset rids to ignore can be specified as well in order to prevent further exploration of the dependency graph on the given dataset rids

    4. ConnectingJobSpecSelection: The build service will determine the job specs in between the list of upstream and downstream dataset rids. Additionally, a list of dataset rids to ignore can be passed along on which to prevent further exploration of the dependency graph

  • submission_id (str | None) – Optional submission identifier to uniquely identify a new build submission

  • build_group_rid (str | None) – Specify in order to join a build group which serves as a collector acting as if all the builds sharing the same build group were submitted as a single build

  • branch (api_types.DatasetBranch) – The branch that all jobs in this build are run on. Defaults to master if not specified

  • branch_fallbacks (set[api_types.DatasetBranch] | None) – Fallback branches to use when resolving dataset properties for input specs

  • force_build (bool | None) – When set to ‘True’, will ignore staleness checking when running this build and runs all job specs regardless of whether they are stale

  • ignore_build_policy (bool | None) – When set to ‘True’, will allow for jobs to be run even if their build policy is not satisfied

  • finish_on_failure (bool | None) – When set to ‘True’, will abort all other jobs and finish the build if any single job fails

  • num_run_job_attempts (int | None) – The maximum number of attempts a job should be run when it fails due to a retryable error. If a value <= 1 is specified, jobs will never be retried.

  • force_retry (bool | None) – When set to ‘True’, all errors will be treated as retryable. The maximum number of retry attempts is strictly given by num_run_job_attempts

  • retry_backoff_duration (int | None) – The duration in seconds to wait before attempting to run a job again. If not present, jobs will be retried immediately

  • build_parameters (dict[str, Any] | None) – Parameters to apply to every job in the build which typically serve as “configuration” for the workers

  • suppress_notifications (bool | None) – When set to ‘True’, the user will not receive a notification when the build is complete

  • exceeded_duration_mode (api_types.ExceededDurationMode | None) – The action taken when job with custom expiration has expired. Defaults to ‘CANCEL’ if not provided at all

  • input_failure_strategies (list[api_types.InputStrategy] | None) – Overwrites the strategy for each input dataset in case its build fails.

  • output_queue_strategy (api_types.OutputQueueStrategy | None) – Defines the output queueing behaviour of the jobs that are created by this build. Defaults to ‘QUEUE_UP’ for builds with BatchVariant job specs and ‘SUPERSEDE’ for builds with LongRunningVariant job specs.

  • **kwargs – gets passed to APIClient.api_request()

Returns:

the response contains a json which returns information to the build submitted previously.

Return type:

requests.Response

submit_dataset_build(dataset_rid, branch='master', force_build=False)[source]#

Submit a dataset build.

Parameters:
  • dataset_rid (str) – The resource identifier of the dataset to build

  • branch (str) – The branch that all jobs in this build are run on. Defaults to master if not specified

  • force_build (bool | None) – When set to ‘True’, will ignore staleness checking when running this build and runs all job specs regardless of whether they are stale. Defaults to ‘False’

Return type:

dict

{
     "isNewSubmission": "<submission-id>",
     "buildRid": "<...>",
     "buildGroupRid": "<build-group-rid>",
     "jobsCreated": {
         "<job-spec-rid>": "<job-rid>",
         ...
     },
     "jobsInOtherBuilds": {
         "<job-spec-rid>": "<job-rid>",
         ...
     }
}