Removing files

This is an optional notebook in the census sample series. Run any cell if you want to remove the files or models that were made in previous notebooks. This assumes you did not change the default locations or names.

Removing files from the local file system


In [ ]:
workspace_path = '/content/datalab/workspace/census'
!rm -fr {workspace_path}

Removing files from cloud storage

This removes the files in the 'census' folder in the bucket that was used. It does not delete the bucket that was used. To also remove the bucket, make sure it is empty and run !gsutil rb gs://BUCKET-NAME


In [ ]:
import google.datalab as datalab
import os
storage_bucket = 'gs://' + datalab.Context.default().project_id + '-datalab-workspace/'
workspace_path = os.path.join(storage_bucket, 'census')
!gsutil -m rm -rf {workspace_path}

Removing the deployed model


In [ ]:
model_name = 'census'
model_version = 'v1'

!gcloud ml-engine versions delete {model_version} --model {model_name}
!gcloud ml-engine models delete {model_name}

In [ ]: