WANNA Profile#
We make it easy to deploy your resources to multiple environments (e.g., dev/test/prod) with a simple change in CLI flag or with environment variable change.
WANNA Profile is a set of parameters that will cascade down to every instance you want to create unless you overwrite them at the instance level.
Loading WANNA Profiles#
There are two possible ways to load your profile.
- Include the
wanna_profiles
section in your main WANNA yaml config with an array of profiles - Include the
wanna_profiles
section in separateprofiles.yaml
saved wherever on your machine and set env variableWANNA_GCP_PROFILE_PATH=/path/to/your/profiles.yaml
Selecting WANNA Profile#
Now that the CLI knows about your profiles, you need to select the one you want to use.
By default, the profile with the name default
is used. You can change that with
either WANNA_GCP_PROFILE_NAME=my-profile-name
or --profile=my-profile-name
.
When the selected WANNA Profile is not found, we throw an error.
WANNA Profile parameters#
wanna.core.models.gcp_profile.GCPProfileModel
(*, profile_name, project_id, zone=None, region, labels=None, bucket, service_account=None, network=None, subnet=None, kms_key=None, docker_repository='wanna', docker_registry=None, env_vars=None)wanna_profile
section of the yaml config consists of the following inputs:
profile_name
- [str] name of the WANNA GCP Profile,default
will be used if not specified otherwise. You could use also for exampledev
,prod
, or any other string.project_id
- [str] GCP project id.zone
- [str] (optional) GCP location zone.region
- [str] (optional) GCP location region. If the zone is set and the region not, we automatically parse the region from the zone (e.g., zoneus-east1-c
automatically sets regionus-east1
if the region is not supplied by the user).labels
- [Dict[str, str]] (optional) GCP resource labels that will be added to all resources you create with this profile. By default, we also add a few labels based onwanna_project
section.bucket
- [str] (optional) GCS Bucket that can later be used in uploading manifests, storing logs, etc. depending on the resource type.service_account
- [str] (optional) GCP service account that will be used by the created resources. If not specified, usually the default service account for each resource type is used.network
- [str] Google Cloud VPC network namesubnet
- [str] (optional) Google Cloud VPC subnetwork namekms_key
- [str] (optional) Customer managed enryption key given in format projects/{project_id}/locations/{region}/keyRings/{key_ring_id}/cryptoKeys/{key_id} If you get an error, please grant the Service Account with the Cloud KMS CryptoKey Encrypter/Decrypter roledocker_repository
- [str] Wanna Docker Repositorydocker_registry
- [str] (optional) Wanna Docker Registry, usually in format {region}-docker.pkg.devenv_vars
- Dict[str, str] (optional) Environment variables to be propagated to all the notebooks and custom jobs
Example use case#
gcp_profiles:
- profile_name: default
project_id: gcp-test-project
zone: europe-west1-b
bucket: wanna-ml-test
labels:
- env: test
- profile_name: prod
project_id: gcp-prod-project
zone: europe-west4-a
bucket: wanna-ml-prod
labels:
- env: prod
Now the command wanna ...
will use the information from the default
profile and deploy to
europe-west1-b
.
When you are ready with your testing, you can call wanna ... --profile=prod
to deploy
to the production GCP project and zone europe-west4-a
.