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

exframe-cg

v1.0.3

Published

A simple client for deploying and interaction with choreographer models.

Downloads

3

Readme

exframe-cg

A simple client for deploying and interaction with choreographer models.

Usage

const cgClient = require('exframe-cg').cgClient({
  serviceUrl: 'http://choreographer.cg:9000',
  headerPrefix: 'harmony-',
  timeToRetry: 1000,
  maxRetryAttempts: 5
});

Configuration Settings

  • serviceUrl - The Url and port on which choreographer is listening
  • headerPrefix - Prefix to use for http headers
  • timeToRetry - default: 1000 number of milliseconds to wait before retrying a model deployment upon failure
  • maxRetryAttempts - default: 190 number of times to retry deploying a model before giving up

Client

deploy

Deploys a model to the choreographer.

The deploy method requires a model file path and returns a promise. If the deployment initially fails, the deploy method will retry maxRetryAttempts times before resolving or rejecting the promise.

cgClient.deploy(context, modelPath)
  .then(result => {
    console.log(`${modelPath} has been deployed`);
  })
  .catch(error => {
    console.log(error);
  });

Arguments:

  • modelPath string The file path to the model

deployStub

Deploys a model stub to the choreographer.

The deployStub method requires a model file path and a model name. It returns a promise. If the deployment initially fails, the deployStub method will retry maxRetryAttempts times before resolving or rejecting the promise.

cgClient.deployStub(context, modelName, stubPath)
  .then(result => {
    console.log(`${modelName} stub at ${stubPath} has been deployed`);
  })
  .catch(error => {
    console.log(error);
  })

Arguments

  • modelName string The name of the model being stubbed
  • stubPath string The file path to the model stub

start

Starts a model.

The start method requires a modelName and an object that the model instance uses as input data. It returns a promise that resolves with information about the newly created model instance.

cgClient.start(context, modelName, args)
  .then(result => {
    console.log(`Instance ${result.modelInstanceId} started.`);
  })
  .catch(error => {
    console.log(error);
  })

Arguments

  • modelName string The name of the model being started
  • args object An object containing input data for the model

instance

Gets status information about a model instance.

The instance method requires a model instance id. It returns a promise that resolves with an object containing instance information.

cgClient.instance(context, modelInstanceId)
  .then(result => {
    console.log(`Model instance ${modelInstanceId} has ${result.completedTasks.length} completed tasks`);
  })
  .catch(error => {
    console.log(error);
  })

Arguments

  • modelInstanceId string The instance id of the model of interest.

completeTask

Completes a user task.

The completeTask method requires a model instance id and a task name. It takes an object containing user input that the model instance may use to complete the task. It returns a promise that resolves with an object containing model instance information.

cgClient.complete(context, modelInstanceId, taskName, args)
  .then(result => {
    console.log(`Model instance ${modelInstanceId} has ${result.completedTasks.length} completed tasks`);
  })
  .catch(error => {
    console.log(error);
  })

Arguments

  • modelInstanceId string The instance id of the model of interest
  • taskName string The name of the task to completed
  • args object An object containing input data to be consumed by the model instance.

moveToTask

Moves the execution of the model instance back to a specific user task.

The moveToTask method requires a model instance id and a task name. It returns a promises that resolves with an object containing model instance information.

cgClient.moveToTask(context, modelInstanceId, taskName)
.then(result => {
  console.log(`Model instance ${modelInstanceId} has ${result.completedTasks.length} completed tasks`);
})
.catch(error => {
  console.log(error);
})

Arguments

  • modelInstanceId string The instance id of the model of interest
  • taskName string The name of the task to move model execution to