Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove endpoint date_updated #3711

Merged
merged 5 commits into from Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 15 additions & 15 deletions client/verta/tests/test_cli/test_endpoint.py
Expand Up @@ -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: <endpoint not deployed>" 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: <endpoint not deployed>")
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")
Comment on lines -98 to +109
Copy link
Contributor Author

@liuverta liuverta Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test (and the other test), I'm just

  • defining a closure to check the output using str.startswith() instead of in
  • using f-strings
  • removing "date updated"


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:
Expand Down
27 changes: 13 additions & 14 deletions client/verta/tests/test_endpoint/test_endpoint.py
Expand Up @@ -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: <endpoint not deployed>" 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: <endpoint not deployed>")
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"
Expand Down
2 changes: 1 addition & 1 deletion client/verta/verta/_cli/deployment/list.py
Expand Up @@ -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(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now:

% verta deployment list endpoint
got VERTA_HOST from environment
got VERTA_EMAIL from environment
got VERTA_DEV_KEY from environment
connection successfully established

PATH             ID   DATE CREATED               
/simple-deploy   1    2023-03-29T20:52:42.000Z   

sorted(
map(lambda endpoint: endpoint._get_info_list_by_id(), endpoints),
key=lambda data: data[0],
Expand Down
7 changes: 3 additions & 4 deletions client/verta/verta/endpoint/_endpoint.py
Expand Up @@ -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)),
Expand Down Expand Up @@ -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"]
Comment on lines -129 to -130
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched the codebase for \._date_updated and it was only being used in this module, below.

def _date_created(self, data):
return data["date_created"]

@classmethod
def _create(
Expand Down Expand Up @@ -202,7 +201,7 @@ def _get_by_id(cls, conn, conf, workspace, id):

def _get_info_list_by_id(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched the codebase for \._get_info_list_by_id and it's only being used in _cli/deployment/list.py.

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):
Expand Down