Skip to content

Commit

Permalink
using chaavi
Browse files Browse the repository at this point in the history
  • Loading branch information
furniturewalatkNIH authored Dec 19, 2024
1 parent a903f3c commit e2fd05b
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions .github/workflows/check-jupyter-wip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,43 @@ jobs:
- name: Generate configuration file from secrets
env:
NOTEBOOK_GCP_PROJECT_ID: ${{ vars.NOTEBOOK_GCP_PROJECT_ID }}
TKF_CHAVI: ${{ secrets.TKF_PICHAI_BAADAL_CHAVI }}
NOTEBOOK_GCP_PROJECT_ID: ${{ secrets.NOTEBOOK_GCP_PROJECT_ID }}
NOTEBOOK_GCP_LOCATION: ${{ vars.NOTEBOOK_GCP_LOCATION }}
run: |
echo '{' > env.json
echo ' "NOTEBOOK_GCP_PROJECT_ID": "'${NOTEBOOK_GCP_PROJECT_ID}'",' >> env.json
echo ' "NOTEBOOK_GCP_LOCATION": "'${NOTEBOOK_GCP_LOCATION}'"' >> env.json
echo '}' >> env.json
#run: |
# echo '{' > env.json
# echo ' "NOTEBOOK_GCP_PROJECT_ID": "'${NOTEBOOK_GCP_PROJECT_ID}'",' >> env.json
# echo ' "NOTEBOOK_GCP_LOCATION": "'${NOTEBOOK_GCP_LOCATION}'"' >> env.json
# echo '}' >> env.json

- name: Run tests with pytest
run: |
pwd
#jupyter nbconvert --to notebook --execute notebooks/GenAI/Gemini_Intro.ipynb
pytest -s testing/test_notebooks.py
import os
import json
from google.oauth2 import service_account
# Access the service account key from the environment variable
service_account_key = os.environ.get("GCP_SERVICE_ACCOUNT_KEY")
if service_account_key is None:
raise ValueError("Service account key is not set in environment variables.")
# Parse the JSON key
key_data = json.loads(service_account_key)
# Authenticate with the service account key
credentials = service_account.Credentials.from_service_account_info(key_data)
# (Optional) Use the credentials for API initialization
from google.cloud import aiplatform
# Initialize Vertex AI Platform
PROJECT_ID = os.environ.get("NOTEBOOK_GCP_PROJECT_ID")
REGION = os.environ.get("NOTEBOOK_GCP_LOCATION")
aiplatform.init(project=PROJECT_ID, location=REGION, credentials=credentials)
jupyter nbconvert --to notebook --execute notebooks/GenAI/Gemini_Intro.ipynb
#pytest -s testing/test_notebooks.py

0 comments on commit e2fd05b

Please sign in to comment.