Exemple #1
0
def test_experiment_client_list_runs(mocker):
    mocker.patch.object(ExperimentClient, "query_runs")

    client = ExperimentClient(mocker.Mock(), mocker.Mock())
    response = client.list_runs(
        PROJECT_ID,
        experiment_ids=[123, 456],
        lifecycle_stage=LifecycleStage.DELETED,
        start=20,
        limit=10,
    )

    assert response == ExperimentClient.query_runs.return_value
    expected_filter = CompoundFilter(
        LogicalOperator.AND,
        [
            CompoundFilter(
                LogicalOperator.OR,
                [
                    ExperimentIdFilter(ComparisonOperator.EQUAL_TO, 123),
                    ExperimentIdFilter(ComparisonOperator.EQUAL_TO, 456),
                ],
            ),
            DeletedAtFilter(ComparisonOperator.DEFINED, True),
        ],
    )
    ExperimentClient.query_runs.assert_called_once_with(
        PROJECT_ID, expected_filter, None, 20, 10)
Exemple #2
0
def test_experiment_client_list_runs_defaults(mocker):
    mocker.patch.object(ExperimentClient, "query_runs")

    client = ExperimentClient(mocker.Mock(), mocker.Mock())
    response = client.list_runs(PROJECT_ID)

    assert response == ExperimentClient.query_runs.return_value
    ExperimentClient.query_runs.assert_called_once_with(
        PROJECT_ID, None, None, None, None)