Skip to main content

Neuromation Platform API client

Project description

codecov

Table of Contents

Preface

Welcome to Neuromation API Python client. Package ship command line tool called neuro. With neuro you can:

neuro

Usage:

neuro [OPTIONS] COMMAND [ARGS]...

Options:

Name Description
-v, --verbose Enable verbose mode.
--neuromation-config PATH Path to config file.
--show-traceback Show python traceback on error, useful for debugging the tool.
--color [yes | no | auto] Color mode.
--disable-pypi-version-check Don't periodically check PyPI to determine whether a new version of Neuromation CLI is available for download.
--network-timeout FLOAT Network read timeout, seconds.
--version Show the version and exit.
--help Show this message and exit.

Command Groups:

Usage Description
neuro job Job operations
neuro storage Storage operations
neuro image Container image operations
neuro config Client configuration
neuro completion Output shell completion code

Commands:

Usage Description
neuro help Get help on a command
neuro run Run an image with predefined configuration
neuro submit Submit an image to run on the cluster
neuro ps List all jobs
neuro status Display status of a job
neuro exec Execute command in a running job
neuro port-forward Forward port(s) of a running job to local port(s)
neuro logs Print the logs for a container
neuro kill Kill job(s)
neuro top Display GPU/CPU/Memory usage
neuro login Log into Neuromation Platform
neuro logout Log out
neuro cp Copy files and directories
neuro ls List directory contents
neuro rm Remove files or directories
neuro mkdir Make directories
neuro mv Move or rename files and directories
neuro images List images
neuro push Push an image to platform registry
neuro pull Pull an image from platform registry
neuro share Shares resource specified by URI to a USER with PERMISSION Examples: neuro share...

neuro job

Job operations.

Usage:

neuro job [OPTIONS] COMMAND [ARGS]...

Options:

Name Description
--help Show this message and exit.

Commands:

Usage Description
neuro job run Run an image with predefined configuration
neuro job submit Submit an image to run on the cluster
neuro job ls List all jobs
neuro job status Display status of a job
neuro job exec Execute command in a running job
neuro job port-forward Forward port(s) of a running job to local port(s)
neuro job logs Print the logs for a container
neuro job kill Kill job(s)
neuro job top Display GPU/CPU/Memory usage

neuro job run

Run an image with predefined configuration.

IMAGE container image name.

CMD list will be passed as commands to model container.

Usage:

neuro job run [OPTIONS] IMAGE [CMD]...

Examples:

# Starts a container pytorch:latest with two paths mounted.
# Directory storage://<USERNAME> is mounted as /var/storage/home in read-write mode,
# storage://neuromation is mounted as :/var/storage/neuromation as read-only.
neuro run pytorch:latest --volume=HOME

Options:

Name Description
-s, --preset PRESET Predefined job profile [default: gpu-small]
-x, --extshm / -X, --no-extshm Request extended '/dev/shm' space [default: True]
--http INTEGER Enable HTTP port forwarding to container [default: 80]
--http-auth / --no-http-auth Enable HTTP authentication for forwarded HTTP port [default: True]
-p, --preemptible / -P, --non-preemptible Run job on a lower-cost preemptible instance [default: True]
-n, --name NAME Optional job name
-d, --description DESC Add optional description in free format
-q, --quiet Run command in quiet mode (print only job id)
-v, --volume MOUNT Mounts directory from vault into container. Use multiple options to mount more than one volume. --volume=HOME is an alias for storage://~:/var/storage/home:rw and storage://neuromation:/var/storage/neuromation:ro
-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
--wait-start / --no-wait-start Wait for a job start or failure [default: True]
--help Show this message and exit.

neuro job submit

Submit an image to run on the cluster.

IMAGE container image name.

CMD list will be passed as commands to model container.

Usage:

neuro job submit [OPTIONS] IMAGE [CMD]...

Examples:

# Starts a container pytorch:latest with two paths mounted. Directory /q1/
# is mounted in read only mode to /qm directory within container.
# Directory /mod mounted to /mod directory in read-write mode.
neuro submit --volume storage:/q1:/qm:ro --volume storage:/mod:/mod:rw pytorch:latest

Options:

