@elucidatainc/pollycli
pollycli lets users access the functionalities of Polly over a command line interface
Last updated 24 days ago by elucidatainc .
ISC · Original npm · Tarball · package.json
$ cnpm install @elucidatainc/pollycli 
SYNC missed versions from official npm registry.

Polly CLI

The Polly Command Line Interface (Polly CLI) is an open source tool that enables you to interact with Polly services using commands in your command-line shell. Polly CLI lets users run jobs on the Polly cloud infrastructure by scaling computation resources as per need. Users can start and stop tasks and even monitor and view logs.

System Dependencies

  • node
  • npm

Install the CLI

sudo npm install -g @elucidatainc/pollycli

Update the CLI

sudo npm install -g @elucidatainc/pollycli

Commands to use Polly CLI

  • Login to Polly
polly login

and follow the instructions

  • Logout of Polly
polly logout
  • Create a new workspace on Polly
polly workspaces create --workspace-name <workspace name wrapped in quotes> --workspace-description <workspace description wrapped in quotes>

This will return you a workspace ID which is used while submitting a job on Polly.

  • List workspace on Polly
polly workspaces list --all # lists all the workspaces on Polly
polly workspaces list --latest 10 # lists the lastest 10 the workspaces on Polly
polly workspaces list --oldest 10 # lists the oldest 10 workspaces on Polly
  • Create a jobs on Polly
polly jobs create --workspace-id <workspace id that you got from create workspace step> --job-file <a json file path which contains the description of a job>

This will return a job ID which is useful for tracking the progress of the job Sample job JSON

{
  "cpu": "100m",
  "memory": "64Mi",
  "image": "docker/whalesay",
  "tag": "latest",
  "name": "exampleName",
  "command": [
      "cowsay",
      "hello world"
  ]
}

Here is a json template for running private docker

{
  "cpu": "100m",
  "memory": "64Mi",
  "image": "your_private_docker",
  "tag": "latest",
  "secret": "<docker compose file secret>",
  "name": "secret docker running",
}

Here is another JSON template for passing environment variables. We have two different ways to define environment variables :

  1. Normal environment variables which are saved in a database for future references.
  2. Secret environment variables which are not saved in any database. Both act like normal docker environment variables during run time.
{
  "cpu": "100m",
  "memory": "64Mi",
  "image": "your_docker",
  "tag": "latest",
  "env": {
    "ENV1": "ENV_VALUE1",
    "ENV2": "ENV_VALUE2"
  },
  "secret_env": {
    "SECRET_ENV1": "SECRET_ENV_VALUE1",
    "SECRET_ENV2": "SECRET_ENV_VALUE2"
  },
  "name": "docker running"
}

There are two ways in which resources can be allocated for a job.

  1. Specify the memory and the number of cpus required
  2. Specify the machine type required

When directly alloting memory and cpu user has the flexiablity to choose memory from 1Mi to 8Gi and cpus 100m to 2. For higher resource allocation machine type has to be specified. The list of machine types accessible on Polly CLI is as follows:

╔══════════════╤═══════════════════════════╗
║ machine type │ specifications            ║
╟──────────────┼───────────────────────────╢
║ gp           │ 4 vCPU, 16GB RAM          ║
╟──────────────┼───────────────────────────╢
║ ci2xlarge    │ 16 vCPU, 32GB RAM         ║
╟──────────────┼───────────────────────────╢
║ ci3xlarge    │ 36 vCPU, 72GB RAM         ║
╟──────────────┼───────────────────────────╢
║ mi2xlarge    │ 4 vCPU, 32GB RAM          ║
╟──────────────┼───────────────────────────╢
║ mi3xlarge    │ 8 vCPU, 64GB RAM          ║
╟──────────────┼───────────────────────────╢
║ mi4xlarge    │16 vCPU, 122GB RAM         ║
╟──────────────┼───────────────────────────╢
║ gpusmall     │ NVIDIA Tesla V100 1 GPUs, ║
║              │ 16 GB GPU memory          ║
║              │ 8 vCPU, 61GB              ║
╚══════════════╧═══════════════════════════╝

Here is a sample json for machine type allotment

{
  "machineType": "gp",
  "image": "docker/whalesay",
  "tag": "latest",
  "name": "exampleName",
  "command": [
      "cowsay",
      "hello world"
  ]
}
  • Check the status of the job
polly jobs status --job-id <id of the job that is returned while creating a job> --workspace-id <workspace id in which job was created>
  • Check the logs of the job
polly jobs logs --job-id <id of the job that is returned while creating a job> --workspace-id <workspace id in which job was created>
  • Cancel the jobs
polly jobs cancel --job-id <id of the job that is returned while creating a job> --workspace-id <workspace id in which job was created>
  • List files in a workspace
polly files list --workspace-id <workspace id> --workspace-path <polly://path/to/a/directory>
  • Workspace ID will be auto detected if POLLY_WORKSPACE_ID variable is set on the system environment. The workspace ID from the environment will be taken as the default value. If the user does not want CLI to prompt asking for workspace ID confirmation, pass the parameter --yes.
  • All the jobs that would be run using Polly CLI would have Polly credentials and workspace ID available as environment variables. The information would be be present as environment variables - POLLY_REFRESH_TOKEN, POLLY_ID_TOKEN, POLLY_WORKSPACE_ID, POLLY_USER. None of this information are stored in any database.
  • Sync folders
polly files sync --workspace-id <workspace id> --source <polly://path/to/a/directory> --destination <path/to/a/local/directory> #from polly to local
polly files sync --workspace-id <workspace id> --source <path/to/a/local/directory> --destination <polly://path/to/a/directory> #from local to polly

polly files sync --workspace-id <workspace id> --source <polly>
  • Copy file
polly files copy --workspace-id <workspace id> --source <polly://path/to/a/file> --destination  <path/to/a/local/path> #from polly to local
polly files copy --workspace-id <workspace id> --source <path/to/a/local/path> --destination <polly://path/to/a/file> #from local to polly
  • Auto login

If you would like to access some Polly functionalities in the docker, you can install Polly CLI in the docker and use it. You can login in the docker by using the following command.

polly login --auto

When a task is started with PollyCLI we send enough information to the task for it to login automatically with the same user.

Local development

  • Pull the repository
git clone https://bitbucket.org/elucidatainc/pollycli.git
  • Enter into the repository
cd pollycli
  • Install dependencies
npm install
  • Install the CLI for local development
npm link
  • Now development can start. When you make code changes it will be directly reflected in the CLI directly
  • main.js file in folder src is the starting file in which function main will be called when the CLI runs

Current Tags

  • 0.1.16                                ...           latest (24 days ago)

15 Versions

  • 0.1.16                                ...           24 days ago
  • 0.1.15                                ...           a month ago
  • 0.1.13                                ...           a month ago
  • 0.1.12                                ...           2 months ago
  • 0.1.9                                ...           2 months ago
  • 0.1.6                                ...           3 months ago
  • 0.1.5                                ...           4 months ago
  • 0.1.2 [deprecated]           ...           4 months ago
  • 0.1.1                                ...           5 months ago
  • 0.1.0                                ...           5 months ago
  • 0.0.10 [deprecated]           ...           5 months ago
  • 0.0.6 [deprecated]           ...           5 months ago
  • 0.0.5 [deprecated]           ...           5 months ago
  • 0.0.2 [deprecated]           ...           5 months ago
  • 0.0.1 [deprecated]           ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 35
Last Day 0
Last Week 15
Last Month 32
Dependencies (12)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |