This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
FROM continuumio/miniconda3 | ||
WORKDIR /home | ||
COPY entry.py . | ||
RUN pip install hydra-ml==0.3.8 | ||
ENTRYPOINT ["python", "entry.py"] |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
|
||
from google.cloud import secretmanager | ||
|
||
def access_secret_version(project_id, secret_id, version_id="latest"): | ||
# Create the Secret Manager client. | ||
client = secretmanager.SecretManagerServiceClient() | ||
|
||
# Build the resource name of the secret version. | ||
name = f"projects/{project_id}/secrets/{secret_id}/versions/{version_id}" | ||
|
||
# Access the secret version. | ||
response = client.access_secret_version(name=name) | ||
|
||
# Return the decoded payload. | ||
return response.payload.data.decode('UTF-8') | ||
|
||
|
||
def get_creds_for_gcp_mlflow(): | ||
project_id = os.environ["GCP_PROJECT"] | ||
|
||
tracking_uri = access_secret_version(project_id, 'MLFLOW_TRACKING_URI') | ||
username = access_secret_version(project_id, 'MLFLOW_TRACKING_USERNAME') | ||
pswd = access_secret_version(project_id, 'MLFLOW_TRACKING_PASSWORD') | ||
return tracking_uri, username, pswd |
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