Exemple #1
0
def test_faculty_run_to_mlflow_run_parent_run_id_backwards_compatability(
        faculty_attribute, faculty_tag_value, mlflow_tag_value):
    """Test logic setting parent run ID tag when not available."""

    if faculty_tag_value is None:
        extra_tags = []
    else:
        extra_tags = [FacultyTag(MLFLOW_PARENT_RUN_ID, faculty_tag_value)]
    faculty_run = FACULTY_RUN._replace(parent_run_id=faculty_attribute,
                                       tags=FACULTY_RUN.tags + extra_tags)

    if mlflow_tag_value is None:
        parent_run_id_tag = None
    else:
        parent_run_id_tag = RunTag(MLFLOW_PARENT_RUN_ID, mlflow_tag_value)
    expected_run = mlflow_run(parent_run_id_tag=parent_run_id_tag)

    assert run_equals(faculty_run_to_mlflow_run(faculty_run), expected_run)
Exemple #2
0
def test_faculty_run_to_mlflow_run_name_backwards_compatability(
        faculty_attribute, faculty_tag_value, mlflow_attribute,
        mlflow_tag_value):
    """Test logic setting run name tag when not available."""

    if faculty_tag_value is None:
        extra_tags = []
    else:
        extra_tags = [FacultyTag(MLFLOW_RUN_NAME, faculty_tag_value)]
    faculty_run = FACULTY_RUN._replace(name=faculty_attribute,
                                       tags=FACULTY_RUN.tags + extra_tags)

    if mlflow_tag_value is None:
        name_tag = None
    else:
        name_tag = RunTag(MLFLOW_RUN_NAME, mlflow_tag_value)
    expected_run = mlflow_run(name=mlflow_attribute, name_tag=name_tag)

    assert run_equals(faculty_run_to_mlflow_run(faculty_run), expected_run)
Exemple #3
0
def mlflow_tag_to_faculty_tag(mlflow_tag):
    return FacultyTag(key=mlflow_tag.key, value=mlflow_tag.value)
Exemple #4
0
NAME = "experiment name"
ARTIFACT_LOCATION = "scheme://artifact-location"

METRIC_TIMESTAMP = datetime(2019, 3, 13, 17, 0, 15, tzinfo=UTC)
METRIC_TIMESTAMP_MILLISECONDS = to_timestamp(METRIC_TIMESTAMP) * 1000
FACULTY_METRIC = FacultyMetric(key="metric-key",
                               value="metric-value",
                               timestamp=METRIC_TIMESTAMP,
                               step=0)
MLFLOW_METRIC = Metric("metric-key", "metric-value",
                       METRIC_TIMESTAMP_MILLISECONDS, 0)

FACULTY_PARAM = FacultyParam(key="param-key", value="param-value")
MLFLOW_PARAM = Param("param-key", "param-value")

FACULTY_TAG = FacultyTag(key="tag-key", value="tag-value")
MLFLOW_TAG = RunTag("tag-key", "tag-value")

FACULTY_EXPERIMENT = FacultyExperiment(
    id=EXPERIMENT_ID,
    name=NAME,
    description="not used",
    artifact_location=ARTIFACT_LOCATION,
    created_at=datetime.now(tz=UTC),
    last_updated_at=datetime.now(tz=UTC),
    deleted_at=None,
)

RUN_UUID = uuid4()
RUN_UUID_HEX_STR = RUN_UUID.hex