Skip to content

Commit

Permalink
logging to improve performance of POST /results/
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Oct 17, 2024
1 parent 54c0605 commit cc87adc
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,20 +274,23 @@ def query_results_summary(
@router.post("/results/", response_model=ValidationResult, status_code=status.HTTP_201_CREATED)
def create_result(result: ValidationResult, token: HTTPAuthorizationCredentials = Depends(auth)):
_check_service_status()
logger.info("Beginning post result")
logger.warning("Beginning post result")
user = User(token, allow_anonymous=False)
kg_client = get_kg_client_for_user_account(token)

validation_activity = result.to_kg_objects(kg_client)
space = space_from_project_id(result.project_id)
activity_log = None

logger.warning(f"Saving outputs ({datetime.now().isoformat()})")
for output in as_list(validation_activity.outputs):
output.save(kg_client, recursive=False, activity_log=activity_log, space=space)
logger.warning(f"Saving custom_property_sets.data_location ({datetime.now().isoformat()})")
if validation_activity.custom_property_sets:
validation_activity.custom_property_sets.data_location.save(kg_client, recursive=True, activity_log=activity_log, space=space)
logger.warning(f"Saving ModelValidation object ({datetime.now().isoformat()})")
validation_activity.save(kg_client, recursive=False, activity_log=activity_log, space=space)

logger.warning(f"Returning validation result ({datetime.now().isoformat()})")
return ValidationResult.from_kg_object(validation_activity, kg_client)


Expand Down

0 comments on commit cc87adc

Please sign in to comment.