def list_experiments(state: State, all_users: bool, name: str, status: RunStatus, uninitialized: bool, count: int, brief: bool): """ List experiments. """ if brief: list_headers = [ RUN_NAME, RUN_SUBMISSION_DATE, RUN_SUBMITTER, RUN_STATUS ] else: list_headers = EXPERIMENTS_LIST_HEADERS if uninitialized: list_unitialized_experiments_in_cli(verbosity_lvl=state.verbosity, all_users=all_users, name=name, headers=list_headers, count=count, brief=brief) else: list_runs_in_cli(state.verbosity, all_users, name, status, LISTED_RUNS_KINDS, list_headers, with_metrics=True, count=count, brief=brief)
def list_inference_instances(state: State, all_users: bool, name: str, status: RunStatus, uninitialized: bool, count: int, brief: bool): """ List inference instances. """ if brief: table_headers = [ RUN_INFERENCE_NAME, RUN_SUBMISSION_DATE, RUN_SUBMITTER, RUN_STATUS ] else: table_headers = [ RUN_INFERENCE_NAME, RUN_PARAMETERS, RUN_SUBMISSION_DATE, RUN_START_DATE, RUN_END_DATE, RUN_SUBMITTER, RUN_STATUS, RUN_TEMPLATE_NAME ] if uninitialized: list_unitialized_experiments_in_cli( verbosity_lvl=state.verbosity, all_users=all_users, name=name, headers=table_headers, listed_runs_kinds=LISTED_RUNS_KINDS, count=count, brief=brief) else: list_runs_in_cli(state.verbosity, all_users, name, status, LISTED_RUNS_KINDS, table_headers, with_metrics=False, count=count, brief=brief)
def test_list_unitialized_experiments_in_cli_one_row(mocker, capsys): api_list_runs_mock = mocker.patch("commands.common.Run.list") api_list_runs_mock.return_value = TEST_RUNS api_list_experiments_mock = mocker.patch("commands.common.Experiment.list") api_list_experiments_mock.return_value = TEST_NONINITIALIZED_EXPERIMENTS get_namespace_mock = mocker.patch( "commands.common.get_kubectl_current_context_namespace") common.list_unitialized_experiments_in_cli(verbosity_lvl=0, all_users=False, name="", listed_runs_kinds=[], headers=TEST_LIST_HEADERS, count=1, brief=False) captured = capsys.readouterr() assert "noninit-test-experiment" not in captured.out assert "noninit2-test-experiment" in captured.out assert get_namespace_mock.call_count == 1 assert api_list_runs_mock.call_count == 1, "Runs were not retrieved" assert api_list_experiments_mock.call_count == 1, "Experiments weren't retrieved"