Skip to content

Add support for Google Cloud#357

Merged
engshahrad merged 127 commits into
ubc-cirrus-lab:mainfrom
realchh:naufal/gcp_benchmarks
Aug 12, 2025
Merged

Add support for Google Cloud#357
engshahrad merged 127 commits into
ubc-cirrus-lab:mainfrom
realchh:naufal/gcp_benchmarks

Conversation

@realchh

@realchh realchh commented Jul 24, 2025

Copy link
Copy Markdown
Contributor

[Major Changes] Added support for Google Cloud Platform (GCP) cloud provider. Key components have been refactored to handle both AWS and GCP resources, selectable via an environment variable "CARIBOU_DEFAULT_PROVIDER".

Key Changes & Features:

  • Multi-Cloud RemoteClient Architecture:

    • The RemoteClientFactory has been refactored to use runtime imports. This prevents cross-cloud dependency issues (e.g., trying to import boto3 in a GCP environment and importing Google Cloud modules in an AWS environment), resolving ModuleNotFoundErrors at startup.
    • A new GCPRemoteClient class has been implemented to provide the GCP equivalent for core framework operations.
  • GCP Resource Management:

    • Compute: Deploys functions as Cloud Run services using Docker images stored in Artifact Registry.
    • IAM: Implements the "one service account per workflow" pattern for GCP. It creates a single, shared Service Account for all functions within a workflow to handle GCP's stricter naming and length constraints. GCP also has a default quota of 100 service accounts per user.
    • Messaging: Uses Pub/Sub topics and authenticated push subscriptions to connect workflow functions, mirroring the SNS functionality in AWS. Improved by Pub/Sub's max limit of 10MB, the messages are not compressed.
    • Scheduling: Uses Cloud Scheduler to trigger the remote CLI for automated tasks, providing an equivalent to AWS EventBridge rules.
    • Storage: Uses Firestore as the key-value store for state management (e.g., workflow plans, image URIs), equivalent to DynamoDB.
  • Framework Tooling Updates:

    • Setup Scripts: GCP does not need a setup table script. The tables are generated automatically when the first values are stored there. The user only needs to create the default database.
    • Teardown Scripts: The teardown_tables.py scripts are now multi-cloud. They check the CARIBOU_DEFAULT_PROVIDER environment variable to run the appropriate logic for either DynamoDB or Firestore.
    • Remote CLI: The remote_cli.py and main cli.py have been updated with provider-aware wrapper functions (deploy_remote_framework, remove_timers, etc.) to manage the remote framework on both AWS and GCP.
    • Log Syncing: The LogSyncWorkflow has been refactored to parse both plain-text AWS CloudWatch logs and structured JSON logs from Google Cloud Logging. It now queries the Cloud Monitoring API to fetch performance metrics (CPU, memory) for Cloud Run, for an equivalent to Lambda Insights. The framework queries the logging API with a page size of 1000, and has an exponential backoff if the logging read quota is reached.
    • Migrator: Changed crane to gcrane for migrating images in GCP. Both the local and remote CLI can only use the Python solver for GCP.
  • Data collection

    • Implemented a more fine-grained PUE values for both AWS and GCP. This value is gathered from the respective cloud providers' self-reported value.
    • Updated default values for PUE, Memory power consumption, and other metrics.
  • Unit Tests:

    • Added test_gcp_remote_client.py
    • Extended existing test suites (e.g., test_log_sync_workflow.py, test_endpoints.py) to cover the new GCP code paths
    • Increased the test coverage to 83.35%

How to Use:

To target GCP for deployment or other commands, set the following environment variables before running the caribou CLI:

export CARIBOU_DEFAULT_PROVIDER=gcp

To switch the target back to AWS, use the following command:

export CARIBOU_DEFAULT_PROVIDER=aws

Further instructions are provided in the INSTALL.md file in the project's directory.

Remaining Work & Known Issues:
This is an initial implementation. Further testing on more workflows is needed.

realchh added 30 commits May 8, 2025 12:07
- Changed CLOUD_PING URI to the correct URI
- Changed system from web scraping and parsing table into a GET request to the API
- Deleting the parse_table method
- Removed beautifulsoup import, not used anymore
- Rewritten test to reflect the changes
…blic on ODbL licence.

- finding the electricitymaps zone of a region from its coordinates
- download its respective csv
- process the csv by using the data from 1 year ago

Fixes:
- failed to deploy from missing README.md file on the generated dockerfile
-
…enchmarks folder to allow benchmarking in GCP
# Conflicts:
#	caribou/data_collector/utils/constants.py
…hboard through an API call, and returns a zone-to-zone median latency. Get distribution is modified to allow it to work, but functionality needs to be further tested.
# Conflicts:
#	caribou/data_collector/utils/constants.py
#	caribou/data_collector/utils/ec_maps_zone_finder/README.md
#	caribou/data_collector/utils/latency_retriever/gcp_latency_retriever.py
#	poetry.lock
#	pyproject.toml
@Danidite
Danidite requested review from Danidite and engshahrad July 24, 2025 22:38
@Danidite Danidite assigned realchh and Danidite and unassigned Danidite Jul 24, 2025

@Danidite Danidite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks great, amazing work! However I have a few questions and comment that I think may be problematic or need to be addressed.

Comment thread benchmarks/gcp_benchmarks/text_2_speech_censoring/app.py Outdated
Comment thread caribou/common/constants.py
Comment thread caribou/common/constants.py Outdated
Comment thread caribou/common/constants.py
Comment thread caribou/data_collector/utils/ec_maps_zone_finder/README.md Outdated
Comment thread caribou/deployment/common/deploy/workflow_builder.py
Comment thread caribou/deployment/common/deploy/workflow_builder.py
Comment thread caribou/deployment/common/deploy/workflow_builder.py
Comment thread caribou/common/models/remote_client/gcp_remote_client.py Outdated
Comment thread caribou/common/models/remote_client/gcp_remote_client.py

@Danidite Danidite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

Note: Pending demo, please do not squash and merge until the demo and any issues found are addressed.

@Danidite

This comment was marked as duplicate.

realchh added 2 commits August 8, 2025 19:38
…emented paged log retrieval, fixed missing aws permission for lambda functions

@Danidite Danidite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new changes looks great, I do have a few very minor comments that may be a nice to have.

Comment thread caribou/common/models/remote_client/gcp_remote_client.py
… iam policy, removed service account deletion in deploying remote cli, implemented gcp remote cli that is invoked using pub/sub
… each subscription, removal of cli pubsub topic
@engshahrad engshahrad changed the title Add support for Google Cloud Provider Add support for Google Cloud Aug 12, 2025
@engshahrad

Copy link
Copy Markdown
Contributor

LGTM. Good job, @realchh , and thanks for the detailed review @Danidite . Merging now.

@engshahrad
engshahrad merged commit bb46135 into ubc-cirrus-lab:main Aug 12, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google Maps doesn't know where US East (N. Virginia) is Add Support for Google Cloud Platform Add tests for zone finder and gcp latency retriever

3 participants