Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dagster-gcp] live tests #26761

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[dagster-gcp] live tests #26761

wants to merge 1 commit into from

Conversation

dpeng817
Copy link
Contributor

@dpeng817 dpeng817 commented Dec 30, 2024

Summary & Motivation

Similar to what we introduced for azure, introduce live testing for gcp. Starting with the compute log manager.

Just like the azure tests, this runs on branches which touch dagster-gcp, as well as on the oss nightly pipeline.

Most of the files here are a relative copy-paste job from the azure tests. There is some new functionality, and I've added comments pointing to where that lives.

How I Tested These Changes

New tests pass.

Copy link
Contributor Author

dpeng817 commented Dec 30, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@dpeng817 dpeng817 force-pushed the dpeng817/gcs-live-tests branch from 54adede to d619329 Compare December 30, 2024 20:53
@dpeng817 dpeng817 requested a review from mlarose December 30, 2024 21:05
@dpeng817 dpeng817 marked this pull request as ready for review December 30, 2024 21:05
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a direct copy paste from azure tests

module: dagster_gcp.gcs.compute_log_manager
class: GCSComputeLogManager
config:
json_credentials_envvar: GCP_LIVE_TEST_CREDENTIALS
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are new creds I created for this test suite

Comment on lines +29 to +48
subprocess.run(
["dagster", "asset", "materialize", "--select", "my_asset", "-m", "gcp_test_proj.defs"],
check=True,
)
logs_captured_data = check.not_none(
DagsterInstance.get()
.get_event_records(
EventRecordsFilter(
event_type=DagsterEventType.LOGS_CAPTURED,
)
)[0]
.event_log_entry.dagster_event
).logs_captured_data

assert logs_captured_data.external_stderr_url
assert logs_captured_data.external_stdout_url
stderr = get_content_from_url(logs_captured_data.external_stderr_url)
stdout = get_content_from_url(logs_captured_data.external_stdout_url)
assert stdout.count("Printing without context") == 10
assert stderr.count("Logging using context") == 10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is all mostly the same as azure


def _parse_gcs_url_into_uri(url: str) -> str:
return url.removeprefix(
"https://console.cloud.google.com/storage/browser/_details/computelogmanager-tests/"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the url format can't be directly downloaded; so we need to do some gross munging to pull out the downloadable log key.

We actually hard code a similar string in the compute log manager itself, we should turn that into a constant and use it in both places ideally.



def get_bucket_client(credentials: Mapping) -> gcs.Bucket:
return gcs.Client.from_service_account_info(credentials).get_bucket("computelogmanager-tests")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is pulled straight from the compute log manager implementation

@dpeng817 dpeng817 changed the title GCS Live tests [dagster-gcp] live tests Dec 30, 2024
@dpeng817 dpeng817 force-pushed the dpeng817/complogmngr-delete-blobs branch from a4f8c2e to 02f06c7 Compare December 30, 2024 21:52
@dpeng817 dpeng817 force-pushed the dpeng817/gcs-live-tests branch from d619329 to 8021849 Compare December 30, 2024 21:52
Base automatically changed from dpeng817/complogmngr-delete-blobs to master December 30, 2024 23:53
@dpeng817 dpeng817 force-pushed the dpeng817/gcs-live-tests branch from 8021849 to 9449650 Compare December 31, 2024 15:38
@benpankow benpankow self-requested a review December 31, 2024 15:54
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.

1 participant