Project Deployer#

class dataikuapi.dss.projectdeployer.DSSProjectDeployer(client)#

Handle to interact with the Project Deployer.

Important

Do not instantiate directly, use dataikuapi.DSSClient.get_projectdeployer()

list_deployments(as_objects=True)#

List deployments on the Project Deployer.

Usage example:

# list all deployments with their current state
for deployment in deployer.list_deployments():
    status = deployment.get_status()
    print("Deployment %s is %s" % (deployment.id, status.get_health()))
Parameters:

as_objects (boolean) – if True, returns a list of DSSProjectDeployerDeployment, else returns a list of dict.

Returns:

list of deployments, either as DSSProjectDeployerDeployment or as dict (with fields as in DSSProjectDeployerDeploymentStatus.get_light())

Return type:

list

get_deployment(deployment_id)#

Get a handle to interact with a deployment.

Parameters:

deployment_id (string) – identifier of a deployment

Return type:

DSSProjectDeployerDeployment

create_deployment(deployment_id, project_key, infra_id, bundle_id, deployed_project_key=None, project_folder_id=None, ignore_warnings=False)#

Create a deployment and return the handle to interact with it.

The returned deployment is not yet started and you need to call start_update()

Usage example:

# create and deploy a bundle
project = 'my-project'
infra = 'my-infra'
bundle = 'my-bundle'
deployment_id = '%s-%s-on-%s' % (project, bundle, infra)
deployment = deployer.create_deployment(deployment_id, project, infra, bundle)
update = deployment.start_update()
update.wait_for_result()
Parameters:
  • deployment_id (string) – identifier of the deployment to create

  • project_key (string) – key of the published project

  • bundle_id (string) – identifier of the bundle to deploy

  • infra_id (string) – identifier of the infrastructure to use

  • deployed_project_key (string) – The project key to use when deploying this project to the automation node. If not set, the project will be created with the same project key as the published project

  • project_folder_id (string) – The automation node project folder id to deploy this project into. If not set, the project will be created in the root folder

  • ignore_warnings (boolean) – ignore warnings concerning the governance status of the bundle to deploy

Returns:

a new deployment

Return type:

DSSProjectDeployerDeployment

list_stages()#

List the possible stages for infrastructures.

Returns:

list of stages. Each stage is returned as a dict with fields:

  • id : identifier of the stage

  • desc : description of the stage

Return type:

list[dict]

list_infras(as_objects=True)#

List the infrastructures on the Project Deployer.

Usage example:

# list infrastructures that the user can deploy to
for infrastructure in deployer.list_infras(as_objects=False):
    if infrastructure.get("canDeploy", False):
        print("User can deploy to %s" % infrastructure["infraBasicInfo"]["id"])
Parameters:

as_objects (boolean) – if True, returns a list of DSSProjectDeployerInfra, else returns a list of dict.

Returns:

list of infrastructures, either as DSSProjectDeployerInfra or as dict (with fields as in DSSProjectDeployerInfraStatus.get_raw())

Return type:

list

create_infra(infra_id, stage, govern_check_policy='NO_CHECK')#

Create a new infrastructure and returns the handle to interact with it.

Parameters:
  • infra_id (string) – unique identifier of the infrastructure to create

  • stage (string) – stage of the infrastructure to create

  • govern_check_policy (string) – what actions with Govern the the deployer will take whe bundles are deployed on this infrastructure. Possible values: PREVENT, WARN, or NO_CHECK

Returns:

a new infrastructure

Return type:

DSSProjectDeployerInfra

get_infra(infra_id)#

Get a handle to interact with an infrastructure.

Parameters:

infra_id (string) – identifier of the infrastructure to get

Return type:

DSSProjectDeployerInfra

list_projects(as_objects=True)#

List published projects on the Project Deployer.

Usage example:

# list project that the user can deploy bundles from
for project in deployer.list_projects(as_objects=False):
    if project.get("canDeploy", False):
        print("User can deploy to %s" % project["projectBasicInfo"]["id"])
Parameters:

as_objects (boolean) – if True, returns a list of DSSProjectDeployerProject, else returns a list of dict.

Returns:

list of published projects, either as DSSProjectDeployerProject or as dict (with fields as in DSSProjectDeployerProjectStatus.get_raw())

Return type:

list

create_project(project_key)#

Create a new published project on the Project Deployer and return the handle to interact with it.

Parameters:

project_key (string) – key of the project to create

Return type:

DSSProjectDeployerProject

get_project(project_key)#

Get a handle to interact with a published project.

Parameters:

project_key (string) – key of the project to get

