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

@mapbox/watchbot-progress

v1.1.7

Published

[![Build Status](https://travis-ci.com/mapbox/watchbot-progress.svg?token=Z8JyQH8sBSdZv3SwHK2w&branch=master)](https://travis-ci.org/mapbox/watchbot-progress)

Downloads

4,602

Readme

watchbot-progress

Build
Status

watchbot-progress a series of tracking tools available on reduce-enabled Watchbot stacks to track the progress of distributed map-reduce operations. See the included examples.md for some basic worker recipes.

Installation

npm install watchbot-progress

Using the CLI command

A CLI command is available to report progress to Watchbot, and is accessible by default on reduce-enabled Watchbot stacks.

$ watchbot-progress --help

  Tracks the progress of a distributed map-reduce operation

  USAGE: watchbot-progress <command> <job-id> [options]

  Environment variable $ProgressTable must be set as the ARN for the DynamoDB
  table that is used to track progress.

  COMMANDS:
    - status: check the status of a job
    - set-total: set the total number of parts in a job
    - set-metadata: set arbitrary metadata on the job record
    - complete-part: complete a single part
    - fail-job: mark a job as a failure

  OPTIONS:
    -t, --total     (for set-total) the total number of parts in a job
    -p, --part      (for complete-part) the part number to mark as complete
    -m, --metadata  (for set-metadata) the JSON metadata object to store
    -r, --reason    (for fail-job) a description of why the job failed

Note that by default, workers in reduce-enabled Watchbot stacks will have the $ProgressTable environment variable set automatically.

Creating a progress table

A JavaScript module is available to create a DynamoDB table. You will need to provide any CloudFormation permissions.

var table = require('watchbot-progress').table;

This function requires 2 parameters:

  • name: DynamoDB table name
  • throughout: Object that contains user specification for progress table read and write capacity units:
    • throughput.readCapacityUnits: Approximate number of reads per second from progress table
    • throughput.writeCapacityUnits: Approximate number of writes per second to progress table

Reporting progress in JavaScript

A JavaScript module is also available as a mechanism for progress reporting.

var progress = require('watchbot-progress').progress;
  • progress.setTotal(jobId, total, [callback]): Set the total number of parts for a particular map-reduce operation.
  • progress.completePart(jobId, part, [callback]): Mark a single part as complete. The response will be a boolean value indicating whether or not the operation is completed.
  • progress.setMetadata(jobId, metadata, [callback]): Associate arbitrary metadata with a particular map-reduce operation.
  • progress.status(jobId, [callback]): Read the status of a particular map-reduce operation.
  • progress.failJob(jobId, reason, [callback]): Mark an operation as a failure, providing a description of what went wrong.