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

Remove fetching all job tags #2503

Merged
merged 2 commits into from
Dec 28, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.D/2503.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `client.job.tags()` method from SDK and `neuro job tags` command from CLI.
16 changes: 0 additions & 16 deletions neuro-cli/src/neuro_cli/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import async_timeout
import click
from dateutil.parser import isoparse
from rich.table import Table
from yarl import URL

from neuro_sdk import (
Expand Down Expand Up @@ -518,20 +517,6 @@ async def bump_life_span(root: Root, job: str, additional_life_span: str) -> Non
)


@command(deprecated=True, hidden=True)
async def tags(root: Root) -> None:
"""
List all tags submitted by the user.
"""
res = await root.client.jobs.tags()
table = Table.grid()
table.add_column("")
for item in res:
table.add_row(item)
with root.pager():
root.print(table)


@command()
@click.argument("job", type=JOB)
async def browse(root: Root, job: str) -> None:
Expand Down Expand Up @@ -1137,7 +1122,6 @@ async def generate_run_command(root: Root, job: str) -> None:
job.add_command(generate_run_command)
job.add_command(ls)
job.add_command(status)
job.add_command(tags)
job.add_command(exec)
job.add_command(port_forward)
job.add_command(logs)
Expand Down
30 changes: 0 additions & 30 deletions neuro-cli/tests/e2e/test_e2e_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,36 +191,6 @@ def test_job_description(helper: Helper) -> None:
helper.kill_job(job_id, wait=False)


@pytest.mark.skip(reason="'neuro job tags' is slow and will be deprecated")
@pytest.mark.e2e
def test_job_tags(helper: Helper) -> None:
tags = [f"test-tag:{uuid4()}", "test-tag:common"]
tag_options = [key for pair in [("--tag", t) for t in tags] for key in pair]

command = "sleep 10m"
captured = helper.run_cli(
[
"job",
"run",
*tag_options,
"--no-wait-start",
UBUNTU_IMAGE_NAME,
"--",
command,
]
)
match = re.match("Job ID: (.+)", captured.out)
assert match is not None
job_id = match.group(1)

captured = helper.run_cli(["-q", "ps", *tag_options])
assert job_id in captured.out

captured = helper.run_cli(["job", "tags"])
tags_listed = [tag.strip() for tag in captured.out.split("\n")]
assert set(tags) <= set(tags_listed)


@pytest.mark.e2e
def test_job_filter_by_date_range(helper: Helper) -> None:
captured = helper.run_cli(
Expand Down
6 changes: 0 additions & 6 deletions neuro-sdk/docs/jobs_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,6 @@ Jobs

:return: :class:`JobDescription` instance with job status details.

.. comethod:: tags() -> List[str]

Get the list of all tags submitted by the user.

:return: :class:`List[str]` list of tags.

.. comethod:: top(id: str, *, \
cluster_name: Optional[str] = None, \
) -> AsyncContextManager[AsyncIterator[JobTelemetry]]
Expand Down
8 changes: 0 additions & 8 deletions neuro-sdk/src/neuro_sdk/_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
AsyncIterator,
Dict,
Iterable,
List,
Mapping,
Optional,
Sequence,
Expand Down Expand Up @@ -542,13 +541,6 @@ async def status(self, id: str) -> JobDescription:
ret = await resp.json()
return _job_description_from_api(ret, self._parse)

async def tags(self) -> List[str]:
url = self._config.api_url / "tags"
auth = await self._config._api_auth()
async with self._core.request("GET", url, auth=auth) as resp:
ret = await resp.json()
return ret["tags"]

@asyncgeneratorcontextmanager
async def top(
self, id: str, *, cluster_name: Optional[str] = None
Expand Down