Skip to content
10 changes: 2 additions & 8 deletions src/webapp/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
MEDALLION_LEVELS = ["silver", "gold", "bronze"]

# The name of the deployed pipeline in Databricks. Must match directly.
PDP_INFERENCE_JOB_NAME = "github_sourced_pdp_inference_pipeline"
PDP_H2O_INFERENCE_JOB_NAME = "edvise_github_sourced_pdp_inference_pipeline"
PDP_INFERENCE_JOB_NAME = "edvise_github_sourced_pdp_inference_pipeline"


class DatabricksInferenceRunRequest(BaseModel):
Expand Down Expand Up @@ -203,12 +202,7 @@ def run_pdp_inference(

db_inst_name = databricksify_inst_name(req.inst_name)

if req.model_type == "sklearn":
pipeline_type = PDP_INFERENCE_JOB_NAME
elif req.model_type == "h2o":
pipeline_type = PDP_H2O_INFERENCE_JOB_NAME
else:
raise ValueError("Invalid model framework assigned to institution model")
pipeline_type = PDP_INFERENCE_JOB_NAME
try:
job = next(w.jobs.list(name=pipeline_type), None)
if not job or job.job_id is None:
Expand Down
10 changes: 9 additions & 1 deletion src/webapp/routers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,15 @@ def get_model_cards(
)

try:
volume_path = f"/Volumes/staging_sst_01/{databricksify_inst_name(query_result[0][0].name)}_gold/gold_volume/model_cards/model-card-{model_name}.pdf"
env = str(env_vars["ENV"]).strip().upper()
SCHEMAS = {"DEV": "dev_sst_02", "STAGING": "staging_sst_01"}
if env not in SCHEMAS:
raise ValueError(
f"Unsupported ENV {env_vars.get('ENV')!r}; expected DEV or STAGING"
)
env_schema = SCHEMAS[env]

volume_path = f"/Volumes/{env_schema}/{databricksify_inst_name(query_result[0][0].name)}_gold/gold_volume/model_cards/model-card-{model_name}.pdf"
LOGGER.info(f"Attempting to download from {volume_path}")
response = w.files.download(volume_path)
stream = cast(IO[bytes], response.contents)
Expand Down
Loading