This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate
CloudRunJob
and VertexAICustomTrainingJob
infrastructur…
…e blocks (#255) * Deprecate `CloudRunJob` and `VertexAICustomTrainingJob` infrastructure blocks * Bump minimum prefect version * Fixes tests
- Loading branch information
1 parent
c7be9eb
commit b88d619
Showing
4 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
prefect>=2.14.10 | ||
prefect>=2.16.4 | ||
google-api-python-client>=2.20.0 | ||
google-cloud-storage>=2.0.0 | ||
tenacity>=8.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
from prefect._internal.compatibility.deprecated import PrefectDeprecationWarning | ||
|
||
from prefect_gcp.aiplatform import VertexAICustomTrainingJob | ||
from prefect_gcp.cloud_run import CloudRunJob | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"InfraBlock, kwargs, expected_message", | ||
[ | ||
( | ||
CloudRunJob, | ||
{"image": "foo", "region": "us-central1"}, | ||
"prefect_gcp.cloud_run.CloudRunJob has been deprecated." | ||
" It will not be available after Sep 2024." | ||
" Use the Cloud Run or Cloud Run v2 worker instead." | ||
" Refer to the upgrade guide for more information", | ||
), | ||
( | ||
VertexAICustomTrainingJob, | ||
{"image": "foo", "region": "us-central1"}, | ||
"prefect_gcp.aiplatform.VertexAICustomTrainingJob has been deprecated." | ||
" It will not be available after Sep 2024." | ||
" Use the Vertex AI worker instead." | ||
" Refer to the upgrade guide for more information", | ||
), | ||
], | ||
) | ||
def test_infra_blocks_emit_a_deprecation_warning( | ||
InfraBlock, kwargs, expected_message, gcp_credentials | ||
): | ||
with pytest.warns(PrefectDeprecationWarning, match=expected_message): | ||
if InfraBlock == CloudRunJob: | ||
InfraBlock(**kwargs, credentials=gcp_credentials) | ||
else: | ||
InfraBlock(**kwargs, gcp_credentials=gcp_credentials) |