in batch_pipeline/pipelines/postprocess_monitor_script.py [0:0]
def postprocess_handler():
violations_file = "/opt/ml/processing/output/constraint_violations.json"
if os.path.isfile(violations_file):
f = open(violations_file)
violations = json.load(f)
metrics = list(get_baseline_drift(violations))
put_cloudwatch_metric(pipeline_name, metrics)
logger.info("Violation detected and added to cloudwatch")
else:
logger.info("No constraint_violations file found. All good!")