Name Description
-g, --gpu NUMBER Number of GPUs to request [default: 0]
--gpu-model MODEL GPU to use [default: nvidia-tesla-k80]
-c, --cpu NUMBER Number of CPUs to request [default: 0.1]
-m, --memory AMOUNT Memory amount to request [default: 1G]
-x, --extshm / -X, --no-extshm Request extended '/dev/shm' space [default: True]
--http INTEGER Enable HTTP port forwarding to container
--http-auth / --no-http-auth Enable HTTP authentication for forwarded HTTP port [default: True]
-p, --preemptible / -P, --non-preemptible Run job on a lower-cost preemptible instance [default: True]
-n, --name NAME Optional job name
-d, --description DESC Optional job description in free format
-q, --quiet Run command in quiet mode (print only job id)
-v, --volume MOUNT Mounts directory from vault into container. Use multiple options to mount more than one volume. --volume=HOME is an alias for storage://~:/var/storage/home:rw and storage://neuromation:/var/storage/neuromation:ro
-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
--wait-start / --no-wait-start Wait for a job start or failure [default: True]
--help Show this message and exit.

neuro job ls

List all jobs.

Usage:

neuro job ls [OPTIONS]

Examples:

neuro ps --name my-experiments-v1 --status all
neuro ps --description=my favourite job
neuro ps -s failed -s succeeded -q

Options:

Name Description
-s, --status [pending | running | succeeded | failed | all] Filter out job by status (multiple option)
-n, --name NAME Filter out jobs by name
-d, --description DESCRIPTION Filter out jobs by description (exact match)
-q, --quiet Print only Job ID
-w, --wide Do not cut long lines for terminal width
--help Show this message and exit.

neuro job status

Display status of a job.

Usage:

neuro job status [OPTIONS] JOB

Options:

Name Description
--help Show this message and exit.

neuro job exec

Execute command in a running job.

Usage:

neuro job exec [OPTIONS] JOB CMD...

Options:

Name Description
-t, --tty Allocate virtual tty. Useful for interactive jobs.
--no-key-check Disable host key checks. Should be used with caution.
--help Show this message and exit.

neuro job port-forward

Forward port(s) of a running job to local port(s).

Usage:

neuro job port-forward [OPTIONS] JOB [LOCAL_REMOTE_PORT]...

Options:

Name Description
--no-key-check Disable host key checks. Should be used with caution.
--help Show this message and exit.

neuro job logs

Print the logs for a container.

Usage:

neuro job logs [OPTIONS] JOB

Options:

Name Description
--help Show this message and exit.

neuro job kill

Kill job(s).

Usage:

neuro job kill [OPTIONS] JOBS...

Options:

Name Description
--help Show this message and exit.

neuro job top

Display GPU/CPU/Memory usage.

Usage:

neuro job top [OPTIONS] JOB

Options:

Name Description
--help Show this message and exit.

neuro storage

Storage operations.

Usage:

neuro storage [OPTIONS] COMMAND [ARGS]...

Options:

Name Description
--help Show this message and exit.

Commands:

Usage Description
neuro storage cp Copy files and directories
neuro storage ls List directory contents
neuro storage rm Remove files or directories
neuro storage mkdir Make directories
neuro storage mv Move or rename files and directories

neuro storage cp

Copy files and directories.

Either SOURCE or DESTINATION should have storage:// scheme. If scheme is
omitted, file:// scheme is assumed.

Usage:

neuro storage cp [OPTIONS] SOURCE DESTINATION

Examples:

# copy local file ./foo into remote storage root
neuro cp ./foo storage:///
neuro cp ./foo storage:/

# download remote file foo into local file foo with
# explicit file:// scheme set
neuro cp storage:///foo file:///foo

Options:

Name Description
-r, --recursive Recursive copy, off by default
-p, --progress Show progress, off by default
--help Show this message and exit.

neuro storage ls

List directory contents.

