0.4.3 • Published 3 months ago

@elucidatainc/pollycli v0.4.3

Weekly downloads
455
License
ISC
Repository
-
Last release
3 months ago

Polly CLI

The Polly Command Line Interface (Polly CLI) is a 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

  • 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.

  • 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
  • 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
  • Docker logout and logout

To login/logout of the docker repository run the following command

polly dockers login
polly dockers logout

Run the output of above command on terminal. Add sudo before the command if required according to system settings.

  • Create docker repository
polly dockers create --name <docker_repository_name> --description <description of the repository>
  • List docker repositories
polly dockers list --all
  • List docker repository commits
polly dockers commit-list --name <docker_repository_name> --all
  • 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>

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
0.4.3

3 months ago

0.4.2

10 months ago

0.2.10

1 year ago

0.3.0

1 year ago

0.3.2

12 months ago

0.3.1

1 year ago

0.3.4

11 months ago

0.3.3

11 months ago

0.2.7

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.4.1

10 months ago

0.4.0

11 months ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

2 years ago

0.1.39

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.1.38

2 years ago

0.1.37

2 years ago

0.1.35

2 years ago

0.1.36

2 years ago

0.1.34

3 years ago

0.1.31

3 years ago

0.1.32

3 years ago

0.1.33

3 years ago

0.1.30

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.27

3 years ago

0.1.26

3 years ago

0.1.25

3 years ago

0.1.24

3 years ago

0.1.23

3 years ago

0.1.22

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago