Skip to content

Commit

Permalink
Work on
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed May 12, 2020
2 parents 3ec4317 + 1057b68 commit 26b577f
Show file tree
Hide file tree
Showing 30 changed files with 614 additions and 244 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.D/1459.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the `--restart` option to `neuro run` and `neuro submit` and API.
1 change: 0 additions & 1 deletion CHANGELOG.D/1461.feature

This file was deleted.

1 change: 0 additions & 1 deletion CHANGELOG.D/1470.bugfix

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.D/1473.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API: `Jobs.list()` is an asynchronous generator now.
1 change: 1 addition & 0 deletions CHANGELOG.D/1477.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`neuro ps` now outputs local date instead of UTC and interprets `--since` and `--until` options as local time if the timezone is not specified.
1 change: 1 addition & 0 deletions CHANGELOG.D/1485.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
autocomplete job name/id
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@

[comment]: # (towncrier release notes start)

Neuromation 20.4.15 (2020-04-15)
================================

Features
--------


- Added `--since` and `--until` options to `neuro ps`. ([#1461](https://github.com/neuromation/platform-api-clients/issues/1461))


Bugfixes
--------


- Make exit code of `job run` command more reliable. ([#1470](https://github.com/neuromation/platform-api-clients/issues/1470))


Neuromation 20.4.6 (2020-04-06)
===============================

Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ Name | Description|
|_--entrypoint TEXT_|Executable entrypoint in the container \(note that it overwrites `ENTRYPOINT` and `CMD` instructions of the docker image)|
|_\-e, --env VAR=VAL_|Set environment variable in container Use multiple options to define more than one variable|
|_\--env-file PATH_|File with environment variables to pass|
|_\--restart \[never | on-failure | always]_|Restart policy to apply when a job exits \[default: never]|
|_\--life-span TIMEDELTA_|Optional job run-time limit in the format '1d2h3m4s' \(some parts may be missing). Set '0' to disable. Default value '1d' can be changed in the user config.|
|_\--wait-start / --no-wait-start_|Wait for a job start or failure \[default: True]|
|_\--pass-config / --no-pass-config_|Upload neuro config to the job \[default: False]|
Expand Down Expand Up @@ -498,6 +499,7 @@ Name | Description|
|_--entrypoint TEXT_|Executable entrypoint in the container \(note that it overwrites `ENTRYPOINT` and `CMD` instructions of the docker image)|
|_\-e, --env VAR=VAL_|Set environment variable in container Use multiple options to define more than one variable|
|_\--env-file PATH_|File with environment variables to pass|
|_\--restart \[never | on-failure | always]_|Restart policy to apply when a job exits \[default: never]|
|_\--life-span TIMEDELTA_|Optional job run-time limit in the format '1d2h3m4s' \(some parts may be missing). Set '0' to disable. Default value '1d' can be changed in the user config.|
|_\--wait-start / --no-wait-start_|Wait for a job start or failure \[default: True]|
|_\--pass-config / --no-pass-config_|Upload neuro config to the job \[default: False]|
Expand Down Expand Up @@ -619,7 +621,7 @@ neuro exec --no-tty my-job ls -l
Name | Description|
|----|------------|
|_\-t, --tty / -T, --no-tty_|Allocate virtual tty. Useful for interactive jobs.|
|_\--no-key-check_|Disable host key checks. Should be used with caution.|
|_\-i, --interactive / -I, --no-interactive_|Keep STDIN open even if not attached. On for tty by default, false otherwise.|
|_--timeout FLOAT_|Maximum allowed time for executing the command, 0 for no timeout \[default: 0]|
|_--help_|Show this message and exit.|

Expand Down Expand Up @@ -933,7 +935,7 @@ Name | Description|
|_\-u, --update_|Copy only when the SOURCE file is newer than the destination file or when the destination file is missing.|
|_--exclude_|Exclude files and directories that match the specified pattern. The default can be changed using the storage.cp\-exclude configuration variable documented in "neuro help user-config"|
|_--include_|Don't exclude files and directories that match the specified pattern. The default can be changed using the storage.cp\-exclude configuration variable documented in "neuro help user-config"|
|_\-p, --progress / -P, --no-progress_|Show progress, on by default.|
|_\-p, --progress / -P, --no-progress_|Show progress, on by default in TTY mode, off otherwise.|
|_--help_|Show this message and exit.|


Expand Down Expand Up @@ -1854,6 +1856,7 @@ Name | Description|
|_--entrypoint TEXT_|Executable entrypoint in the container \(note that it overwrites `ENTRYPOINT` and `CMD` instructions of the docker image)|
|_\-e, --env VAR=VAL_|Set environment variable in container Use multiple options to define more than one variable|
|_\--env-file PATH_|File with environment variables to pass|
|_\--restart \[never | on-failure | always]_|Restart policy to apply when a job exits \[default: never]|
|_\--life-span TIMEDELTA_|Optional job run-time limit in the format '1d2h3m4s' \(some parts may be missing). Set '0' to disable. Default value '1d' can be changed in the user config.|
|_\--wait-start / --no-wait-start_|Wait for a job start or failure \[default: True]|
|_\--pass-config / --no-pass-config_|Upload neuro config to the job \[default: False]|
Expand Down Expand Up @@ -1912,6 +1915,7 @@ Name | Description|
|_--entrypoint TEXT_|Executable entrypoint in the container \(note that it overwrites `ENTRYPOINT` and `CMD` instructions of the docker image)|
|_\-e, --env VAR=VAL_|Set environment variable in container Use multiple options to define more than one variable|
|_\--env-file PATH_|File with environment variables to pass|
|_\--restart \[never | on-failure | always]_|Restart policy to apply when a job exits \[default: never]|
|_\--life-span TIMEDELTA_|Optional job run-time limit in the format '1d2h3m4s' \(some parts may be missing). Set '0' to disable. Default value '1d' can be changed in the user config.|
|_\--wait-start / --no-wait-start_|Wait for a job start or failure \[default: True]|
|_\--pass-config / --no-pass-config_|Upload neuro config to the job \[default: False]|
Expand Down Expand Up @@ -2014,7 +2018,7 @@ neuro exec --no-tty my-job ls -l
Name | Description|
|----|------------|
|_\-t, --tty / -T, --no-tty_|Allocate virtual tty. Useful for interactive jobs.|
|_\--no-key-check_|Disable host key checks. Should be used with caution.|
|_\-i, --interactive / -I, --no-interactive_|Keep STDIN open even if not attached. On for tty by default, false otherwise.|
|_--timeout FLOAT_|Maximum allowed time for executing the command, 0 for no timeout \[default: 0]|
|_--help_|Show this message and exit.|

Expand Down Expand Up @@ -2236,7 +2240,7 @@ Name | Description|
|_\-u, --update_|Copy only when the SOURCE file is newer than the destination file or when the destination file is missing.|
|_--exclude_|Exclude files and directories that match the specified pattern. The default can be changed using the storage.cp\-exclude configuration variable documented in "neuro help user-config"|
|_--include_|Don't exclude files and directories that match the specified pattern. The default can be changed using the storage.cp\-exclude configuration variable documented in "neuro help user-config"|
|_\-p, --progress / -P, --no-progress_|Show progress, on by default.|
|_\-p, --progress / -P, --no-progress_|Show progress, on by default in TTY mode, off otherwise.|
|_--help_|Show this message and exit.|


Expand Down
3 changes: 2 additions & 1 deletion docs/functions_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ API functions
The usage is::

async with neuromation.api.get() as client:
ret = await client.jobs.list()
async for job in client.jobs.list():
print(job.id)

See :meth:`Factory.get` for optional function arguments meaning.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ configuration file::
from neuromation import api

async with api.get() as client:
jobs = await client.jobs.list()
jobs = [job async for job in client.jobs.list()]


The example above instantiates a ``client`` object in *async context manager* and
Expand Down
47 changes: 39 additions & 8 deletions docs/jobs_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ Jobs
:param str id: job :attr:`~JobDescription.id` to kill.

.. comethod:: list(*, statuses: Iterable[JobStatus] = (), \
name: str = "" \
name: Optional[str] = None, \
tags: Sequence[str] = (), \
owners: Iterable[str] = (),
) -> List[JobDescription]
owners: Iterable[str] = (), \
since: Optional[datetime] = None, \
until: Optional[datetime] = None, \
reverse: bool = False, \
) -> AsyncIterator[JobDescription]

List user jobs, all scheduled, running and finished jobs by default.

Expand All @@ -68,12 +71,13 @@ Jobs

:param str name: Filter jobs by :attr:`~JobDescription.name` (exact match).

Empty string means that no filter is applied (default).
Empty string or ``None`` means that no filter is applied (default).

:param str name: Filter jobs by :attr:`~JobDescription.tags`. Retrieves all
jobs submitted with at least one tag from the specified list.
:param ~typing.Sequence[str] tags: filter jobs by :attr:`~JobDescription.tags`.

Empty list means that no filter is applied (default).
Retrieves only jobs submitted with all tags from the specified list.

Empty list means that no filter is applied (default).

:param ~typing.Iterable[str] owners: filter jobs by their owners.

Expand All @@ -84,7 +88,34 @@ Jobs
No owners filter is applied if the iterable
is empty.

:return: a :class:`list` of :class:`JobDescription` objects.
:param ~datetime.datetime since: filter jobs by their creation date.

Retrieves only jobs submitted after the specified date
(including) if it is not ``None``. If the parameter
is a naive datetime object, it represents local time.

``None`` means that no filter is applied (default).

:param ~datetime.datetime until: filter jobs by their creation date.

Retrieves only jobs submitted before the specified date
(including) if it is not ``None``. If the parameter
is a naive datetime object, it represents local time.

``None`` means that no filter is applied (default).

:param bool reverse: iterate jobs in the reverse order.

If *reverse* is false (default) the jobs are iterated in
the order of their creation date, from earlier to later.
If *reverse* is true, they are iterated in the reverse order,
from later to earlier.

:param int limit: limit the number of jobs.

``None`` means no limit (default).

:return: asynchronous iterator which emits :class:`JobDescription` objects.


.. comethod:: monitor(id: str) -> AsyncIterator[bytes]
Expand Down
2 changes: 1 addition & 1 deletion neuromation/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "20.4.6"
__version__ = "20.4.15"
2 changes: 2 additions & 0 deletions neuromation/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
Container,
HTTPPort,
JobDescription,
JobRestartPolicy,
Jobs,
JobStatus,
JobStatusHistory,
Expand All @@ -65,6 +66,7 @@
"CONFIG_ENV_NAME",
"Jobs",
"JobDescription",
"JobRestartPolicy",
"JobStatus",
"JobStatusHistory",
"JobTelemetry",
Expand Down
2 changes: 1 addition & 1 deletion neuromation/api/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async def pull(
raise AuthorizationError(f"Access denied {remote}") from error
raise # pragma: no cover

await self._docker.images.tag(repo, local)
await self._docker.images.tag(repo, str(local))

return local

Expand Down
Loading

0 comments on commit 26b577f

Please sign in to comment.