By default PATH is equal user`s home dir (storage:)

Usage:

neuro storage ls [OPTIONS] [PATH]

Options:

Name Description
-h, --human-readable with -l print human readable sizes (e.g., 2K, 540M)
-l use a long listing format
--sort [name | size | time] sort by given field, default is name
--help Show this message and exit.

neuro storage rm

Remove files or directories.

Usage:

neuro storage rm [OPTIONS] PATH

Examples:

neuro rm storage:///foo/bar/
neuro rm storage:/foo/bar/
neuro rm storage://{username}/foo/bar/

Options:

Name Description
--help Show this message and exit.

neuro storage mkdir

Make directories.

Usage:

neuro storage mkdir [OPTIONS] PATH

Options:

Name Description
--help Show this message and exit.

neuro storage mv

Move or rename files and directories.

SOURCE must contain path to the file or directory existing on the storage,
and DESTINATION must contain the full path to the target file or directory.

Usage:

neuro storage mv [OPTIONS] SOURCE DESTINATION

Examples:

# move or rename remote file
neuro mv storage://{username}/foo.txt storage://{username}/bar.txt
neuro mv storage://{username}/foo.txt storage://~/bar/baz/foo.txt

# move or rename remote directory
neuro mv storage://{username}/foo/ storage://{username}/bar/
neuro mv storage://{username}/foo/ storage://{username}/bar/baz/foo/

Options:

Name Description
--help Show this message and exit.

neuro image

Container image operations.

Usage:

neuro image [OPTIONS] COMMAND [ARGS]...

Options:

Name Description
--help Show this message and exit.

Commands:

Usage Description
neuro image ls List images
neuro image push Push an image to platform registry
neuro image pull Pull an image from platform registry

neuro image ls

List images.

Usage:

neuro image ls [OPTIONS]

Options:

Name Description
--help Show this message and exit.

neuro image push

Push an image to platform registry.

Remote image must be URL with image:// scheme. Image names can contains tag.
If tags not specified 'latest' will be used as value.

Usage:

neuro image push [OPTIONS] IMAGE_NAME [REMOTE_IMAGE_NAME]

Examples:

neuro push myimage
neuro push alpine:latest image:my-alpine:production
neuro push alpine image://myfriend/alpine:shared

Options:

Name Description
-q, --quiet
--help Show this message and exit.

neuro image pull

Pull an image from platform registry.

Remote image name must be URL with image:// scheme. Image names can contain
tag.

Usage:

neuro image pull [OPTIONS] IMAGE_NAME [LOCAL_IMAGE_NAME]

Examples:

neuro pull image:myimage
neuro pull image://myfriend/alpine:shared
neuro pull image://username/my-alpine:production alpine:from-registry

Options:

Name Description
-q, --quiet
--help Show this message and exit.

neuro config

Client configuration.

Usage:

neuro config [OPTIONS] COMMAND [ARGS]...

Options:

Name Description
--help Show this message and exit.

Commands:

Usage Description
neuro config login Log into Neuromation Platform
neuro config login-with-token Log into Neuromation Platform with token
neuro config show Print current settings
neuro config show-token Print current authorization token
neuro config docker Configure docker client for working with platform registry
neuro config logout Log out

neuro config login

Log into Neuromation Platform.

URL is a platform entrypoint URL.

Usage:

neuro config login [OPTIONS] [URL]

Options:

Name Description
--help Show this message and exit.

neuro config login-with-token

Log into Neuromation Platform with token.

TOKEN is authentication token provided by Neuromation administration team.
URL is a platform entrypoint URL.

Usage:

neuro config login-with-token [OPTIONS] TOKEN [URL]

Options:

Name Description
--help Show this message and exit.

neuro config show

Print current settings.

Usage:

neuro config show [OPTIONS]

Options:

Name Description
--help Show this message and exit.

neuro config show-token

Print current authorization token.

Usage:

neuro config show-token [OPTIONS]

Options:

Name Description
--help Show this message and exit.

neuro config docker

Configure docker client for working with platform registry

Usage:

neuro config docker [OPTIONS]

Options:

Name Description
--docker-config PATH Specifies the location of the Docker client configuration files
--help Show this message and exit.

neuro config logout

Log out.

Usage:

neuro config logout [OPTIONS]

Options:

Name Description
--help Show this message and exit.

neuro completion

Output shell completion code.

Usage:

neuro completion [OPTIONS] COMMAND [ARGS]...

Options:

Name Description
--help Show this message and exit.

Commands:

Usage Description
neuro completion generate Provide an instruction for shell completion generation
neuro completion patch Automatically patch shell configuration profile to enable completion

neuro completion generate

Provide an instruction for shell completion generation.

Usage:

neuro completion generate [OPTIONS] [bash|zsh]

Options:

Name Description
--help Show this message and exit.

neuro completion patch

Automatically patch shell configuration profile to enable completion

Usage:

neuro completion patch [OPTIONS] [bash|zsh]

Options:

Name Description
--help Show this message and exit.

neuro help

Get help on a command.

Usage:

neuro help [OPTIONS] [COMMAND]...

Options:

Name Description
--help Show this message and exit.

neuro run

Run an image with predefined configuration.

IMAGE container image name.

CMD list will be passed as commands to model container.

Usage:

neuro run [OPTIONS] IMAGE [CMD]...

Examples:

# Starts a container pytorch:latest with two paths mounted.
# Directory storage://<USERNAME> is mounted as /var/storage/home in read-write mode,
# storage://neuromation is mounted as :/var/storage/neuromation as read-only.
neuro run pytorch:latest --volume=HOME

Options:

Name Description
-s, --preset PRESET Predefined job profile [default: gpu-small]
-x, --extshm / -X, --no-extshm Request extended '/dev/shm' space [default: True]
--http INTEGER Enable HTTP port forwarding to container [default: 80]
--http-auth / --no-http-auth Enable HTTP authentication for forwarded HTTP port [default: True]
-p, --preemptible / -P, --non-preemptible Run job on a lower-cost preemptible instance [default: True]
-n, --name NAME Optional job name
-d, --description DESC Add optional description in free format
-q, --quiet Run command in quiet mode (print only job id)
-v, --volume MOUNT Mounts directory from vault into container. Use multiple options to mount more than one volume. --volume=HOME is an alias for storage://~:/var/storage/home:rw and storage://neuromation:/var/storage/neuromation:ro
-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
--wait-start / --no-wait-start Wait for a job start or failure [default: True]
--help Show this message and exit.

neuro submit

Submit an image to run on the cluster.

IMAGE container image name.

CMD list will be passed as commands to model container.

Usage:

neuro submit [OPTIONS] IMAGE [CMD]...

Examples:

# Starts a container pytorch:latest with two paths mounted. Directory /q1/
# is mounted in read only mode to /qm directory within container.
# Directory /mod mounted to /mod directory in read-write mode.
neuro submit --volume storage:/q1:/qm:ro --volume storage:/mod:/mod:rw pytorch:latest

Options:

Name Description
-g, --gpu NUMBER Number of GPUs to request [default: 0]
--gpu-model MODEL GPU to use [default: nvidia-tesla-k80]
-c, --cpu NUMBER Number of CPUs to request [default: 0.1]
-m, --memory AMOUNT Memory amount to request [default: 1G]
-x, --extshm / -X, --no-extshm Request extended '/dev/shm' space [default: True]
--http INTEGER Enable HTTP port forwarding to container
--http-auth / --no-http-auth Enable HTTP authentication for forwarded HTTP port [default: True]
-p, --preemptible / -P, --non-preemptible Run job on a lower-cost preemptible instance [default: True]
-n, --name NAME Optional job name
-d, --description DESC Optional job description in free format
-q, --quiet Run command in quiet mode (print only job id)
-v, --volume MOUNT Mounts directory from vault into container. Use multiple options to mount more than one volume. --volume=HOME is an alias for storage://~:/var/storage/home:rw and storage://neuromation:/var/storage/neuromation:ro
-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
--wait-start / --no-wait-start Wait for a job start or failure [default: True]
--help Show this message and exit.

neuro ps

List all jobs.

Usage:

neuro ps [OPTIONS]

Examples:

neuro ps --name my-experiments-v1 --status all
neuro ps --description=my favourite job
neuro ps -s failed -s succeeded -q

Options:

Name Description
-s, --status [pending | running | succeeded | failed | all] Filter out job by status (multiple option)
-n, --name NAME Filter out jobs by name
-d, --description DESCRIPTION Filter out jobs by description (exact match)
-q, --quiet Print only Job ID
-w, --wide Do not cut long lines for terminal width
--help Show this message and exit.

neuro status

Display status of a job.

Usage:

neuro status [OPTIONS] JOB

Options:

Name Description
--help Show this message and exit.

neuro exec

Execute command in a running job.

Usage:

neuro exec [OPTIONS] JOB CMD...

Options:

Name Description
-t, --tty Allocate virtual tty. Useful for interactive jobs.
--no-key-check Disable host key checks. Should be used with caution.
--help Show this message and exit.

neuro port-forward

Forward port(s) of a running job to local port(s).

Usage:

neuro port-forward [OPTIONS] JOB [LOCAL_REMOTE_PORT]...

Options:

Name Description
--no-key-check Disable host key checks. Should be used with caution.
--help Show this message and exit.

neuro logs

Print the logs for a container.

Usage:

neuro logs [OPTIONS] JOB

Options:

Name Description
--help Show this message and exit.

neuro kill

Kill job(s).

Usage:

neuro kill [OPTIONS] JOBS...

Options:

Name Description
--help Show this message and exit.

neuro top

Display GPU/CPU/Memory usage.

Usage:

neuro top [OPTIONS] JOB

Options:

Name Description
--help Show this message and exit.

neuro login

Log into Neuromation Platform.

URL is a platform entrypoint URL.

Usage:

neuro login [OPTIONS] [URL]

Options:

Name Description
--help Show this message and exit.

neuro logout

Log out.

Usage:

neuro logout [OPTIONS]

Options:

Name Description
--help Show this message and exit.

neuro cp

Copy files and directories.

Either SOURCE or DESTINATION should have storage:// scheme. If scheme is
omitted, file:// scheme is assumed.

Usage:

neuro cp [OPTIONS] SOURCE DESTINATION

Examples:

# copy local file ./foo into remote storage root
neuro cp ./foo storage:///
neuro cp ./foo storage:/

# download remote file foo into local file foo with
# explicit file:// scheme set
neuro cp storage:///foo file:///foo

Options:

Name Description
-r, --recursive Recursive copy, off by default
-p, --progress Show progress, off by default
--help Show this message and exit.

neuro ls

List directory contents.

By default PATH is equal user`s home dir (storage:)

