Perform validation of logged features (produced by a given feature service) against provided reference. START_TS and END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01'
(
ctx: click.Context,
feature_service: str,
reference: str,
start_ts: str,
end_ts: str,
no_profile_cache,
)
| 560 | @click.argument("end_ts") |
| 561 | @click.pass_context |
| 562 | def validate( |
| 563 | ctx: click.Context, |
| 564 | feature_service: str, |
| 565 | reference: str, |
| 566 | start_ts: str, |
| 567 | end_ts: str, |
| 568 | no_profile_cache, |
| 569 | ): |
| 570 | """ |
| 571 | Perform validation of logged features (produced by a given feature service) against provided reference. |
| 572 | |
| 573 | START_TS and END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01' |
| 574 | """ |
| 575 | store = create_feature_store(ctx) |
| 576 | |
| 577 | _feature_service = store.get_feature_service(name=feature_service) |
| 578 | _reference = store.get_validation_reference(reference) |
| 579 | |
| 580 | result = store.validate_logged_features( |
| 581 | source=_feature_service, |
| 582 | reference=_reference, |
| 583 | start=maybe_local_tz(datetime.fromisoformat(start_ts)), |
| 584 | end=maybe_local_tz(datetime.fromisoformat(end_ts)), |
| 585 | throw_exception=False, |
| 586 | cache_profile=not no_profile_cache, |
| 587 | ) |
| 588 | |
| 589 | if not result: |
| 590 | print(f"{Style.BRIGHT + Fore.GREEN}Validation successful!{Style.RESET_ALL}") |
| 591 | return |
| 592 | |
| 593 | errors = [e.to_dict() for e in result.report.errors] |
| 594 | formatted_json = json.dumps(errors, indent=4) |
| 595 | colorful_json = highlight( |
| 596 | formatted_json, lexers.JsonLexer(), formatters.TerminalFormatter() |
| 597 | ) |
| 598 | print(f"{Style.BRIGHT + Fore.RED}Validation failed!{Style.RESET_ALL}") |
| 599 | print(colorful_json) |
| 600 | exit(1) |
| 601 | |
| 602 | |
| 603 | @cli.command("demo-notebooks") |
nothing calls this directly
no test coverage detected