Return type:

DSSProjectDeployerProject

upload_bundle(fp, project_key=None)#

Upload a bundle archive for a project.

Parameters:
  • fp (file-like) – a bundle archive (should be a zip)

  • project_key (string) – key of the published project where the bundle will be uploaded. If the project does not exist, it is created. If not set, the key of the bundle’s source project is used.

Infrastructures#

class dataikuapi.dss.projectdeployer.DSSProjectDeployerInfra(client, infra_id)#

An Automation infrastructure on the Project Deployer.

Important

Do not instantiate directly, use DSSProjectDeployer.get_infra().

property id#

Get the unique identifier of the infrastructure.

Return type:

string

get_status()#

Get status information about this infrastructure.

Returns:

the current status

Return type:

DSSProjectDeployerInfraStatus

get_settings()#

Get the settings of this infrastructure.

Return type:

DSSProjectDeployerInfraSettings

delete()#

Delete this infra.

Note

You may only delete an infra if there are no deployments using it.

class dataikuapi.dss.projectdeployer.DSSProjectDeployerInfraSettings(client, infra_id, settings)#

The settings of an Automation infrastructure.

Important

Do not instantiate directly, use DSSProjectDeployerInfra.get_settings()

To modify the settings, modify them in the dict returned by get_raw() then call save().

get_raw()#

Get the raw settings of this infrastructure.

This returns a reference to the raw settings, not a copy, so changes made to the returned object will be reflected when saving.

Returns:

the settings, as a dict.

Return type:

dict

save()#

Save back these settings to the infrastracture.

class dataikuapi.dss.projectdeployer.DSSProjectDeployerInfraStatus(client, infra_id, light_status)#

The status of an Automation infrastructure.

Important

Do not instantiage directly, use DSSProjectDeployerInfra.get_status()

get_deployments()#

Get the deployments that are deployed on this infrastructure.

Returns:

a list of deployments

Return type:

list of DSSProjectDeployerDeployment

get_raw()#

Get the raw status information.

Returns:

the status, as a dict. The dict contains a list of the bundles currently deployed on the infrastructure as a deployments field.

Return type:

dict

Published projects#

class dataikuapi.dss.projectdeployer.DSSProjectDeployerProject(client, project_key)#

A published project on the Project Deployer.

Important

Do not instantiate directly, use DSSProjectDeployer.get_project()

property id#

Get the key of the published project.

Return type:

string

get_status()#

Get status information about this published project.

This is used mostly to get information about which versions are available and which deployments are exposing this project

Return type:

DSSProjectDeployerProjectStatus

get_settings()#

Get the settings of this published project.

The main things that can be modified in a project settings are permissions

Return type:

DSSProjectDeployerProjectSettings

delete_bundle(bundle_id)#

Delete a bundle from this published project.

Parameters:

bundle_id (string) – identifier of the bundle to delete

delete()#

Delete this published project.

Note

You may only delete a published project if there are no deployments using it.

class dataikuapi.dss.projectdeployer.DSSProjectDeployerProjectSettings(client, project_key, settings)#

The settings of a published project.

Important

Do not instantiate directly, use DSSProjectDeployerProject.get_settings()

To modify the settings, modify them in the dict returned by get_raw() then call save().

get_raw()#

Get the raw settings of this published project.

This returns a reference to the raw settings, not a copy, so changes made to the returned object will be reflected when saving.

Returns:

the settings, as a dict.

Return type:

dict

save()#

Save back these settings to the published project.

class dataikuapi.dss.projectdeployer.DSSProjectDeployerProjectStatus(client, project_key, light_status)#

The status of a published project.

Important

Do not instantiate directly, use DSSProjectDeployerProject.get_status()

get_deployments(infra_id=None)#

Get the deployments that have been created from this published project.

Parameters:

infra_id (string) – (optional) identifier of an infrastructure. When set, only get the deployments deployed on this infrastructure. When not set, the list contains all the deployments using this published project, across every infrastructure of the Project Deployer.

Returns:

a list of deployments, each a DSSProjectDeployerDeployment

Return type:

list

get_bundles()#

Get the bundles that have been published on this project.

Each bundle is a dict that contains at least a “id” field, which is the version identifier

Returns:

a list of bundles, each one a dict. Each bundle has an id field holding its identifier.

Return type:

list[dict]

get_infras()#

Get the infrastructures that deployments of this project use.

Returns:

list of summaries of infrastructures, each a dict.

Return type:

list[dict]

get_raw()#

Gets the raw status information.

Returns:

the status, as a dict. A deployments sub-field contains a list of the deployments of bundles of this projects.