Usage:

neuro ls [OPTIONS] [PATH]

Options:

Name Description
-h, --human-readable with -l print human readable sizes (e.g., 2K, 540M)
-l use a long listing format
--sort [name | size | time] sort by given field, default is name
--help Show this message and exit.

neuro rm

Remove files or directories.

Usage:

neuro rm [OPTIONS] PATH

Examples:

neuro rm storage:///foo/bar/
neuro rm storage:/foo/bar/
neuro rm storage://{username}/foo/bar/

Options:

Name Description
--help Show this message and exit.

neuro mkdir

Make directories.

Usage:

neuro mkdir [OPTIONS] PATH

Options:

Name Description
--help Show this message and exit.

neuro mv

Move or rename files and directories.

SOURCE must contain path to the file or directory existing on the storage,
and DESTINATION must contain the full path to the target file or directory.

Usage:

neuro mv [OPTIONS] SOURCE DESTINATION

Examples:

# move or rename remote file
neuro mv storage://{username}/foo.txt storage://{username}/bar.txt
neuro mv storage://{username}/foo.txt storage://~/bar/baz/foo.txt

# move or rename remote directory
neuro mv storage://{username}/foo/ storage://{username}/bar/
neuro mv storage://{username}/foo/ storage://{username}/bar/baz/foo/

