Path: blob/master/cpd4.8/notebooks/python_sdk/instance-management/Space management.ipynb
6405 views
Space management
This notebook contains steps and code to demonstrate how to manage spaces in context of Watson Machine Learning service. It facilitates ibm-watson-machine-learning library available in PyPI repository. It introduces commands for creating, updating & deleting spaces, getting list and detailed information about them.
Some familiarity with Python is helpful. This notebook uses Python 3.10.
Learning goals
The learning goals of this notebook are:
Create new space
List existing spaces
Get spaces details
Set default space
Update exisitng space
Delete space
Contents
This notebook contains the following parts:
Connection to WML
Authenticate the Watson Machine Learning service on IBM Cloud Pack for Data. You need to provide platform url
, your username
and api_key
.
Alternatively you can use username
and password
to authenticate WML services.
Install and import the ibm-watson-machine-learning
package
Note: ibm-watson-machine-learning
documentation can be found here.
2. Create new space
First of all, you need to create a space that will be used for your work. If you do not have space already created, you can use {PLATFORM_URL}/ml-runtime/spaces?context=icp4data
to create one.
Click New Deployment Space
Create an empty space
Go to space
Settings
tabCopy
space_id
and paste it below
Tip: You can also use SDK to prepare the space for your work. More information can be found here.
Action: Assign space ID below
Next you can create space by following cell execution.
You can get space it by executing following cell.
Tip In order to check if the space creation is completed succesfully change next cell format to code and execute it. It should return 'active'.
Action: If you didn't create new space in this notebook by ibm_watson_machine_learning
, please assign space ID below and change cell format to code
.
You can use list
method to print all existing spaces.
You can use get_details
method to print details about given space. You need to provide space_id
of desired space.
To be able to interact with all resources available in Watson Machine Learning, you need to set space which you will be using.
You can update your space by reassigning space metadata and executing: client.spaces.update(space_id, space_metadata)
.
You can use the command below to delete existing space. You need to provide space_id of the space you want to delete.
You successfully completed this notebook! You learned how to use ibm-watson-machine-learning client for Watson Machine Learning instance space management and clean up.
Check out our Online Documentation for more samples, tutorials, documentation, how-tos, and blog posts.
Authors
Szymon Kucharczyk, Software Engineer at IBM.
Daniel Ryszka, Software Engineer at IBM.
Copyright © 2020-2025 IBM. This notebook and its source code are released under the terms of the MIT License.