dray-client

0.0.15 • Public • Published

Build Status Coverage Status

Usage

Before creating jobs, you need to initialize the job manager:

import { DrayManager } from 'dray-client';
 
let manager = new DrayManager(
    'http://0.0.0.0:3000',   // Dray URL
    'redis://127.0.0.1:6379' // Redis URL
);

Fire and forget

let job = manager.createJob();
 
job.addStep('foo/bar') // Container to be run
   .submit(); // Fire and forget!

Wait for result

let job = manager.createJob();
job.setInput('foo') // Data passed to container
   .addStep('centurylink/upper'); // Container to be run
// Fire and wait for promise
job.submit().then((value) => {
    console.log("Result:", value);
}, (reason) => {
    console.error("Something bad happened:", reason)
});

Start compilation job

import { BuildpackJob } from 'dray-client';
let compilation = new BuildpackJob(manager);
compilation.addFiles([
    {name: 'foo.ino', data: new Buffer()}
]);
compilation.setEnvironment({
    PLATFORM_ID: 6
});
compilation.setBuildpacks([
    'particle/buildpack-wiring-preprocessor',
    'particle/buildpack-particle-firmware:0.5.1-photon'
]);
compilation.submit().then((binaries) => {
    // Do something with binaries
}, (reason) => {
    console.error("Compilation error:", reason)
});

API Reference

Development

Releasing

  1. Prebuid dist directory using npm build
  2. Bump version with npm version <major|minor|patch>
  3. Push the repo
  4. Publish on npm: npm publish

Readme

Keywords

none

Package Sidebar

Install

npm i dray-client

Weekly Downloads

50

Version

0.0.15

License

ISC

Last publish

Collaborators

  • suda
  • monkbroc
  • particlebot