Return type:

dict

Deployments#

class dataikuapi.dss.projectdeployer.DSSProjectDeployerDeployment(client, deployment_id)#

A deployment on the Project Deployer.

Important

Do not instantiate directly, use DSSProjectDeployer.get_deployment()

property id#

Get the identifier of the deployment.

Return type:

string

get_status()#

Get status information about this deployment.

Return type:

dataikuapi.dss.apideployer.DSSProjectDeployerDeploymentStatus

get_governance_status(bundle_id='')#

Get the governance status about this deployment.

The infrastructure on which this deployment is running needs to have a Govern check policy of PREVENT or WARN.

Parameters:

bundle_id (string) – (Optional) The ID of a specific bundle of the published project to get status from. If empty, the bundle currently used in the deployment.

Returns:

messages about the governance status, as a dict with a messages field, itself a list of meassage information, each one a dict of:

  • severity : severity of the error in the message. Possible values are SUCCESS, INFO, WARNING, ERROR

  • isFatal : for ERROR severity, whether the error is considered fatal to the operation

  • code : a string with a well-known code documented in DSS doc

  • title : short message

  • message : the error message

  • details : a more detailed error description

Return type:

dict

get_settings()#

Get the settings of this deployment.

Return type:

DSSProjectDeployerDeploymentSettings

start_update()#

Start an asynchronous update of this deployment.

After the update, the deployment should be matching the actual state to the current settings.

Returns:

a handle on the update operation

Return type:

dataikuapi.dss.future.DSSFuture

delete()#

Deletes this deployment

Note

You may only delete a deployment if it is disabled and has been updated after disabling it.

get_testing_status(bundle_id=None, automation_node_id=None)#

Get the testing status of a project deployment.

Parameters:
  • bundle_id ((optional) string) – filters the scenario runs done on a specific bundle

  • automation_node_id ((optional)) – for multi-node deployments only, you need to specify the automation node id on which you want to retrieve

the testing status

class dataikuapi.dss.projectdeployer.DSSProjectDeployerDeploymentSettings(client, deployment_id, settings)#

The settings of a Project Deployer deployment.

Important

Do not instantiate directly, use DSSProjectDeployerDeployment.get_settings()

To modify the settings, modify them in the dict returned by get_raw(), or change the value of bundle_id(), then call save().

get_raw()#

Get the raw settings of this deployment.

This returns a reference to the raw settings, not a copy, so changes made to the returned object will be reflected when saving.

Returns:

the settings, as a dict. Notable fields are:

  • id : identifier of the deployment

  • infraId : identifier of the infrastructure on which the deployment is done

  • bundleId : identifier of the bundle of the published project being deployed

Return type:

dict

property bundle_id#

Get or set the identifier of the bundle currently used by this deployment.

If setting the value, you need to call save() afterward for the change to be effective.

save(ignore_warnings=False)#

Save back these settings to the deployment.

Parameters:

ignore_warnings (boolean) – whether to ignore warnings concerning the governance status of the bundle to deploy

class dataikuapi.dss.projectdeployer.DSSProjectDeployerDeploymentStatus(client, deployment_id, light_status, heavy_status)#

The status of a deployment on the Project Deployer.

Important

Do not instantiate directly, use DSSProjectDeployerDeployment.get_status()

get_light()#

Get the ‘light’ (summary) status.

This returns a dictionary with various information about the deployment, but not the actual health of the deployment

Returns:

a summary, as a dict, with summary information on the deployment, the project from which the deployed bundle originates, and the infrastructure on which it’s deployed.

Return type:

dict

get_heavy()#

Get the ‘heavy’ (full) status.

This returns various information about the deployment, notably its health.

Returns:

a status, as a dict. The overall status of the deployment is in a health field (possible values: UNKNOWN, ERROR, WARNING, HEALTHY, UNHEALTHY, OUT_OF_SYNC).

Return type:

dict

get_health()#

Get the health of this deployment.

Returns:

possible values are UNKNOWN, ERROR, WARNING, HEALTHY, UNHEALTHY, OUT_OF_SYNC

Return type:

string

get_health_messages()#

Get messages about the health of this deployment

Returns:

a dict with a messages field, which is a list of meassage information, each one a dict of:

  • severity : severity of the error in the message. Possible values are SUCCESS, INFO, WARNING, ERROR

  • isFatal : for ERROR severity, whether the error is considered fatal to the operation

  • code : a string with a well-known code documented in DSS doc

  • title : short message

  • message : the error message

  • details : a more detailed error description

Return type:

dict