Press Deployments

Import the press deployment module and Instantiate a press-deployment client

[ ]:
from collections.abc import Iterator
from typing import Any

from peak.press import deployments

client: deployments.Deployment = deployments.get_client()

Possible field values

Deployment status

The status of the app and block deployments. The following statuses are supported: deployed, deploying, failed, redeploying, deleting, delete_failed, platform_resource_error, rollback, rollback_complete, rollback_failed and warning.

List all app deployment(s) and block deployment(s) and iterate over them

[ ]:
deployment_iterator: Iterator[dict[str, Any]] = client.list_deployments()
deployment_iterated: dict[str, Any] = next(deployment_iterator)

"""
This method returns all the app and block deployments for the tenant.
The list of deployments will be returned in the following format:

{
  "deploymentCount": 1,
  "deployments": [
    {
      "id": "db283fc2-9164-4027-b09e-8c1ecedb122b",
      "kind": "app",
      "latestRevision": {
        "createdAt": "2020-01-01T18:00:00.000Z",
        "createdBy": "jane.smith@peak.ai",
        "id": "2fa92990-3183-40fd-8c93-7ded5a99f705",
        "notes": "This is the initial revision",
        "releaseVersion": "1.0.0",
        "revision": 1,
        "status": "deploying"
      },
      "metadata": {
        "createdAt": "2020-01-01T18:00:00.000Z",
        "createdBy": "jane.smith@peak.ai",
        "description": "This App loads Opportunities and Accounts tables from Salesforce into Peak-managed Snowflake. It then runs a modelling pipeline to predict account churn. Finally it sets up an analytics dashboard for tracking customer behaviours including churn propensity.",
        "descriptionContentType": "text/markdown",
        "imageUrl": "https://my-spec-pics.com/image-1.jpg",
        "name": "sca-deployment",
        "status": "deploying",
        "summary": "This app packages up Block specs to enable analyses on salesforce customers",
        "tags": [
          {
            "name": "salesforce"
          }
        ],
        "title": "SCA Deployment",
        "updatedAt": "2020-01-01T18:00:00.000Z",
        "updatedBy": "jane.smith@peak.ai"
      }
    }
  ],
  "pageCount": 1,
  "pageNumber": 1,
  "pageSize": 25
}
"""

Trigger resources of an app or block deployment

The execute_resources method can be used to trigger resources of the latest revision an app or block deployment for whom the autoRunOnDeploy is enabled. This property can be enabled or disabled while creating the app or block spec or spec release.

[ ]:
execute_response: dict[str, Any] = client.execute_resources(deployment_id="db283fc2-9164-4027-b09e-8c1ecedb122b")

"""

This method executes the resources of the specified deployment for which 'autoRunOnDeploy' property is enabled. 'autoRunOnDeploy' property can be set while creating a block or app spec.
The deployment must be in the 'deployed' state for this method to work.

It returns the response in the following format:

{
  "executeResponse": [
    {
      "blockSpecId": "0bddb4c6-40c5-45c3-b477-fceb2c051609",
      "version": "1.0.0",
      "executionId": "a3e77006-86f3-4829-8c43-f21ad462dbbd",
      "status": "executed"
    }
  ]
}

"""