diff --git a/client/verta/tests/test_cli/test_endpoint.py b/client/verta/tests/test_cli/test_endpoint.py index 1a8ee5227e..458f9870ad 100644 --- a/client/verta/tests/test_cli/test_endpoint.py +++ b/client/verta/tests/test_cli/test_endpoint.py @@ -95,25 +95,25 @@ def test_get(self, client, created_entities, experiment_run, model_for_deploymen ["deployment", "get", "endpoint", path], ) assert not result.exception - assert "path: {}".format(endpoint.path) in result.output - assert "id: {}".format(endpoint.id) in result.output - assert "curl: " in result.output - - assert "status" in result.output - assert "date created" in result.output - assert "date updated" in result.output - assert "stage's date created" in result.output - assert "stage's date updated" in result.output - assert "components" in result.output - - updated_status = endpoint.update(experiment_run, DirectUpdateStrategy(), True) + + def in_output(s: str) -> bool: + return any(line.startswith(s) for line in result.output.splitlines()) + + assert in_output(f"path: {endpoint.path}") + assert in_output(f"id: {endpoint.id}") + assert in_output("curl: ") + assert in_output("status") + assert in_output("date created") + assert in_output("stage's date created") + assert in_output("stage's date updated") + assert in_output("components") + + endpoint.update(experiment_run, DirectUpdateStrategy(), True) result = runner.invoke( cli, ["deployment", "get", "endpoint", path], ) - assert ( - "curl: {}".format(endpoint.get_deployed_model().get_curl()) in result.output - ) + assert f"curl: {endpoint.get_deployed_model().get_curl()}" in result.output class TestUpdate: diff --git a/client/verta/tests/test_endpoint/test_endpoint.py b/client/verta/tests/test_endpoint/test_endpoint.py index fad6f72908..4904cdb57f 100644 --- a/client/verta/tests/test_endpoint/test_endpoint.py +++ b/client/verta/tests/test_endpoint/test_endpoint.py @@ -136,23 +136,22 @@ def test_repr(self, client, created_entities, experiment_run, model_for_deployme created_entities.append(endpoint) str_repr = repr(endpoint) - assert "path: {}".format(endpoint.path) in str_repr - assert endpoint.url in str_repr - assert "url" in str_repr - assert "id: {}".format(endpoint.id) in str_repr - assert "curl: " in str_repr - - # these fields might have changed: - assert "status" in str_repr - assert "date created" in str_repr - assert "date updated" in str_repr - assert "stage's date created" in str_repr - assert "stage's date updated" in str_repr - assert "components" in str_repr + def in_repr(s: str) -> bool: + return any(line.startswith(s) for line in str_repr.splitlines()) + + assert in_repr(f"path: {endpoint.path}") + assert in_repr(f"url: {endpoint.url}") + assert in_repr(f"id: {endpoint.id}") + assert in_repr("curl: ") + assert in_repr("status") + assert in_repr("date created") + assert in_repr("stage's date created") + assert in_repr("stage's date updated") + assert in_repr("components") endpoint.update(experiment_run, DirectUpdateStrategy(), True) str_repr = repr(endpoint) - assert "curl: {}".format(endpoint.get_deployed_model().get_curl()) in str_repr + assert f"curl: {endpoint.get_deployed_model().get_curl()}" in str_repr def test_download_manifest(self, client, in_tempdir): download_to_path = "manifest.yaml" diff --git a/client/verta/verta/_cli/deployment/list.py b/client/verta/verta/_cli/deployment/list.py index e0c2408f1f..d088566f0e 100644 --- a/client/verta/verta/_cli/deployment/list.py +++ b/client/verta/verta/_cli/deployment/list.py @@ -28,7 +28,7 @@ def lst_endpoint(workspace): endpoints = client.endpoints if workspace: endpoints = endpoints.with_workspace(workspace) - table_data = [["PATH", "ID", "DATE UPDATED"]] + list( + table_data = [["PATH", "ID", "DATE CREATED"]] + list( sorted( map(lambda endpoint: endpoint._get_info_list_by_id(), endpoints), key=lambda data: data[0], diff --git a/client/verta/verta/endpoint/_endpoint.py b/client/verta/verta/endpoint/_endpoint.py index 59b76f8c28..fa87508780 100644 --- a/client/verta/verta/endpoint/_endpoint.py +++ b/client/verta/verta/endpoint/_endpoint.py @@ -76,7 +76,6 @@ def __repr__(self): "status: {}".format(status["status"]), "Kafka settings: {}".format(self.kafka_settings), "date created: {}".format(data["date_created"]), - "date updated: {}".format(data["date_updated"]), "stage's date created: {}".format(status["date_created"]), "stage's date updated: {}".format(status["date_updated"]), "components: {}".format(json.dumps(status["components"], indent=4)), @@ -126,8 +125,8 @@ def get_current_build(self): def _path(self, data): return data["creator_request"]["path"] - def _date_updated(self, data): - return data["date_updated"] + def _date_created(self, data): + return data["date_created"] @classmethod def _create( @@ -202,7 +201,7 @@ def _get_by_id(cls, conn, conf, workspace, id): def _get_info_list_by_id(self): data = Endpoint._get_json_by_id(self._conn, self.workspace, self.id) - return [self._path(data), str(self.id), self._date_updated(data)] + return [self._path(data), str(self.id), self._date_created(data)] @classmethod def _get_json_by_id(cls, conn, workspace, id):