Skip to content

GordonSmith/hpcc-js-comms

 
 

Repository files navigation

Build Status Join the chat at https://gitter.im/hpcc-systems/hpcc-js-comms

hpcc-js-comms

This module provides a convenient interface for interacting with the HPCC-Platform ESP API from a NodeJS or web browser.

Quick Examples (...more)

...For the impatiant

Submitting ECL:

  • Submit ECL
  • Wait for completion
  • Fetch results
import { Workunit } from "hpcc-js-comms";

return Workunit.submit({baseUrl: "http://x.x.x.x:8010", usedID: "", password: ""}, "hthor", "'Hello and Welcome!';").then((wu) => {
    return wu.watchUntilComplete();
}).then((wu) => {
    return wu.fetchResults().then((results) => {
        return results[0].fetchRows();
    }).then((rows) => {
        console.log(JSON.stringify(rows));
        return wu;
    });
}).then((wu) => {
    return wu.delete();
});

Fetch a list of Workunits

import { Workunit } from "hpcc-js-comms";

return Workunit.query({ baseUrl: "http://x.x.x.x:8010", userID: "", password: "" }, { State: "completed", LastNDays: 7, Count: 3 }).then((wus) => {
    wus.forEach((wu) => {
        console.log(`${wu.Wuid} Total Cluster Time:  ${wu.TotalClusterTime}`);
    });
});

Resubmit workunit

import { Workunit } from "hpcc-js-comms";

const wu = Workunit.attach({ baseUrl: "http://x.x.x.x:8010", userID: "userID", password: "pw" }, "W20170401-082211");
wu.resubmit()
    .then((wu) => {
        //  Success  ---
    }).catch((e){
        //  Failure  ---
        console.log(JSON.stringify(e));
    });

Installing

If you use NPM, npm install @hpcc-js/comms. Otherwise, download the latest release. AMD, CommonJS, and vanilla JS environments are supported. (In vanilla, a HPCCComms global is exported):

<script src="https://hpccsystems.com/hpcc-js/comms-browser.min.js"></script>
<script>
return HPCCComms.query({ baseUrl: ESP_URL, userID: "", password: "" }, {}).then((wus) => {
    wus.forEach((wu) => {
        console.log(wu.TotalClusterTime);
    });
});
</script>

Try hpcc-js-comms in your browser.

API Reference

TODO

Packages

No packages published

Languages

  • ECL 69.4%
  • TypeScript 29.4%
  • Other 1.2%