Skip to content

Commit 75bd1d9

Browse files
authored
Merge pull request #66 from GoogleCloudPlatform/feature/pipeline_job_location
Feature/pipeline job location
2 parents 047a53d + 6bacb5c commit 75bd1d9

File tree

12 files changed

+60
-67
lines changed

12 files changed

+60
-67
lines changed

AutoMLOps_User_Guide.pdf

99 Bytes
Binary file not shown.

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [1.3.3] - 2024-12-02
5+
6+
### Added
7+
8+
- Added new pipeline parameter `pipeline_job_location` which defaults to `'us-central1'`.
9+
10+
### Changed
11+
12+
### Fixed
13+
14+
- Bug related to "CLOUD_SOURCE_REPOSITORIES" enum value still being used in utils.py
15+
416
## [1.3.2] - 2024-11-21
517

618
### Added

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -226,28 +226,29 @@ Optional parameters (defaults shown):
226226
8. `deployment_framework: str = 'github-actions'`
227227
9. `naming_prefix: str = 'automlops-default-prefix'`
228228
10. `orchestration_framework: str = 'kfp'`
229-
11. `pipeline_job_runner_service_account: str = f'vertex-pipelines@{project_id}.iam.gserviceaccount.com'`
230-
12. `pipeline_job_submission_service_location: str = 'us-central1'`
231-
13. `pipeline_job_submission_service_name: str = f'{naming_prefix}-job-submission-svc'`
232-
14. `pipeline_job_submission_service_type: str = 'cloud-functions'`
233-
15. `project_number: str = None`
234-
16. `provision_credentials_key: str = None`
235-
17. `provisioning_framework: str = 'gcloud'`
236-
18. `pubsub_topic_name: str = f'{naming_prefix}-queueing-svc'`
237-
19. `schedule_location: str = 'us-central1'`
238-
20. `schedule_name: str = f'{naming_prefix}-schedule'`
239-
21. `schedule_pattern: str = 'No Schedule Specified'`
240-
22. `setup_model_monitoring: Optional[bool] = False`
241-
23. `source_repo_branch: str = 'automlops'`
242-
24. `source_repo_name: str = f'{naming_prefix}-repository'`
243-
25. `source_repo_type: str = 'github'`
244-
26. `storage_bucket_location: str = 'us-central1'`
245-
27. `storage_bucket_name: str = f'{project_id}-{naming_prefix}-bucket'`
246-
28. `use_ci: bool = False`
247-
29. `vpc_connector: str = 'No VPC Specified'`
248-
30. `workload_identity_pool: str = None`
249-
31. `workload_identity_provider: str = None`
250-
32. `workload_identity_service_account: str = None`
229+
11. `pipeline_job_location: str = 'us-central1'`
230+
12. `pipeline_job_runner_service_account: str = f'vertex-pipelines@{project_id}.iam.gserviceaccount.com'`
231+
13. `pipeline_job_submission_service_location: str = 'us-central1'`
232+
14. `pipeline_job_submission_service_name: str = f'{naming_prefix}-job-submission-svc'`
233+
15. `pipeline_job_submission_service_type: str = 'cloud-functions'`
234+
16. `project_number: str = None`
235+
17. `provision_credentials_key: str = None`
236+
18. `provisioning_framework: str = 'gcloud'`
237+
19. `pubsub_topic_name: str = f'{naming_prefix}-queueing-svc'`
238+
20. `schedule_location: str = 'us-central1'`
239+
21. `schedule_name: str = f'{naming_prefix}-schedule'`
240+
22. `schedule_pattern: str = 'No Schedule Specified'`
241+
23. `setup_model_monitoring: Optional[bool] = False`
242+
24. `source_repo_branch: str = 'automlops'`
243+
25. `source_repo_name: str = f'{naming_prefix}-repository'`
244+
26. `source_repo_type: str = 'github'`
245+
27. `storage_bucket_location: str = 'us-central1'`
246+
28. `storage_bucket_name: str = f'{project_id}-{naming_prefix}-bucket'`
247+
29. `use_ci: bool = False`
248+
30. `vpc_connector: str = 'No VPC Specified'`
249+
31. `workload_identity_pool: str = None`
250+
32. `workload_identity_provider: str = None`
251+
33. `workload_identity_service_account: str = None`
251252

252253
Parameter Options:
253254
- `artifact_repo_type=`:
@@ -289,6 +290,7 @@ A description of the parameters is below:
289290
- `deployment_framework`: The CI tool to use (e.g. cloud build, github actions, etc.)
290291
- `naming_prefix`: Unique value used to differentiate pipelines and services across AutoMLOps runs.
291292
- `orchestration_framework`: The orchestration framework to use (e.g. kfp, tfx, etc.)
293+
- `pipeline_job_location`: The location to run the Pipeline Job in.
292294
- `pipeline_job_runner_service_account`: Service Account to run PipelineJobs (specify the full string).
293295
- `pipeline_job_submission_service_location`: The location of the cloud submission service.
294296
- `pipeline_job_submission_service_name`: The name of the cloud submission service.

