google_cloud_automlops/utils/constants.py (95 lines of code) (raw):

# Copyright 2024 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Sets global constants.""" # pylint: disable=C0103 # pylint: disable=line-too-long # Apache license GENERATED_LICENSE = ( '# Licensed under the Apache License, Version 2.0 (the "License");\n' '# you may not use this file except in compliance with the License.\n' '# You may obtain a copy of the License at\n' '#\n' '# http://www.apache.org/licenses/LICENSE-2.0\n' '#\n' '# Unless required by applicable law or agreed to in writing, software\n' '# distributed under the License is distributed on an "AS IS" BASIS,\n' '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' '# See the License for the specific language governing permissions and\n' '# limitations under the License.\n' '#\n' '# DISCLAIMER: This code is generated as part of the AutoMLOps output.\n' ) ## Default values # Default docker base image DEFAULT_BASE_IMAGE = 'python:3.9-slim' # Default location of resources DEFAULT_RESOURCE_LOCATION = 'us-central1' # Default naming prefix for resources DEFAULT_NAMING_PREFIX = 'automlops-default-prefix' # Default cloud scheduler job cron pattern DEFAULT_SCHEDULE_PATTERN = 'No Schedule Specified' # Default source repository branch DEFAULT_SOURCE_REPO_BRANCH = 'automlops' # Default vpc connector name DEFAULT_VPC_CONNECTOR = 'No VPC Specified' # Header for the config/defaults.yaml DEFAULTS_HEADER = ( GENERATED_LICENSE + '# These values are descriptive only - do not change.\n' '# Rerun AutoMLOps.generate() to change these values.\n') # Recommended software versions MIN_GCLOUD_BETA_VERSION = '2022.10.21' MIN_GCLOUD_SDK_VERSION = '420.0.0' MIN_RECOMMENDED_TERRAFORM_VERSION = '1.5.6' # AutoMLOps file paths BASE_DIR = 'AutoMLOps/' GENERATED_DEFAULTS_FILE = BASE_DIR + 'configs/defaults.yaml' GENERATED_PIPELINE_SPEC_SH_FILE = BASE_DIR + 'scripts/build_pipeline_spec.sh' GENERATED_BUILD_COMPONENTS_SH_FILE = BASE_DIR + 'scripts/build_components.sh' GENERATED_RUN_PIPELINE_SH_FILE = BASE_DIR + 'scripts/run_pipeline.sh' GENERATED_RUN_ALL_SH_FILE = BASE_DIR + 'scripts/run_all.sh' GENERATED_RESOURCES_SH_FILE = BASE_DIR + 'provision/provision_resources.sh' GENERATED_MODEL_MONITORING_SH_FILE = BASE_DIR + 'scripts/create_model_monitoring_job.sh' GENERATED_MODEL_MONITORING_MONITOR_PY_FILE = BASE_DIR + 'model_monitoring/monitor.py' GENERATED_MODEL_MONITORING_REQUIREMENTS_FILE = BASE_DIR + 'model_monitoring/requirements.txt' GENERATED_PUBLISH_TO_TOPIC_FILE = BASE_DIR + 'scripts/publish_to_topic.sh' GENERATED_CLOUDBUILD_FILE = BASE_DIR + 'cloudbuild.yaml' GENERATED_GITHUB_ACTIONS_FILE = BASE_DIR + '.github/workflows/github_actions.yaml' GENERATED_PIPELINE_REQUIREMENTS_FILE = BASE_DIR + 'pipelines/requirements.txt' GENERATED_PIPELINE_FILE = BASE_DIR + 'pipelines/pipeline.py' GENERATED_PIPELINE_RUNNER_FILE = BASE_DIR + 'pipelines/pipeline_runner.py' GENERATED_COMPONENT_BASE = BASE_DIR + 'components/component_base' GENERATED_COMPONENT_BASE_SRC = BASE_DIR + 'components/component_base/src' COMPONENT_BASE_RELATIVE_PATH = 'components/component_base' GENERATED_PARAMETER_VALUES_PATH = 'pipelines/runtime_parameters/pipeline_parameter_values.json' GENERATED_PIPELINE_JOB_SPEC_PATH = 'scripts/pipeline_spec/pipeline_job.yaml' GENERATED_DIRS = [ BASE_DIR, BASE_DIR + 'components', BASE_DIR + 'components/component_base', BASE_DIR + 'components/component_base/src', BASE_DIR + 'configs', BASE_DIR + 'images', BASE_DIR + 'pipelines', BASE_DIR + 'pipelines/runtime_parameters', BASE_DIR + 'scripts', BASE_DIR + 'scripts/pipeline_spec', BASE_DIR + 'provision' ] GENERATED_SERVICES_DIRS = [ BASE_DIR + 'services', BASE_DIR + 'services/submission_service' ] GENERATED_TERRAFORM_DIRS = [ BASE_DIR + 'provision/state_bucket', BASE_DIR + 'provision/environment' ] GENERATED_GITHUB_DIRS = [ BASE_DIR + '.github', BASE_DIR + '.github/workflows' ] GENERATED_MODEL_MONITORING_DIRS = [ BASE_DIR + 'model_monitoring', ] # Generated kfp pipeline metadata name DEFAULT_PIPELINE_NAME = 'automlops-pipeline' # KFP v2 Migration constant PINNED_KFP_VERSION = 'kfp>=2.0.0' # Provisioning Template Paths TERRAFORM_TEMPLATES_PATH = 'google_cloud_automlops.provisioning.templates.terraform' PULUMI_TEMPLATES_PATH = 'google_cloud_automlops.provisioning.templates.pulumi' GCLOUD_TEMPLATES_PATH = 'google_cloud_automlops.provisioning.templates.gcloud' KFP_TEMPLATES_PATH = 'google_cloud_automlops.orchestration.templates.kfp' CLOUDBUILD_TEMPLATES_PATH = 'google_cloud_automlops.deployments.templates.cloudbuild' GITHUB_ACTIONS_TEMPLATES_PATH = 'google_cloud_automlops.deployments.templates.github_actions' GITOPS_TEMPLATES_PATH = 'google_cloud_automlops.utils.templates' # Required IAM Roles for pipeline runner service account IAM_ROLES_RUNNER_SA = [ 'roles/aiplatform.user', 'roles/artifactregistry.reader', 'roles/cloudfunctions.admin', 'roles/bigquery.user', 'roles/bigquery.dataEditor', 'roles/iam.serviceAccountUser', 'roles/storage.admin' ]