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
- 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();
});
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}`);
});
});
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));
});
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.
TODO