Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bg job priorities

  • Loading branch information...
commit f3c7c103d49ce79bd92a8c7ea1c51fdc94b98c40 1 parent 284adee
@smith smith authored
View
2  lib/packet/requests.js
@@ -30,6 +30,8 @@ module.exports = {
SUBMIT_JOB_HIGH: submitJob,
SUBMIT_JOB_LOW: submitJob,
SUBMIT_JOB_BG: submitJob,
+ SUBMIT_JOB_HIGH_BG: submitJob,
+ SUBMIT_JOB_LOW_BG: submitJob,
GET_STATUS: function (options) {
return new Buffer((options || {}).handle, "ascii");
}
View
2  lib/packet/types.js
@@ -3,6 +3,8 @@ exports.names = {
SUBMIT_JOB_HIGH: 21,
SUBMIT_JOB_LOW: 33,
SUBMIT_JOB_BG: 18,
+ SUBMIT_JOB_HIGH_BG: 32,
+ SUBMIT_JOB_LOW_BG: 34,
GET_STATUS: 15,
STATUS_RES: 20,
JOB_CREATED: 8,
View
31 test/test-job.js
@@ -76,6 +76,37 @@ module.exports = testCase({
});
},
+ "submit { background: true, priority: 'high' }": function (test) {
+ var job = client.submitJob("test", "test", { background: true,
+ priority: "high" });
+
+ job.on("create", function (handle) {
+ job.getStatus(function (status) {
+ test.deepEqual(status, { handle: handle,
+ known: true,
+ running: true,
+ percentComplete: [ 48, 48 ] });
+ test.done();
+ });
+ });
+ },
+
+ "submit { background: true, priority: 'low' }": function (test) {
+ var job = client.submitJob("test", "test", { background: true,
+ priority: "low" });
+
+ job.on("create", function (handle) {
+ job.getStatus(function (status) {
+ test.deepEqual(status, { handle: handle,
+ known: true,
+ running: true,
+ percentComplete: [ 48, 48 ] });
+ test.done();
+ });
+ });
+ },
+
+
"event: data": function (test) {
job.on("data", function (result) {
test.equal("test", result, "work data received");
View
16 test/test-packet.js
@@ -52,6 +52,22 @@ exports["encode SUBMIT_JOB_BG"] = function (test) {
test.done();
};
+exports["encode SUBMIT_JOB_HIGH_BG"] = function (test) {
+ // \0REQ-SUBMIT_JOB_HIGH_BG-7-test\0-\0-a/
+ var data = new Buffer([0,0x52,0x45,0x51,0,0,0,32,0,0,0,7,0x74,0x65,0x73,0x74,0,0,0x61]);
+
+ test.deepEqual(packet.encode({ type: "SUBMIT_JOB_HIGH_BG", name: "test", data: "a", encoding: "utf8" }), data);
+ test.done();
+};
+
+exports["encode SUBMIT_JOB_LOW_BG"] = function (test) {
+ // \0REQ-SUBMIT_JOB_LOW_BG-7-test\0-\0-a/
+ var data = new Buffer([0,0x52,0x45,0x51,0,0,0,34,0,0,0,7,0x74,0x65,0x73,0x74,0,0,0x61]);
+
+ test.deepEqual(packet.encode({ type: "SUBMIT_JOB_LOW_BG", name: "test", data: "a", encoding: "utf8" }), data);
+ test.done();
+};
+
exports["encode GET_STATUS"] = function (test) {
// \0REQ-GET_STATUS-5-test\0/
var data = new Buffer([0,0x52,0x45,0x51,0,0,0,15,0,0,0,4,0x74,0x65,0x73,0x74]);
Please sign in to comment.
Something went wrong with that request. Please try again.