@@ -473,6 +473,7 @@ def trigger_inference_run(
473473 """
474474 model_name = decode_url_piece (model_name )
475475 has_access_to_inst_or_err (inst_id , current_user )
476+ print ('xxxxxxxxxxxxxxxxxxxxxxxx0' )
476477 if not req .is_pdp :
477478 raise HTTPException (
478479 status_code = status .HTTP_501_NOT_IMPLEMENTED ,
@@ -490,6 +491,7 @@ def trigger_inference_run(
490491 )
491492 .all ()
492493 )
494+ print ('xxxxxxxxxxxxxxxxxxxxxxxx1' )
493495 if len (inst_result ) != 1 :
494496 raise HTTPException (
495497 status_code = status .HTTP_400_BAD_REQUEST ,
@@ -508,6 +510,7 @@ def trigger_inference_run(
508510 )
509511 .all ()
510512 )
513+ print ('xxxxxxxxxxxxxxxxxxxxxxxx2' )
511514 if len (query_result ) != 1 :
512515 raise HTTPException (
513516 status_code = status .HTTP_400_BAD_REQUEST ,
@@ -528,12 +531,14 @@ def trigger_inference_run(
528531 )
529532 .all ()
530533 )
534+ print ('xxxxxxxxxxxxxxxxxxxxxxxx3' )
531535 if len (batch_result ) != 1 :
532536 raise HTTPException (
533537 status_code = status .HTTP_400_BAD_REQUEST ,
534538 detail = "Unexpected number of batches found: Expected 1, got "
535539 + str (len (inst_result )),
536540 )
541+ print ('xxxxxxxxxxxxxxxxxxxxxxxx4' )
537542 if not check_file_types_valid_schema_configs (
538543 [x .schemas for x in batch_result [0 ][0 ].files ],
539544 jsonpickle .decode (query_result [0 ][0 ].schema_configs ),
@@ -542,6 +547,7 @@ def trigger_inference_run(
542547 status_code = status .HTTP_400_BAD_REQUEST ,
543548 detail = "The files in this batch don't conform to the schema configs allowed by this model." ,
544549 )
550+ print ('xxxxxxxxxxxxxxxxxxxxxxxx5' )
545551 # Note to Datakind: In the long-term, this is where you would have a case block or something that would call different types of pipelines.
546552 db_req = DatabricksInferenceRunRequest (
547553 inst_name = inst_result [0 ][0 ].name ,
@@ -551,14 +557,16 @@ def trigger_inference_run(
551557 # The institution email to which pipeline success/failure notifications will get sent.
552558 email = current_user .email ,
553559 )
560+ print ('xxxxxxxxxxxxxxxxxxxxxxxx6' )
554561 try :
555562 res = databricks_control .run_pdp_inference (db_req )
556563 except Exception as e :
557564 raise HTTPException (
558565 status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
559- detail = str (e ),
566+ detail = "Databricks run_pdp_inference error: " + str (e ),
560567 )
561568 triggered_timestamp = datetime .now ()
569+ print ('xxxxxxxxxxxxxxxxxxxxxxxx7' )
562570 job = JobTable (
563571 id = res .job_run_id ,
564572 triggered_at = triggered_timestamp ,
@@ -567,6 +575,7 @@ def trigger_inference_run(
567575 model_id = query_result [0 ][0 ].id ,
568576 output_valid = False ,
569577 )
578+ print ('xxxxxxxxxxxxxxxxxxxxxxxx8' )
570579 local_session .get ().add (job )
571580 return {
572581 "inst_id" : inst_id ,
0 commit comments