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

dagsby

v0.0.4

Published

Gatsby library for orchestrating running data pipelines across workers

Downloads

2

Readme

Dagsby

An experimental library for orchestrating job running and data processing across processes/machines within Gatsby.

Components

  • task/job defines inputs/outputs, dependencies, and code to execute
  • worker pool pool of node.js processes which can execute jobs
  • runner Uses N worker pools to run tasks.

Getting started

npm i dagsby

Start a worker pool:

node node_modules/dagsby/dist/worker-pool-server.js --numWorkers 4 --socketPort 9999 --httpPort 10020

Create a simple task in a test.js file and run it on the worker pool.

const dagsby = require(`dagsby`)

;(async () => {
  // Create our runner.
  const runner = await dagsby.createRunner({
    pools: [{ socketPort: 9999, httpPort: 10020 }],
  })

  // Create a simple task
  const task = await dagsby.createTask({
    func: args => `Hello ${args.name}!`,
    // Written using Arvo's schema language.
    argsSchema: [
      {
        name: `name`,
        type: `string`,
      },
    ],
  })

  // Setup the task on the worker pool(s).
  await runner.setupTask(task)

  // Run the task!
  const result = await runner.executeTask({ task, args: { name: `World` } })

  console.log(result)
})()

Let's try a more complex task where we specify a required file & add an NPM dependency.

First create a file called hello.txt with some text in it.

Then add this code to our test file after the first task.

const mySecondTask = await dagsby.createTask({
  func: (args, { files }) => {
    const fs = require(`fs`)
    const _ = require(`lodash`)
    const text = fs.readFileSync(files.text.localPath)
    const camelCase = _.camelCase(text)

    return `${args.preface} ${text} \n\n ${camelCase}`
  },
  argsSchema: [{ name: `preface`, type: `string` }],
  dependencies: {
    lodash: `latest`,
  },
  files: {
    text: {
      originPath: require(`path`).join(__dirname, `hello.txt`),
    },
  },
})
await runner.setupTask(mySecondTask)

const result2 = await runner.executeTask({
  task: mySecondTask,
  args: { preface: `yeeesss` },
})

console.log(result2)

TODOs

  • [ ] support (again) running multiple types of tasks in parallel.
  • [ ] support multiple pools in runners.