ml deployment create

Create a deployment. The parameters that specify the deployment type are online, r_shiny, and batch. The parameters are mutually exclusive (specify only one parameter when you create a deployment).

Syntax

cpd-cli ml deployment create \
[--asset=<resource-reference>] \
[--async] \
[--batch=<empty-object>] \
[--context=<catalog-project-or-space-id>] \
[--cpd-config=<cpd-config-location>] \
[--cpd-scope=<cpd-scope>] \
[--custom=<map<key,value>>] \
[--description=<deployment-description>] \
[--hardware-spec=<hardware-specification>] \
[--hybrid-pipeline-hardware-specs=<hybrid-pipeline-hardware-specification>] \
[--jmes-query=<jmespath-query>] \
[--name=<deployment-name>] \
[--online=<empty-object>] \
[--output=json|yaml|table] \
[--output-file=<output-file-location>] \
--profile=<cpd-profile-name> \
[--quiet] \
[--r-shiny] \
[--raw-output=true|false] \
--space-id=<space-identifier> \
[--tags=<tag1,tag2,...>] \
[--verbose]

Arguments

The ml deployment create command has no arguments.

Options

Table 1: Command options
Option Description
--asset Specify a resource reference.
Status
Optional.
Syntax
--asset=<resource-reference>
Default value
No default.
Valid values
A valid resource reference.
--async Run the command asynchronously. By default, processing finishes before the command runs.
Status
Optional.
Syntax
--async
Default value
Not applicable.
Valid values
Not
 applicable.
--batch Specify an empty object. The option indicates a batch deployment. More properties can be added later when setting up the batch deployment.
Status
Optional.
Syntax
--batch=<empty-object>
Default value
No default.
Valid values
An empty object.
--context Specify the configuration context
 name.
Status
Optional.
Syntax
--context=<catalog-project-or-space-id>
Default value
Not applicable.
Valid values
A valid configuration context name.
--cpd-config The IBM Software Hub
 configuration location. For example, $HOME/.cpd-cli/config.
Status
Optional.
Syntax
--cpd-config=<cpd-config-location>
Default value
$HOME/.cpd-cli/config
Valid values
A valid IBM® Software Hub configuration location.
--cpd-scope The IBM Software Hub space, project, or catalog scope. For example, cpd://default-context/spaces/7bccdda4-9752-4f37-868e-891de6c48135.
Status
Optional.
Syntax
--cpd-scope=<cpd-scope>
Default value
No default.
Valid values
A valid IBM Software Hub space, project, or catalog scope.
--custom Specify user-defined properties as key-value pairs.
Status
Optional.
Syntax
--custom=<map<key,value>>
Default value
No default.
Valid values
Valid key-value pairs.
--description Specify a deployment
 description.
Status
Optional.
Syntax
--description=<deployment-description>
Default value
No default.
Valid values
A valid deployment description.
--hardware-spec Specify a hardware specification.
Status
Optional.
Syntax
--hardware-spec=<hardware-specification>
Default value
No default.
Valid values
A valid hardware specification.

--help

-h

Display command help.
Status
Optional.
Syntax
--help
Default value
No default.
Valid values
Not applicable.
--hybrid-pipeline-hardware-specs Specify a hybrid pipeline hardware specification.
Status
Optional.
Syntax
--hybrid-pipeline-hardware-specs=<hybrid-pipeline-hardware-specification>
Default value
No default.
Valid values
A valid hybrid pipeline hardware specification.
--jmes-query Provide a JMESPath query to customize the output.
Status
Optional.
Syntax
--jmes-query=<jmespath-query>
Default value
No default.
Valid values
A valid JMESPath query.
--name Specify a deployment name.
Status
Optional.
Syntax
--name=<deployment-name>
Default value
No default.
Valid values
A valid deployment name.
--online Specify an empty object. The option indicates an online deployment. More properties can be added later during online deployment setup. The 'serving_name' can be provided in the 'online.parameters'. The 'serving_name' can include only the characters [a-z,0-9,_] and the length cannot exceed 36 characters. The 'serving_name' can be used in the prediction URL in place of the 'deployment_id'.
Status
Optional.
Syntax
--online=<empty-object>
Default value
No default.
Valid values
An empty object.
--output Specify an output format.
Status
Optional.
Syntax
--output=json|yaml|text
Default value
text
Valid values
Valid formats include JSON, YAML, or text (the default format).
--output-file Specify a file path where all output is redirected.
Status
Optional.
Syntax
--output-file=<output-file-location>
Default value
No default.
Valid values
A valid output file path location.
--profile The name of the profile that you created to store information about an instance of Cloud Pak for Data and your credentials for the instance.
Status
Required.
Syntax
--profile=<cpd-profile-name>
Default value
No default.
Valid values

The name of the profile that you created.

--quiet Suppress verbose messages.
Status
Optional.
Syntax
--quiet
Default value
No default.
Valid values
Not applicable.
--r-shiny Indicates a Shiny application deployment.
Status
Optional.
Syntax
--r-shiny
Default value
Not applicable.
Valid values
Not applicable.
--raw-output When set to true, single values are not surrounded by quotation marks in
 JSON output mode.
Status
Optional.
Syntax
--raw-output=true|false
Default value
false
Valid values
false
Single values in JSON output mode are surrounded by quotation marks.
true
Single values in JSON output mode are not surrounded by quotation marks.
--space-id Specify a space identifier.
Status
Optional.
Syntax
--space-id=<space-identifier>
Default value
No default.
Valid values
A valid space identifier.
--tags Specify the data asset tags. Multiple tags can be specified.
Status
Optional.
Syntax
--tags=<tag1,tag2,...>
Default value
No default.
Valid values
A valid list of comma-separated data asset tags.
--verbose Logs include more detailed messages.
Status
Optional.
Syntax
--verbose
Default value
No default.
Valid values
Not applicable.

Examples

Note: The following examples use environment variables. Use a script to create environment variables with the correct values for your environment. You can add the listed environment variables to the installation variables script. For more information, see Setting up installation environment variables.
Specify the environment variables, the asset identifier, and the hardware specification in a script file.
Replace the following properties with your data.
asset = {
    'id': promoted_script_id
}
asset_json = json.dumps(asset)

hardware_spec = {
    'name': 'S'
}
hardware_spec_json = json.dumps(hardware_spec)

batch_json = '{}'

deployment_name = 'script_batch_deployment'

space_id = <The space identifier>
Create a batch deployment.
cpd-cli ml deployment create \
--asset=${asset_json} \
--batch=${batch_json} \
--hardware-spec=${hardware_spec_json} \
--name=${deployment_name} \
--output=json \
--raw-output \
--space-id=${space_id}