Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisjared committed Oct 30, 2024
1 parent 41fadd9 commit f55d257
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
13 changes: 9 additions & 4 deletions packages/ref-core/src/ref_core/executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def run_metric(
Configuration to run the metric with
trigger
Information about the dataset that triggered the metric run
TODO: The optionality of this parameter is a placeholder and will be expanded in the future.
kwargs
Additional keyword arguments for the executor
Expand Down Expand Up @@ -113,7 +115,7 @@ def get(self, name: str) -> Executor:
get_executor = _default_manager.get


def run_metric(metric_name: str, /, metrics_provider: MetricsProvider, **kwargs) -> MetricResult: # type: ignore
def run_metric(metric_name: str, /, metrics_provider: MetricsProvider, **kwargs: Any) -> MetricResult:
"""
Run a metric using the default executor
Expand All @@ -128,8 +130,6 @@ def run_metric(metric_name: str, /, metrics_provider: MetricsProvider, **kwargs)
Name of the metric to run.
metrics_provider
Provider from where to retrieve the metric
args
Extra arguments passed to the metric of interest
kwargs
Additional options passed to the metric executor
Expand All @@ -143,7 +143,12 @@ def run_metric(metric_name: str, /, metrics_provider: MetricsProvider, **kwargs)
executor = get_executor(executor_name)
metric = metrics_provider.get(metric_name)

return executor.run_metric(metric, trigger=None, **kwargs)
result = executor.run_metric(metric, trigger=None, **kwargs)

# TODO: Validate the result
# TODO: Log the result

return result


register_executor(LocalExecutor())
2 changes: 1 addition & 1 deletion packages/ref-core/src/ref_core/executor/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LocalExecutor:
name = "local"

def run_metric(
self, metric: Metric, configuration: Configuration, trigger: TriggerInfo | None = None, **kwargs: Any
self, metric: Metric, configuration: Configuration, trigger: TriggerInfo | None, **kwargs: Any
) -> MetricResult:
"""
Run a metric in process
Expand Down
8 changes: 5 additions & 3 deletions packages/ref-metrics-example/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ref-core
# ref-metrics-example

This package provides the core functionality for the REF.
This package is designed to be a library so may be published and consumed by othe packages if needed.
An example of a basic REF metrics provider.

This package provides an example of how to implement a REF metrics provider,
that exposes a single metric, `example_metric`, which is a simple counter.

0 comments on commit f55d257

Please sign in to comment.