Options:

Name Description
--help Show this message and exit.

neuro images

List images.

Usage:

neuro images [OPTIONS]

Options:

Name Description
--help Show this message and exit.

neuro push

Push an image to platform registry.

Remote image must be URL with image:// scheme. Image names can contains tag.
If tags not specified 'latest' will be used as value.

Usage:

neuro push [OPTIONS] IMAGE_NAME [REMOTE_IMAGE_NAME]

Examples:

neuro push myimage
neuro push alpine:latest image:my-alpine:production
neuro push alpine image://myfriend/alpine:shared

Options:

Name Description
-q, --quiet
--help Show this message and exit.

neuro pull

Pull an image from platform registry.

Remote image name must be URL with image:// scheme. Image names can contain
tag.

Usage:

neuro pull [OPTIONS] IMAGE_NAME [LOCAL_IMAGE_NAME]

Examples:

neuro pull image:myimage
neuro pull image://myfriend/alpine:shared
neuro pull image://username/my-alpine:production alpine:from-registry

Options:

Name Description
-q, --quiet
--help Show this message and exit.

neuro share

Shares resource specified by URI to a USER with PERMISSION

Usage:

neuro share [OPTIONS] URI USER [read|write|manage]

Examples:

neuro share storage:///sample_data/ alice manage
neuro share image:resnet50 bob read
neuro share job:///my_job_id alice write

Options:

Name Description
--help Show this message and exit.

Api

TODO

Contributing

git clone https://github.com/neuromation/platform-api-clients.git
cd platform-api-clients/python

Before you begin, it is recommended to have clean virtual environment installed:

python -m venv .env
source .env/bin/activate

Development flow:

  • Install dependencies: make init
  • Run tests: make test
  • Lint: make lint
  • Publish to pypi: make publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

neuromation-19.4.23-py3-none-any.whl (70.2 kB view details)

Uploaded Python 3

File details

Details for the file neuromation-19.4.23-py3-none-any.whl.

File metadata

  • Download URL: neuromation-19.4.23-py3-none-any.whl
  • Upload date:
  • Size: 70.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.1

File hashes

Hashes for neuromation-19.4.23-py3-none-any.whl
Algorithm Hash digest
SHA256 0c8c721d841ae46195b0270e3564ce1211455b5fbbcc8c68a7ad0719423c3c89
MD5 c24154c83002609ed38ef57dfe966afb
BLAKE2b-256 074abc0c19cbbbf23593de12d03a46da3d6a786b59675ae2b074b5bc997ddab2

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page