Path: blob/main/L4assets/DSandMLOpsAssets/CLIandSDK/Notebooks/CPDall-03b Project Management.ipynb
1928 views
Project management
This notebook can run on the platform of your choice.
The functionality demonstrated are:
Create a project
Import a file into the project
Removing the new project
Importing a project
Exporting a project
Make sure to set the variables in the next cell
For Cloud Pak for data (CPD):
Set the
cpd_urlvalue to the endpoint for your CPD clusterSet the
API_keyto the API key for your user
For Cloud Pak for Data as a Service (CPDaaS):
set
cpd_urltohttps://api.dataplatform.cloud.ibm.com/Set the
API_keyto the API key for your user
Get an access token
We have a chicken and egg problem here: we need the support functions to get the token but we need the token to use the support function. To solve the problem, we define the support function we need before we loadd all the support functions.
An access token is used to identify a user in API requests. Note that the token becomes invalid after an hour and must be re-created.
Create a bearer (access) token
Support functions
On CPSaaS, get the details of the API key
Execute the next cell even if you are on CPD
List available projects
Get the current project
This makes it easier to get all the arguments needed for the creation of a new project.
Create a project
This notebook used API calls to create a project. It is also possible to create projects using the cpdctl command.
This notebook used cpdctl later to import and export projects.
We generate a random project name
Load a file into the new project
Use the ibm_watson_studio_lib python library to load a data file into the project
Write a CSV file from github to the project
At the completion of the file loading, notice there were three steps taken:
created file
created data asset
created attachment
List the project assets
There should only be one data asset called datafile.csv
You can use a separate tab to open the project and look at the content of the file if you want to be sure the content is all there.
Delete the new project
Import a project
Installing cpdctl
The latest release is currently 1.4.0. See: cpdctl releases
Get the project zipfile
We can get the information on the project name
Create an empty project
A project is imported into an empty project
Import the project
The zip file is available in the working directory since ti was loader earlier.
List assets from the new project
Export a project
Delete the imported project
Author
Jacques Roy is a member of the IBM Enablement for Data and AI
Copyright © 2023. This notebook and its source code are released under the terms of the MIT License.