node-deadline
Version:
Module to interface with Deadline Compute Management System by Thinkbox Software
90 lines (65 loc) • 2.7 kB
Markdown
#node-deadline
A node.js JavaScript API to interface with Thinkbox Software's Deadline compute management system
([website](http://deadline.thinkboxsoftware.com/)).
This API bypasses the Deadline HTTP API and accesses the backend database directly. This allows for
higher efficiency and stability, but requires that the Deadline database be setup properly for external
connections.
**Note:** It is recommended that you setup authentication on your Deadline database when allowing
external connections.
##Installation
Easily install via npm.
```
$npm install --save node-deadline
```
##Basic Usage
###Setup a connection
The most basic form of the API requires a host name for your Deadline instance and optional port
```javascript
var deadline = require( "node-deadline" );
deadline.init("deadline.host.com", port);
```
###Get Job Information
Once you have a deadline object, you can use it to get and set information in the Deadline repository.
```javascript
deadline.get.jobs.by.state( Deadline.FAILED, function( err, jobs ) {
if(err) {
throw err
}
console.log( "found " + jobs.length + " failed jobs" );
} );
```
##Important Considerations
If the time and date settings on your node.js server are not set correctly, this will set improper dates in the
Deadline database, causeing unforseen issues.
##Advanced Connection Settings
The initializer can also take an object with more connection options. At minimum, the host must be defined.
```javascript
var options = {
host: "deadline.host.com",
port: 27070
}
deadline.init( options );
```
####Options
- **host:** the host name or ip of the Deadline database (*required*)
- **port:** the conenction port for the deadline database (*27070*)
- **readOnly:** if true, does not allow changes to the database, logs all attempts (*false*)
- **verbose:** if true, enables verbose logging (*false*)
- **test:** if true, no connection attepts are made, and all queries are routed to Deadline.Test (*false*)
- **username:** username to use when authenticating with the database (*null*)
- **password:** password to use when authenticating with the database (*null*)
- **authSource:** authentication database to use on the mongo server (*admin*)
##Authentication
If your Deadline database requires authentication in order to access and make changes, the constructor
object allows for this with the `username` and `password` properties.
Authentication doesn't take place until a read/write command is issued, so do not expect errors when
simply creating the deadline object.
```javascript
var options = {
host: "deadline.host.com",
port: 27070,
username: myUser,
password: myPass
}
deadline.init( options );
```