npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pradyumn-el/pollycli

v0.0.2

Published

pollycli lets users access the functionalities of Polly over a command line interface

Downloads

1

Readme

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