google_cloud_automlops/AutoMLOps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def launchAll(
113113
deployment_framework: Optional[str] = Deployer.GITHUB_ACTIONS.value,
114114
naming_prefix: Optional[str] = DEFAULT_NAMING_PREFIX,
115115
orchestration_framework: Optional[str] = Orchestrator.KFP.value,
116+
pipeline_job_location: Optional[str] = DEFAULT_RESOURCE_LOCATION,
116117
pipeline_job_runner_service_account: Optional[str] = None,
117118
pipeline_job_submission_service_location: Optional[str] = DEFAULT_RESOURCE_LOCATION,
118119
pipeline_job_submission_service_name: Optional[str] = None,
@@ -153,6 +154,7 @@ def launchAll(
153154
deployment_framework: The CI tool to use (e.g. cloud build, github actions, etc.)
154155
naming_prefix: Unique value used to differentiate pipelines and services across AutoMLOps runs.
155156
orchestration_framework: The orchestration framework to use (e.g. kfp, tfx, etc.)
157+
pipeline_job_location: The location to run the Pipeline Job in.
156158
pipeline_job_runner_service_account: Service Account to run PipelineJobs (specify the full string).
157159
pipeline_job_submission_service_location: The location of the cloud submission service.
158160
pipeline_job_submission_service_name: The name of the cloud submission service.
@@ -191,6 +193,7 @@ def launchAll(
191193
deployment_framework=deployment_framework,
192194
naming_prefix=naming_prefix,
193195
orchestration_framework=orchestration_framework,
196+
pipeline_job_location=pipeline_job_location,
194197
pipeline_job_runner_service_account=pipeline_job_runner_service_account,
195198
pipeline_job_submission_service_location=pipeline_job_submission_service_location,
196199
pipeline_job_submission_service_name=pipeline_job_submission_service_name,
@@ -230,6 +233,7 @@ def generate(
230233
deployment_framework: Optional[str] = Deployer.GITHUB_ACTIONS.value,
231234
naming_prefix: Optional[str] = DEFAULT_NAMING_PREFIX,
232235
orchestration_framework: Optional[str] = Orchestrator.KFP.value,
236+
pipeline_job_location: Optional[str] = DEFAULT_RESOURCE_LOCATION,
233237
pipeline_job_runner_service_account: Optional[str] = None,
234238
pipeline_job_submission_service_location: Optional[str] = DEFAULT_RESOURCE_LOCATION,
235239
pipeline_job_submission_service_name: Optional[str] = None,
@@ -333,6 +337,7 @@ def generate(
333337
deployment_framework=deployment_framework,
334338
naming_prefix=naming_prefix,
335339
orchestration_framework=orchestration_framework,
340+
pipeline_job_location=pipeline_job_location,
336341
pipeline_job_runner_service_account=derived_pipeline_job_runner_service_account,
337342
pipeline_job_submission_service_location=pipeline_job_submission_service_location,
338343
pipeline_job_submission_service_name=derived_pipeline_job_submission_service_name,

google_cloud_automlops/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
series of directories to support the creation of Vertex Pipelines.
2424
"""
2525
# pylint: disable=invalid-name
26-
__version__ = '1.3.2'
26+
__version__ = '1.3.3'
2727
__author__ = 'Sean Rastatter'
2828
__credits__ = 'Google'

google_cloud_automlops/orchestration/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def build(self):
327327
# Extract additional attributes from defaults file
328328
defaults = read_yaml_file(GENERATED_DEFAULTS_FILE)
329329
self.pipeline_storage_path = defaults['pipelines']['pipeline_storage_path']
330+
self.pipeline_job_location = defaults['gcp']['pipeline_job_location']
330331
self.pipeline_job_runner_service_account = defaults['gcp']['pipeline_job_runner_service_account']
331332
self.pipeline_job_submission_service_type = defaults['gcp']['pipeline_job_submission_service_type']
332333
self.project_id = defaults['gcp']['project_id']

google_cloud_automlops/orchestration/kfp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ def _build_submission_services(self):
492492
template_path=import_files(KFP_TEMPLATES_PATH + '.services.submission_service') / 'main.py.j2',
493493
generated_license=GENERATED_LICENSE,
494494
pipeline_root=self.pipeline_storage_path,
495+
pipeline_job_location=self.pipeline_job_location,
495496
pipeline_job_runner_service_account=self.pipeline_job_runner_service_account,
496497
pipeline_job_submission_service_type=self.pipeline_job_submission_service_type,
497498
project_id=self.project_id,

google_cloud_automlops/orchestration/templates/kfp/pipelines/pipeline_runner.py.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ logger.setLevel(log_level)
1616
def run_pipeline(
1717
project_id: str,
1818
pipeline_root: str,
19+
pipeline_job_location: str,
1920
pipeline_job_runner_service_account: str,
2021
parameter_values_path: str,
2122
pipeline_spec_path: str,
@@ -26,6 +27,7 @@ def run_pipeline(
2627
Args:
2728
project_id: The project_id.
2829
pipeline_root: GCS location of the pipeline runs metadata.
30+
pipeline_job_location: The location to run the Pipeline Job in.
2931
pipeline_job_runner_service_account: Service Account to runner PipelineJobs.
3032
parameter_values_path: Location of parameter values JSON.
3133
pipeline_spec_path: Location of the pipeline spec JSON.
@@ -54,6 +56,7 @@ def run_pipeline(
5456
aiplatform.init(project=project_id)
5557
job = aiplatform.PipelineJob(
5658
display_name = display_name,
59+
location = pipeline_job_location,
5760
template_path = pipeline_spec_path,
5861
pipeline_root = pipeline_root,
5962
parameter_values = pipeline_params,
@@ -76,6 +79,7 @@ if __name__ == '__main__':
7679
run_pipeline(
7780
project_id=config['gcp']['project_id'],
7881
pipeline_root=config['pipelines']['pipeline_storage_path'],
82+
pipeline_job_location=config['gcp']['pipeline_job_location'],
7983
pipeline_job_runner_service_account=config['gcp']['pipeline_job_runner_service_account'],
8084
parameter_values_path=config['pipelines']['parameter_values_path'],
8185
pipeline_spec_path=config['pipelines']['pipeline_job_spec_path'])

google_cloud_automlops/orchestration/templates/kfp/services/submission_service/main.py.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import google.cloud.logging
1515
NAMING_PREFIX = '{{naming_prefix}}'{% endif %}
1616
PROJECT_ID = '{{project_id}}'
1717
PIPELINE_ROOT = '{{pipeline_root}}'
18+
PIPELINE_JOB_LOCATION = '{{pipeline_job_location}}'
1819
PIPELINE_JOB_RUNNER_SERVICE_ACCOUNT = '{{pipeline_job_runner_service_account}}'
1920

2021
{% if pipeline_job_submission_service_type == 'cloud-run' %}app = flask.Flask(__name__){% endif %}
@@ -87,6 +88,7 @@ def process_request({% if pipeline_job_submission_service_type == 'cloud-functio
8788
dashboard_uri, resource_name = submit_pipeline(
8889
project_id=PROJECT_ID,
8990
pipeline_root=PIPELINE_ROOT,
91+
pipeline_job_location=PIPELINE_JOB_LOCATION,
9092
pipeline_job_runner_service_account=PIPELINE_JOB_RUNNER_SERVICE_ACCOUNT,
9193
pipeline_params=data_payload,
9294
pipeline_spec_path=gs_pipeline_spec_path,
@@ -104,6 +106,7 @@ def process_request({% if pipeline_job_submission_service_type == 'cloud-functio
104106
def submit_pipeline(
105107
project_id: str,
106108
pipeline_root: str,
109+
pipeline_job_location: str,
107110
pipeline_job_runner_service_account: str,
108111
pipeline_params: dict,
109112
pipeline_spec_path: str,
@@ -116,6 +119,7 @@ def submit_pipeline(
116119
Args:
117120
project_id: The project_id.
118121
pipeline_root: GCS location of the pipeline runs metadata.
122+
pipeline_job_location: The location to run the Pipeline Job in.
119123
pipeline_job_runner_service_account: Service Account to runner PipelineJobs.
120124
pipeline_params: Pipeline parameters values.
121125
pipeline_spec_path: Location of the pipeline spec JSON.
@@ -130,6 +134,7 @@ def submit_pipeline(
130134
aiplatform.init(project=project_id)
131135
job = aiplatform.PipelineJob(
132136
display_name = display_name,
137+
location = pipeline_job_location,
133138
template_path = pipeline_spec_path,
134139
pipeline_root = pipeline_root,
135140
parameter_values = pipeline_params,

google_cloud_automlops/provisioning/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
from google_cloud_automlops.utils.enums import (
2727
ArtifactRepository,
28-
CodeRepository,
2928
Orchestrator,
3029
PipelineJobSubmitter
3130
)
@@ -113,8 +112,6 @@ def _get_required_apis(self):
113112
required_apis.append('run.googleapis.com')
114113
if self.pipeline_job_submission_service_type == PipelineJobSubmitter.CLOUD_FUNCTIONS.value:
115114
required_apis.append('cloudfunctions.googleapis.com')
116-
if self.source_repo_type == CodeRepository.CLOUD_SOURCE_REPOSITORIES.value:
117-
required_apis.append('sourcerepo.googleapis.com')
118115
if self.setup_model_monitoring:
119116
required_apis.append('logging.googleapis.com')
120117
return required_apis

0 commit comments

Comments
 (0)