-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created an Intake Source for Experiment Table (#456)
* Update __init__.py Added the ability to get access to the ExperimentsTableDataSource * Update __init__.py * Create viz.py Uses VizDataSourceMixing and is an Intake data source for reading rubicon Experiment Table Visualizations * Update experiments_table.py Had to add a more detailed path to publish due to error with partially initialized module. * Update setup.cfg Added the experiment table data source as a an Intake Driver * Fixed visualization object input for test_publish.py Inputs to tests are fixtures only and since we can't pass visualization_object, we create one with an empty ExperimentsTable in the test_publish() function itself. * Create test_viz.py Add a new test file to contain the new test_experiments_table_source for testing on the source itself.
- Loading branch information
Showing
6 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import intake # noqa F401 | ||
|
||
from rubicon_ml.intake_rubicon.experiment import ExperimentSource | ||
from rubicon_ml.intake_rubicon.viz import ExperimentsTableDataSource | ||
|
||
__all__ = ["ExperimentSource"] | ||
__all__ = ["ExperimentSource", "ExperimentsTableDataSource"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from rubicon_ml import __version__ | ||
from rubicon_ml.intake_rubicon.base import VizDataSourceMixin | ||
from rubicon_ml.viz import ExperimentsTable | ||
|
||
|
||
class ExperimentsTableDataSource(VizDataSourceMixin): | ||
"""An Intake data source for reading `rubicon` Experiment Table visualizations.""" | ||
|
||
version = __version__ | ||
|
||
container = "python" | ||
name = "rubicon_ml_experiments_table" | ||
|
||
def __init__(self, metadata=None, **catalog_data): | ||
self._catalog_data = catalog_data or {} | ||
|
||
super().__init__(metadata=metadata) | ||
|
||
def _get_schema(self): | ||
"""Creates an Experiments Table visualization and sets it as the visualization object attribute""" | ||
self._visualization_object = ExperimentsTable(**self._catalog_data) | ||
return super()._get_schema() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
|
||
from rubicon_ml.intake_rubicon.viz import ExperimentsTableDataSource | ||
|
||
root = os.path.dirname(__file__) | ||
|
||
|
||
def test_experiments_table_source(): | ||
catalog_data_sample = { | ||
"is_selectable": True, | ||
"metric_names": None, | ||
"metric_query_tags": None, | ||
"metric_query_type": None, | ||
"parameter_names": None, | ||
"parameter_query_tags": None, | ||
"parameter_query_type": None, | ||
} | ||
|
||
source = ExperimentsTableDataSource(catalog_data_sample) | ||
assert source is not None | ||
|
||
source.discover() | ||
|
||
visualization = source.read() | ||
|
||
assert visualization is not None | ||
assert visualization.is_selectable == catalog_data_sample["is_selectable"] | ||
assert visualization.metric_names == catalog_data_sample["metric_names"] | ||
assert visualization.metric_query_tags == catalog_data_sample["metric_query_tags"] | ||
assert visualization.metric_query_type == catalog_data_sample["metric_query_type"] | ||
assert visualization.parameter_names == catalog_data_sample["parameter_names"] | ||
assert visualization.parameter_query_tags == catalog_data_sample["parameter_query_tags"] | ||
assert visualization.parameter_query_type == catalog_data_sample["parameter_query_type"] | ||
|
||
source.close() |