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

Options:

Name Description
-u, --url URL Override API URL [default: http://platform.dev.neuromation.io/api/v1]
-t, --token TOKEN API authentication token (not implemented)
--verbose Enable verbose logging
-v, --version Print version and exit

Commands:

  • model: Model training, testing and inference

  • job: Manage existing jobs

  • store: Storage operations

  • image: Docker container image operations

  • config: Configure API connection settings

  • completion: Generate code to enable completion

  • share: Resource sharing management

  • help: Get help on a command

neuro model

Model operations

Usage:

neuro model COMMAND

Commands:

  • train: Start model training

  • debug: Prepare debug tunnel for PyCharm

neuro model train

Start training job using model from IMAGE, dataset from DATASET and
store output weights in RESULTS.
COMMANDS list will be passed as commands to model container.

Usage:

neuro model train [options] IMAGE DATASET RESULTS [CMD...]

Options:

Name Description
-g, --gpu NUMBER Number of GPUs to request [default: 0]
--gpu-model MODEL GPU to use [default: nvidia-tesla-k80]
Other options available are
nvidia-tesla-k80
nvidia-tesla-p4
nvidia-tesla-v100
-c, --cpu NUMBER Number of CPUs to request [default: 0.1]
-m, --memory AMOUNT Memory amount to request [default: 1G]
-x, --extshm Request extended '/dev/shm' space
--http NUMBER Enable HTTP port forwarding to container
--ssh NUMBER Enable SSH port forwarding to container
--preemptible Run job on a lower-cost preemptible instance
--non-preemptible Force job to run on a non-preemptible instance
-d, --description DESC Add optional description to the job
-q, --quiet Run command in quiet mode (print only job id)

neuro model debug

Starts ssh terminal connected to running job.
Job should be started with SSH support enabled.

Usage:

neuro model debug [options] ID

Options:

Name Description
--localport NUMBER Local port number for debug [default: 31234]

Examples:

neuro model debug --localport 12789 job-abc-def-ghk

neuro job

Model operations

Usage:

neuro job COMMAND

Commands:

  • submit: Starts Job on a platform

  • monitor: Monitor job output stream

  • list: List all jobs

  • status: Display status of a job

  • kill: Kill job

  • ssh: Start SSH terminal

neuro job submit

Start job using IMAGE
COMMANDS list will be passed as commands to model container.

Usage:

neuro job submit [options] [--volume MOUNT]...
          [--env VAR=VAL]... IMAGE [CMD...]

Options:

Name Description
-g, --gpu NUMBER Number of GPUs to request [default: 0]
--gpu-model MODEL GPU to use [default: nvidia-tesla-k80]
Other options available are
nvidia-tesla-k80
nvidia-tesla-p4
nvidia-tesla-v100
-c, --cpu NUMBER Number of CPUs to request [default: 0.1]
-m, --memory AMOUNT Memory amount to request [default: 1G]
-x, --extshm Request extended '/dev/shm' space
--http NUMBER Enable HTTP port forwarding to container
--ssh NUMBER Enable SSH port forwarding to container
--volume MOUNT... Mounts directory from vault into container
Use multiple options to mount more than one volume
-e, --env VAR=VAL... Set environment variable in container
Use multiple options to define more than one variable
--env-file FILE File with environment variables to pass
--preemptible Force job to run on a preemptible instance
--non-preemptible Force job to run on a non-preemptible instance
-d, --description DESC Add optional description to the job
-q, --quiet Run command in quiet mode (print only job id)

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 job submit --volume storage:/q1:/qm:ro --volume storage:/mod:/mod:rw pytorch:latest
# Starts a container pytorch:latest with connection enabled to port 22 and
# sets PYTHONPATH environment value to /python.
# Please note that SSH server should be provided by container.
neuro job submit --env PYTHONPATH=/python --volume storage:/data/2018q1:/data:ro --ssh 22 pytorch:latest

neuro job monitor

Monitor job output stream

Usage:

neuro job monitor ID

neuro job list

Usage:

neuro job list [options]

Options:

Name Description
_-s, --status (pending running
-d, --description DESCRIPTION
Filter out job by job description (exact match)
-q, --quiet
Run command in quiet mode (print only job ids)
List all jobs

Examples:

neuro job list --description="my favourite job"
neuro job list --status=all
neuro job list --status=pending,running --quiet

neuro job status

Display status of a job

Usage:

neuro job status ID

neuro job kill

Kill job(s)

Usage:

neuro job kill JOB_IDS...

neuro job ssh

Starts ssh terminal connected to running job.
Job should be started with SSH support enabled.

Usage:

neuro job ssh [options] ID

Options:

Name Description
--user STRING Container user name [default: root]
--key STRING Path to container private key.

Examples:

neuro job ssh --user alfa --key ./my_docker_id_rsa job-abc-def-ghk

neuro store

Storage operations

Usage:

neuro store COMMAND

Commands:

  • rm: Remove files or directories

  • ls: List directory contents

  • cp: Copy files and directories

  • mv: Move or rename files and directories

  • mkdir: Make directories

neuro store rm

Remove files or directories.

Usage:

neuro store rm PATH

Examples:

neuro store rm storage:///foo/bar/
neuro store rm storage:/foo/bar/
neuro store rm storage://username/foo/bar/

neuro store ls

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

Usage:

neuro store ls [PATH]

neuro store cp

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

Usage:

neuro store cp [options] SOURCE DESTINATION

Options:

Name Description
-r, --recursive Recursive copy
-p, --progress Show progress

Examples:

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

neuro store 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 store mv SOURCE DESTINATION

Examples:

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

neuro store mkdir

Make directories

Usage:

neuro store mkdir PATH

neuro image

Docker image operations

Usage:

neuro image COMMAND

Commands:

  • push: Push docker image from local machine to cloud registry.

  • pull: Pull docker image from cloud registry to local machine.

neuro image push

Push an image to platform registry

Usage:

neuro image push IMAGE_NAME

neuro image pull

Pull an image from platform registry

Usage:

neuro image pull IMAGE_NAME

neuro config

Client configuration settings commands

Usage:

neuro config COMMAND

Commands:

  • url: Updates API URL

  • auth: Updates API Token

  • forget: Forget stored API Token

  • id_rsa: Updates path to Github RSA token, in use for SSH/Remote debug

  • show: Print current settings

neuro config url

Updates settings with provided platform URL.

Usage:

neuro config url URL

Examples:

neuro config url http://platform.neuromation.io/api/v1

neuro config auth

Updates authorization token

Usage:

neuro config auth TOKEN

neuro config forget

Forget authorization token

Usage:

neuro config forget

neuro config id_rsa

Updates path to id_rsa file with private key.
File is being used for accessing remote shell, remote debug.
Note: this is temporal and going to be
replaced in future by JWT token.

Usage:

neuro config id_rsa FILE

neuro config show

Prints current settings.

Usage:

neuro config show

neuro completion

Generates code to enable bash-completion.

Usage:

neuro completion COMMAND

Commands:

  • generate: Generate code enabling bash-completion. eval $(neuro completion generate) enables completion for the current session. Adding eval $(neuro completion generate) to .bashrc_profile enables completion permanently.

  • patch: Automatically patch .bash_profile to enable completion

neuro completion generate

Generate code enabling bash-completion.
eval $(

Usage:

neuro completion generate

neuro completion patch

Automatically patch .bash_profile to enable completion

Usage:

neuro completion patch

neuro share

Shares resource specified by URI to a user specified by WHOM
allowing to read, write or manage it.

Usage:

neuro share URI WHOM (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

neuro help

Display help for given COMMAND

Usage:

neuro help COMMAND [SUBCOMMAND[...]]

Examples:

neuro help store
neuro help store ls

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-0.1.6-py3-none-any.whl (42.1 kB view hashes)

Uploaded Python 3

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