Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(restapi): add metrics capabilities to RESTAPI #672

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

jtsextonMITRE
Copy link
Collaborator

Closes #671.

Additionally:
Fixes some incorrect function descriptions.
Fixes some mypy linting issues in related files.
Adds a restapi test for the /jobs/{id}/mlflowRun endpoint using a fixture added to help the metrics test.

src/dioptra/restapi/v1/jobs/service.py Outdated Show resolved Hide resolved
src/dioptra/restapi/v1/jobs/schema.py Show resolved Hide resolved
run_id: UUID = self._job_id_mlflowrun_service.get(job_id=job_id, **kwargs)[
"mlflow_run_id"
]
client = MlflowClient()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it can't connect to the mlflow server it attempts to re-connect several times, so this request can hang for a bit. Not sure if this is the best behavior? Maybe we should set number of retries lower?

src/dioptra/restapi/v1/jobs/service.py Show resolved Hide resolved
src/dioptra/restapi/v1/jobs/service.py Show resolved Hide resolved
src/dioptra/restapi/v1/jobs/service.py Show resolved Hide resolved
src/dioptra/restapi/v1/jobs/service.py Outdated Show resolved Hide resolved
@keithmanville
Copy link
Collaborator

@jtsextonMITRE I made a couple commits to this branch:

  • I didn't have an issue with import uuid causing a circular import. Can you confirm this is working for you?
  • I updated the Metrics schemas - hopefully these changes make sense.

@keithmanville keithmanville linked an issue Dec 20, 2024 that may be closed by this pull request
9 tasks
This commit adds functionality for managing metrics via the REST API. The metrics are stored in
MLFlow, so this feature uses the MLFlow client in the service layer. Providing metrics management
via the Dioptra REST API is part of a larger effort to remove the need for the user to interact
with MLFlow directly.

It adds the following endpoints for managing metrics:
- GET `/experiments/{id}/metrics` - Gets all of the latest metrics for every job in the experiment
- GET `/jobs/{id}/metrics` - Gets a Job resource's latest metrics
- POST `jobs/{id}/metrics` - Sets a metric for a Job
- GET `/jobs/{id}/metrics/{name}/snapshots` - Gets a Job metric history

This commit also updates the Python client for the new functionality.
@keithmanville keithmanville force-pushed the jtsexton-restapi-mlflow-metrics branch from 4a85084 to 6e74940 Compare December 20, 2024 21:29
@keithmanville keithmanville merged commit 6e74940 into dev Dec 20, 2024
10 of 11 checks passed
@keithmanville keithmanville deleted the jtsexton-restapi-mlflow-metrics branch December 20, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add endpoints for storing and retrieving metrics
3 participants