<commit_before>sjs-node
========

Description
-----------
A node.js wrapper of the spark-jobserver API.

Usage
-----

Add sjs-node as a dependency to your package.json:
```
"sjs-node": "git+ssh://git@github.com:dylanhein/sjs-node.git"
```

Import sjs-node to your js file where it will be consumed by requiring it:
```
var SjsClient = require('sjs-node');
```

Create a new instance of the sjs-node client by passing an object to it's constructor that contains
the properties 'server' (string), 'port' (int), and 'ssl' (bool) like so:

```
var sjsClient = new SjsClient({
  server: 'localhost',
  port: '8090',
  ssl: false
});
```

To use the client instance to communicate with the jobserver, call the function you wish to use.  Example:
```
var allJobs = sjsClient.jobs.listJobs();
```

API Reference
-------------

**Jobs**

```
/**
 * Lists all spark jobs.
 *
 * @returns {array} jobs
 */
listJobs()

/**
 * Starts the given spark job with the given message body.
 *
 * @param {object} sparkJob - Ex: { appName: {string}, classPath: {string}}
 * @param {object} messageBody - The POST body
 * @returns {object} result
 */
startJob(sparkJob, messageBody)

/**
 * Gets the current status of the spark job with the given job ID.
 *
 * @param {string} jobId - The spark job ID
 * @returns {object} jobStatus - Ex: { isComplete: {boolean}, percentComplete: {int}, isError: {boolean}, errorMessage: {string}}<commit_msg>Corrected readme example and updated description to be more accurate.<commit_after>sjs-node
========

Description
-----------
A promise-based node.js wrapper of the spark-jobserver API.

Usage
-----

Add sjs-node as a dependency to your package.json:
```
"sjs-node": "git+ssh://git@github.com:dylanhein/sjs-node.git"
```

Import sjs-node to your js file where it will be consumed by requiring it:
```
var SjsClient = require('sjs-node');
```

Create a new instance of the sjs-node client by passing an object to it's constructor that contains
the properties 'server' (string), 'port' (int), and 'ssl' (bool) like so:

```
var sjsClient = new SjsClient({
  server: 'localhost',
  port: '8090',
  ssl: false
});
```

To use the client instance to communicate with the jobserver, call the function you wish to use.  Example:
```
sjsClient.jobs.listJobs().then(function(results) {
  doSomethingWith(results);
});
```

API Reference
-------------

**Jobs**

```
/**
 * Lists all spark jobs.
 *
 * @returns {array} jobs
 */
listJobs()

/**
 * Starts the given spark job with the given message body.
 *
 * @param {object} sparkJob - Ex: { appName: {string}, classPath: {string}}
 * @param {object} messageBody - The POST body
 * @returns {object} result
 */
startJob(sparkJob, messageBody)

/**
 * Gets the current status of the spark job with the given job ID.
 *
 * @param {string} jobId - The spark job ID
 * @returns {object} jobStatus - Ex: { isComplete: {boolean}, percentComplete: {int}, isError: {boolean}, errorMessage: {string}}
{'fraction_non_alphanumeric': 0.1576271186440678, 'fraction_numerical': 0.002711864406779661, 'mean_word_length': 3.7905844155844157, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2691658', 'n_tokens_mistral': 956, 'n_tokens_neox': 920, 'n_words': 344}