Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.
/ hpcc-js-comms Public archive

JavaScript (Node + Browser) Client Library for HPCC-Platform

License

Notifications You must be signed in to change notification settings

hpcc-systems/hpcc-js-comms

Repository files navigation

Deprecated

This repository has been deprecated in favour of @hpcc-js/comms (available via npm).

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