Deploy project release assets with CLI
You can deploy jobs and web services in Watson Studio Local by using CLI.
Deploy assets
To deploy an asset, run the following command:
wscli add deploymentThis command expects the following
mandatory options: -ast --asset-type <assetType>
The asset type for the job
Valid values:
script
Indicates that the asset type is script in a project release
-afp --asset-file-path <assetFilePath>
The asset file path relevant to the project root folder, e.g.: "/scripts/Testscript.py"
-re --runtime-environment <runtimeEnvironment>
The runtime environment is specified by the name of the the image being used. This may be
the name of a custom image or "dsx-scripted-ml-python2" for the included environment
"Jupyter with Python 2.7, Scala 2.11,R 3.4.3", and "dsx-scripted-ml-python3" for the
included environment "Jupyter with Python 3.5, Scala 2.11,R 3.4.3"
The only value that is allowed for the --asset-type option is:
script.
--asset-file-path
option, run the following
command:wscli list assets -pr projectrelease-nameThe asset file path is displayed in the Path column. Watson Studio Local CLI currently supports creating deployments by using script types.

The value of --runtime-environment option for the job and web service are
different.
Runtime environment of a job
The runtime environment of a job is called a "worker," which specifies the image that is being used and resource reservations.
To find a valid value for --runtime-environment option for a job, check the
Workers page of this project release.
For custom images, the name in the list can be used as the value for the runtime environment. For the IBM-provided images, you need to specify the internal name for that image instead of the display name. The following table maps the display name to the internal name:
| IBM provided image name | Internal name |
|---|---|
| Jupyter with Python 2.7, Scala 2.11, R 3.4.3 | dsx-scripted-ml-python2 |
| Jupyter with Python 3.5, Scala 2.11, R 3.4.3 | dsx-scripted-ml-python3 |
| Jupyter 4.4 and Python 3.5 for GPU | dsx-scripted-ml-gpu-python3 |
| RStudio with R 3.4.3 | rstudio-worker |
| SPSS Modeler | spss-worker |

Runtime environment of a web service
The runtime environment of a web service is an environment that is provided by either IBM or a custom image.
To find a valid value for --runtime-environment option for deploying a web
service, go to the Asset page of this project release, and add a web service. Find the value in the
drop-down list for Web service environment.
For custom images, the name in the list can be used as the value for the runtime environment. For the IBM-provided images, you need to specify the internal name for that image instead of the display name. The following table maps the display name to the internal name:
| IBM-provided image name | Internal name |
|---|---|
| Python 2.7 - Script as a Service | python35-script-as-a-service |
| Python 3.5 - Script as a Service | python27-script-as-a-service |
| R 3.4.3 - Script as a Service | r-script-as-a-service |

Optional parameters
Deploy a job
-cla --command-line-arguments <cmdLineArgs>
The command line arguments list for the job, separated by commas.
e.g.: "arg1,arg2" with no spaces in between
-dt --deployment-type <deploymentType>
The type of the deployment in a project release
Valid values:
job
The deployment type is Job
web-service
The deployment type is Web Service
-ev --environment-variables <envVars>
The environment variables list, separated by commas.
e.g.: "VAR1=value1,VAR2=value2" with no spaces in between
-sc --schedule-cron <scheduleCron>
It runs a job periodically, on a given schedule, written in Cron format. Please, use "" to
wrap this string. e.g.: "0 * * * *"Specify --deployment-type as job to create a deployment as job.
If this option is not specified, the deployment is created as job type.
Review the following examples:
1. Deploys an asset as a job in a project release
$ wscli add deployment -pr testRelease -dn deploy1 -afp "/scripts/Testscript.py" -re
dsx-scripted-ml-python2 -dt job -ast script
2. Deploys an asset as a job in a project release with environment variable and command line arguments
$ wscli add deployment -pr testRelease -dn deploy2 -afp "/scripts/Testscript.py" -re
dsx-scripted-ml-python2 -dt job -ast script -ev "env1=1,env2=2" -cla "arg1=1,arg2=2"
3. Deploys an asset as a job in a project release with a custom image
$ wscli add deployment -pr testRelease -dn deploy3 -afp "/scripts/Testscript.py" -re
spyker1-spyker1-dsx-scripted-ml-python2 -dt job -ast script -ev "env1=1,env2=2" -cla "arg1=1,arg2=2"
Deploy a web service
-cr --cpu-reservation <cpuReservation>
CPU reservation - The unit is millicpu. If you want to reserve 1.5 cpu core, the number
will be 1.5 * 1000 = 1500 e.g. -cr 1500. Specify -1 for no reservation
-dt --deployment-type <deploymentType>
The type of the deployment in a project release
Valid values:
job
The deployment type is Job
web-service
The deployment type is Web Service
-ev --environment-variables <envVars>
The environment variables list, separated by commas.
e.g.: "VAR1=value1,VAR2=value2" with no spaces in between
-mr --memory-reservation <memoryReservation>
Memory reservation - The unit is in MB e.g. -mr 1500 is 1500 MB of memory. Specify -1 for
no reservation
-rc --replica-count <replicaCount>
The number of replicas for a deployment. Value should larger or equal than 1Specify --deployment-type as web-service to create a deployment
as web service. If this option is not specified, the deployment is created as job type.
Review the following examples:
1. Deploys an asset as a webservice in a project release. Note that the environment used for
web-service is different from the environment used for jobs
$ wscli add deployment -pr testRelease -dn deploy2 -afp "/scripts/Testscript.py" -re
python27-script-as-a-service -dt web-service -ast script
2. Deploys an asset as a webservice in a project release with resource reservations, environment
variables, and replica counts
$ wscli add deployment -pr testRelease -dn deploy3 -afp "/scripts/Testscript.py" -re
python27-script-as-a-service -dt web-service -ast script -ev "env1=1,env2=2" -cr 1000 -mr
1000 -rc 2
3. Deploys an asset as a webservice in a project release with a custom image
$ wscli add deployment -pr testRelease -dn deploy4 -afp "/scripts/Testscript.py" -re
image1-v1-pyton35-script-as-a-service -dt web-service -ast script