Commit 3d2ae5e9 authored by Tristan Cavelier's avatar Tristan Cavelier

Improving the new jio, it just doesn't restore older jio instance for now.

parent a9caa60c
...@@ -16,28 +16,27 @@ module.exports = function(grunt) { ...@@ -16,28 +16,27 @@ module.exports = function(grunt) {
src: ['<banner:meta.banner>', src: ['<banner:meta.banner>',
// Wrapper top // Wrapper top
'<file_strip_banner:../../src/<%= pkg.name %>/wrapper.top.js>', '<file_strip_banner:../../src/<%= pkg.name %>/wrapper.top.js>',
// Classes '<file_strip_banner:../../src/<%= pkg.name %>/exceptions.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/storages/storage.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/storages/storageHandler.js>',
// Jio wrapper top
'<file_strip_banner:../../src/<%= pkg.name %>/jio.top.js>',
// Jio Classes
'<file_strip_banner:../../src/<%= pkg.name %>/commands/command.js>', '<file_strip_banner:../../src/<%= pkg.name %>/commands/command.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/commands/getDocumentList.js>', '<file_strip_banner:../../src/<%= pkg.name %>/commands/getDocumentList.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/commands/loadDocument.js>', '<file_strip_banner:../../src/<%= pkg.name %>/commands/loadDocument.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/commands/removeDocument.js>', '<file_strip_banner:../../src/<%= pkg.name %>/commands/removeDocument.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/commands/saveDocument.js>', '<file_strip_banner:../../src/<%= pkg.name %>/commands/saveDocument.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/exceptions.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/jobStatus.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/jobStatus.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/doneStatus.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/doneStatus.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/failStatus.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/failStatus.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/initialStatus.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/initialStatus.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/onGoingStatus.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/onGoingStatus.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/waitStatus.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/status/waitStatus.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/storages/storage.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/storages/storageHandler.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/activityUpdater.js>',
// Jio wrapper top
'<file_strip_banner:../../src/<%= pkg.name %>/jio.top.js>',
// Jio Classes
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/job.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/job.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/announcements/announcement.js>', '<file_strip_banner:../../src/<%= pkg.name %>/announcements/announcement.js>',
// Singletons // Singletons
'<file_strip_banner:../../src/<%= pkg.name %>/activityUpdater.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/announcements/announcer.js>', '<file_strip_banner:../../src/<%= pkg.name %>/announcements/announcer.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/jobIdHandler.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/jobIdHandler.js>',
'<file_strip_banner:../../src/<%= pkg.name %>/jobs/jobManager.js>', '<file_strip_banner:../../src/<%= pkg.name %>/jobs/jobManager.js>',
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,11 +4,28 @@ var command = function(spec, my) { ...@@ -4,11 +4,28 @@ var command = function(spec, my) {
my = my || {}; my = my || {};
// Attributes // // Attributes //
var priv = {}; var priv = {};
priv.commandlist = {'saveDocument':saveDocument,
'loadDocument':loadDocument,
'removeDocument':removeDocument,
'getDocumentList':getDocumentList};
// creates the good command thanks to his label
if (spec.label && priv.commandlist[spec.label]) {
priv.label = spec.label;
delete spec.label;
return priv.commandlist[priv.label](spec, my);
}
priv.path = spec.path || ''; priv.path = spec.path || '';
priv.tried = 0;
priv.option = spec.option || {}; priv.option = spec.option || {};
priv.respond = priv.option.onResponse || function(){}; priv.respond = priv.option.onResponse || function(){};
priv.done = priv.option.onDone || function(){}; priv.done = priv.option.onDone || function(){};
priv.fail = priv.option.onFail || function(){}; priv.fail = priv.option.onFail || function(){};
priv.retry = function() {
that.setMaxRetry(-1);
that.fail({status:0,statusText:'Fail Retry',
message:'Impossible to retry.'});
};
priv.end = function() {}; priv.end = function() {};
// Methods // // Methods //
...@@ -49,12 +66,21 @@ var command = function(spec, my) { ...@@ -49,12 +66,21 @@ var command = function(spec, my) {
that.validateState(); that.validateState();
}; };
that.getTried = function() {
return priv.tried;
};
that.setMaxRetry = function(max_retry) {
priv.option.max_retry = max_retry;
};
/** /**
* Delegate actual excecution the storage handler. * Delegate actual excecution the storage handler.
* @param {object} handler The storage handler. * @param {object} handler The storage handler.
*/ */
that.execute = function(handler) { that.execute = function(handler) {
that.validate(handler); that.validate(handler);
priv.tried ++;
handler.execute(that); handler.execute(that);
}; };
...@@ -77,22 +103,31 @@ var command = function(spec, my) { ...@@ -77,22 +103,31 @@ var command = function(spec, my) {
}; };
that.done = function(return_value) { that.done = function(return_value) {
console.log ('test'); console.log ('done');
priv.done(return_value); priv.done(return_value);
priv.respond({status:doneStatus(),value:return_value}); priv.respond({status:doneStatus(),value:return_value});
priv.end(); priv.end();
}; };
that.fail = function(return_error) { that.fail = function(return_error) {
priv.fail(return_error); if (priv.option.max_retry === 0 || priv.tried < priv.option.max_retry) {
priv.respond({status:failStatus(),error:return_error}); priv.retry();
priv.end(); } else {
console.log ('fail');
priv.fail(return_error);
priv.respond({status:failStatus(),error:return_error});
priv.end();
}
}; };
that.onEndDo = function(fun) { that.onEndDo = function(fun) {
priv.end = fun; priv.end = fun;
}; };
that.onRetryDo = function(fun) {
priv.retry = fun;
};
/** /**
* Returns a serialized version of this command. * Returns a serialized version of this command.
* Override this function. * Override this function.
...@@ -101,6 +136,8 @@ var command = function(spec, my) { ...@@ -101,6 +136,8 @@ var command = function(spec, my) {
*/ */
that.serialized = function() { that.serialized = function() {
return {label:that.getLabel(), return {label:that.getLabel(),
tried:priv.tried,
max_retry:priv.max_retry,
path:priv.path, path:priv.path,
option:priv.option}; option:priv.option};
}; };
......
...@@ -4,7 +4,7 @@ var getDocumentList = function(spec, my) { ...@@ -4,7 +4,7 @@ var getDocumentList = function(spec, my) {
my = my || {}; my = my || {};
// Attributes // // Attributes //
// Methods // // Methods //
that.label = function() { that.getLabel = function() {
return 'getDocumentList'; return 'getDocumentList';
}; };
......
...@@ -4,7 +4,7 @@ var loadDocument = function(spec, my) { ...@@ -4,7 +4,7 @@ var loadDocument = function(spec, my) {
my = my || {}; my = my || {};
// Attributes // // Attributes //
// Methods // // Methods //
that.label = function() { that.getLabel = function() {
return 'loadDocument'; return 'loadDocument';
}; };
......
...@@ -4,7 +4,7 @@ var removeDocument = function(spec, my) { ...@@ -4,7 +4,7 @@ var removeDocument = function(spec, my) {
my = my || {}; my = my || {};
// Attributes // // Attributes //
// Methods // // Methods //
that.label = function() { that.getLabel = function() {
return 'removeDocument'; return 'removeDocument';
}; };
......
...@@ -5,7 +5,7 @@ var saveDocument = function(spec, my) { ...@@ -5,7 +5,7 @@ var saveDocument = function(spec, my) {
// Attributes // // Attributes //
var content = spec.content; var content = spec.content;
// Methods // // Methods //
that.label = function() { that.getLabel = function() {
return 'saveDocument'; return 'saveDocument';
}; };
......
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
option.onDone = option.onDone || function(){}; option.onDone = option.onDone || function(){};
option.onFail = option.onFail || function(){}; option.onFail = option.onFail || function(){};
option.max_retry = option.max_retry || 0; option.max_retry = option.max_retry || 0;
console.log ('add job save: ' + JSON.stringify (priv.storage.serialized()));
jobManager.addJob( jobManager.addJob(
job({storage:(specificstorage? job({storage:(specificstorage?
jioNamespace.storage(specificstorage): jioNamespace.storage(specificstorage):
......
...@@ -18,9 +18,9 @@ var jioNamespace = (function(spec, my) { ...@@ -18,9 +18,9 @@ var jioNamespace = (function(spec, my) {
spec = spec || {}; spec = spec || {};
var type = spec.type || 'base'; var type = spec.type || 'base';
if (!storage_type_o[type]) { if (!storage_type_o[type]) {
throw invalidStorageType({type:type}); throw invalidStorageType({type:type,
message:'Storage does not exists.'});
} }
console.log ('create storage: ' + JSON.stringify (spec) + JSON.stringify (my));
return storage_type_o[type](spec, my); return storage_type_o[type](spec, my);
}; };
...@@ -40,7 +40,6 @@ var jioNamespace = (function(spec, my) { ...@@ -40,7 +40,6 @@ var jioNamespace = (function(spec, my) {
storage = JSON.parse (storage); storage = JSON.parse (storage);
} }
storage = storage || {type:'base'}; storage = storage || {type:'base'};
console.log ('new jio: storage: ' + JSON.stringify (spec));
return jio(spec); return jio(spec);
}; };
...@@ -56,7 +55,6 @@ var jioNamespace = (function(spec, my) { ...@@ -56,7 +55,6 @@ var jioNamespace = (function(spec, my) {
throw invalidStorageType({type:type,message:'Already known.'}); throw invalidStorageType({type:type,message:'Already known.'});
} }
storage_type_o[type] = constructor; storage_type_o[type] = constructor;
console.log ('adding: '+type);
}; };
return that; return that;
......
...@@ -8,8 +8,6 @@ var job = function(spec, my) { ...@@ -8,8 +8,6 @@ var job = function(spec, my) {
priv.command = spec.command; priv.command = spec.command;
priv.storage = spec.storage; priv.storage = spec.storage;
priv.status = initialStatus(); priv.status = initialStatus();
priv.tried = 0;
priv.max_retry = 0;
priv.date = new Date(); priv.date = new Date();
// Initialize // // Initialize //
...@@ -43,6 +41,10 @@ var job = function(spec, my) { ...@@ -43,6 +41,10 @@ var job = function(spec, my) {
return priv.storage; return priv.storage;
}; };
that.getDate = function() {
return priv.date;
};
/** /**
* Checks if the job is ready. * Checks if the job is ready.
* @method isReady * @method isReady
...@@ -64,8 +66,6 @@ var job = function(spec, my) { ...@@ -64,8 +66,6 @@ var job = function(spec, my) {
that.serialized = function() { that.serialized = function() {
return {id:priv.id, return {id:priv.id,
date:priv.date.getTime(), date:priv.date.getTime(),
tried:priv.tried,
max_retry:priv.max_retry,
status:priv.status.serialized(), status:priv.status.serialized(),
command:priv.command.serialized(), command:priv.command.serialized(),
storage:priv.storage.serialized()}; storage:priv.storage.serialized()};
...@@ -122,7 +122,13 @@ var job = function(spec, my) { ...@@ -122,7 +122,13 @@ var job = function(spec, my) {
* @param {object} job The other job. * @param {object} job The other job.
*/ */
that.update = function(job) { that.update = function(job) {
console.log ('updating');
priv.command.setMaxRetry(-1);
priv.command.fail({status:0,statusText:'Replaced',
message:'Job has been replaced by another one.'});
priv.date = job.getDate(); priv.date = job.getDate();
priv.command = job.getCommand();
priv.status = job.getStatus();
}; };
that.execute = function() { that.execute = function() {
...@@ -134,7 +140,14 @@ var job = function(spec, my) { ...@@ -134,7 +140,14 @@ var job = function(spec, my) {
throw jobNotReadyException({message:'Can not execute this job.'}); throw jobNotReadyException({message:'Can not execute this job.'});
} }
priv.status = onGoingStatus(); priv.status = onGoingStatus();
priv.tried ++; priv.command.onRetryDo (function() {
var ms = priv.command.getTried();
ms = ms*ms*200;
if (ms>10000){
ms = 10000;
}
that.waitForTime(ms);
});
priv.command.onEndDo (function() { priv.command.onEndDo (function() {
jobManager.terminateJob (that); jobManager.terminateJob (that);
}); });
......
...@@ -53,6 +53,7 @@ var jobManager = (function(spec, my) { ...@@ -53,6 +53,7 @@ var jobManager = (function(spec, my) {
var i; var i;
if (priv.interval_id === null) { if (priv.interval_id === null) {
priv.interval_id = setInterval (function() { priv.interval_id = setInterval (function() {
priv.restoreOldJio();
for (i = 0; i < priv.job_a.length; i+= 1) { for (i = 0; i < priv.job_a.length; i+= 1) {
that.execute(priv.job_a[i]); that.execute(priv.job_a[i]);
} }
...@@ -74,6 +75,47 @@ var jobManager = (function(spec, my) { ...@@ -74,6 +75,47 @@ var jobManager = (function(spec, my) {
} }
}; };
priv.restoreOldJio = function() {
var i, jio_id_a;
priv.lastrestore = priv.lastrestore || 0;
if (priv.lastrestore > (Date.now()) - 2000) { return; }
jio_id_a = LocalOrCookieStorage.getItem('jio/id_array')||[];
for (i = 0; i < jio_id_a.length; i+= 1) {
priv.restoreOldJioId(jio_id_a[i]);
}
priv.lastrestore = Date.now();
};
priv.restoreOldJioId = function(id) {
var jio_date;
jio_date = LocalOrCookieStorage.getItem('jio/id/'+id)||0;
if (jio_date < Date.now() - 10000) {
priv.restoreOldJobFromJioId(id);
priv.removeOldJioId(id);
}
};
priv.restoreOldJobFromJioId = function(id) {
var i, jio_job_array;
jio_job_array = LocalOrCookieStorage.getItem('jio/job_array/'+id)||[];
for (i = 0; i < jio_job_array.length; i+= 1) {
that.addJob ( job(
{storage:jioNamespace.storage(jio_job_array[i]),
command:command(jio_job_array[i].command)}));
}
};
priv.removeOldJioId = function(id) {
var i, jio_id_a, new_a = [];
jio_id_a = LocalOrCookieStorage.getItem('jio/id_array')||[];
for (i = 0; i < jio_id_a.length; i+= 1) {
if (jio_id_a[i] !== id) {
new_a.push(jio_id_a[i]);
}
}
LocalOrCookieStorage.setItem('jio/id_array',new_a);
};
/** /**
* Executes a job. * Executes a job.
* @method execute * @method execute
...@@ -92,6 +134,18 @@ var jobManager = (function(spec, my) { ...@@ -92,6 +134,18 @@ var jobManager = (function(spec, my) {
priv.copyJobArrayToLocal(); priv.copyJobArrayToLocal();
}; };
that.jobIdExists = function(id) {
var i;
for (i = 0; i < priv.job_a.length; i+= 1) {
if (priv.job_a[i].getId() === id) {
console.log ('found');
return true;
}
}
console.log ('not found');
return false;
};
that.terminateJob = function(job) { that.terminateJob = function(job) {
priv.removeJob(job); priv.removeJob(job);
priv.copyJobArrayToLocal(); priv.copyJobArrayToLocal();
...@@ -100,7 +154,6 @@ var jobManager = (function(spec, my) { ...@@ -100,7 +154,6 @@ var jobManager = (function(spec, my) {
that.addJob = function(job) { that.addJob = function(job) {
var result_a = that.validateJobAccordingToJobList (priv.job_a,job); var result_a = that.validateJobAccordingToJobList (priv.job_a,job);
priv.manage (job,result_a); priv.manage (job,result_a);
priv.copyJobArrayToLocal();
}; };
that.validateJobAccordingToJobList = function(job_a,job) { that.validateJobAccordingToJobList = function(job_a,job) {
...@@ -121,16 +174,19 @@ var jobManager = (function(spec, my) { ...@@ -121,16 +174,19 @@ var jobManager = (function(spec, my) {
return; return;
} }
} }
console.log ('managing '+JSON.stringify (result_a));
for (i = 0; i < result_a.length; i+= 1) { for (i = 0; i < result_a.length; i+= 1) {
switch (result_a[i].action) { switch (result_a[i].action) {
case 'eliminate': case 'eliminate':
console.log ('eliminating');
that.eliminate(result_a[i].job); that.eliminate(result_a[i].job);
break; break;
case 'replace': case 'update':
job.update(result_a[i].job); result_a[i].job.update(job);
priv.copyJobArrayToLocal(); priv.copyJobArrayToLocal();
return; return;
case 'wait': case 'wait':
console.log ('wait');
job.waitForJob(result_a[i].job); job.waitForJob(result_a[i].job);
break; break;
default: break; default: break;
...@@ -145,10 +201,12 @@ var jobManager = (function(spec, my) { ...@@ -145,10 +201,12 @@ var jobManager = (function(spec, my) {
for (i = 0; i < priv.job_a.length; i+= 1) { for (i = 0; i < priv.job_a.length; i+= 1) {
if (priv.job_a[i].getId() !== job.getId()) { if (priv.job_a[i].getId() !== job.getId()) {
tmp_a.push(priv.job_a[i]); tmp_a.push(priv.job_a[i]);
console.log ('add: '+priv.job_a[i].getId()+' -> it is not '+job.getId());
} }
} }
priv.job_a = tmp_a; priv.job_a = tmp_a;
priv.copyJobArrayToLocal();
}; };
return that; return that;
}()); }());
\ No newline at end of file
...@@ -12,8 +12,8 @@ var jobRules = (function(spec, my) { ...@@ -12,8 +12,8 @@ var jobRules = (function(spec, my) {
}; };
priv.default_compare = function(job1,job2) { priv.default_compare = function(job1,job2) {
return (job1.getCommand().getPath() === job2.getCommand().getPath() && return (job1.getCommand().getPath() === job2.getCommand().getPath() &&
JSON.stringify(job1.getStorage()) === JSON.stringify(job1.getStorage().serialized()) ===
JSON.stringify(job2.getStorage())); JSON.stringify(job2.getStorage().serialized()));
}; };
priv.action = { priv.action = {
/* /*
...@@ -130,7 +130,7 @@ var jobRules = (function(spec, my) { ...@@ -130,7 +130,7 @@ var jobRules = (function(spec, my) {
} }
} }
}; };
priv.default_action = 'none'; priv.default_action = that.none;
// Methods // // Methods //
priv.getAction = function(job1,job2) { priv.getAction = function(job1,job2) {
var j1label, j2label, j1status; var j1label, j2label, j1status;
...@@ -139,24 +139,36 @@ var jobRules = (function(spec, my) { ...@@ -139,24 +139,36 @@ var jobRules = (function(spec, my) {
j1status = (job1.getStatus().getLabel()==='on going'? j1status = (job1.getStatus().getLabel()==='on going'?
'on going':'not on going'); 'on going':'not on going');
try { try {
console.log (j1label);
console.log (j2label);
console.log (j1status);
return priv.action[j1label][j1status][j2label](job1,job2); return priv.action[j1label][j1status][j2label](job1,job2);
} catch (e) { } catch (e) {
return priv.default_action; if(e.name==='TypeError') {
return priv.default_action(job1,job2);
} else {
throw e;
}
} }
}; };
priv.canCompare = function(job1,job2) { priv.canCompare = function(job1,job2) {
var key = priv.stringifyJobForCompare(job1,job2); var job1label = job1.getCommand().getLabel(),
if (priv.compare[key]) { job2label = job2.getCommand().getLabel();
return priv.compare[key](job1,job2); try {
return priv.compare[job1label][job2label](job1,job2);
} catch(e) {
if (e.name==='TypeError') {
return priv.default_compare(job1,job2);
} else {
throw e;
}
} }
return priv.default_compare(job1,job2);
}; };
that.validateJobAccordingToJob = function(job1,job2) { that.validateJobAccordingToJob = function(job1,job2) {
var key = priv.stringifyJobForAction(job1,job2);
if (priv.canCompare(job1,job2)) { if (priv.canCompare(job1,job2)) {
return {action:priv.getAction(job1,job2),job:job1}; return {action:priv.getAction(job1,job2),job:job1};
} }
return {action:priv.default_action,job:job1}; return {action:priv.default_action(job1,job2),job:job1};
}; };
return that; return that;
......
...@@ -15,4 +15,4 @@ var failStatus = function(spec, my) { ...@@ -15,4 +15,4 @@ var failStatus = function(spec, my) {
return true; return true;
}; };
return that; return that;
}; };
\ No newline at end of file
...@@ -3,50 +3,63 @@ var waitStatus = function(spec, my) { ...@@ -3,50 +3,63 @@ var waitStatus = function(spec, my) {
spec = spec || {}; spec = spec || {};
my = my || {}; my = my || {};
// Attributes // // Attributes //
var job_id_a = spec.job_id_array || []; var priv = {};
var threshold = 0; priv.job_id_a = spec.job_id_array || [];
priv.threshold = 0;
// Methods // // Methods //
that.getLabel = function() { that.getLabel = function() {
return 'wait'; return 'wait';
}; };
priv.refreshJobIdArray = function() {
var tmp_job_id_a = [], i;
for (i = 0; i < priv.job_id_a.length; i+= 1) {
if (jobManager.jobIdExists(priv.job_id_a[i])) {
tmp_job_id_a.push(priv.job_id_a[i]);
}
}
priv.job_id_a = tmp_job_id_a;
};
that.waitForJob = function(job) { that.waitForJob = function(job) {
var i; var i;
for (i = 0; i < job_id_a.length; i+= 1) { for (i = 0; i < priv.job_id_a.length; i+= 1) {
if (job_id_a[i] === job.getId()) { if (priv.job_id_a[i] === job.getId()) {
return; return;
} }
} }
job_id_a.push(job.getId()); priv.job_id_a.push(job.getId());
}; };
that.dontWaitForJob = function(job) { that.dontWaitForJob = function(job) {
var i, tmp_job_id_a = []; var i, tmp_job_id_a = [];
for (i = 0; i < job_id_a.length; i+= 1) { for (i = 0; i < priv.job_id_a.length; i+= 1) {
if (job_id_a[i] !== job.getId()){ if (priv.job_id_a[i] !== job.getId()){
tmp_job_id_a.push(job_id_a[i]); tmp_job_id_a.push(priv.job_id_a[i]);
} }
} }
job_id_a = tmp_job_id_a; priv.job_id_a = tmp_job_id_a;
}; };
that.waitForTime = function(ms) { that.waitForTime = function(ms) {
threshold = Date.now() + ms; priv.threshold = Date.now() + ms;
}; };
that.stopWaitForTime = function() { that.stopWaitForTime = function() {
threshold = 0; priv.threshold = 0;
}; };
that.canStart = function() { that.canStart = function() {
return (job_id_a.length === 0 && Date.now() >= threshold); priv.refreshJobIdArray();
console.log (priv.job_id_a);
return (priv.job_id_a.length === 0 && Date.now() >= priv.threshold);
}; };
that.canRestart = function() { that.canRestart = function() {
return false; return that.canStart();
}; };
that.serialized = function() { that.serialized = function() {
return {label:that.getLabel(), return {label:that.getLabel(),
waitfortime:threshold, waitfortime:priv.threshold,
waitforjob:job_id_a}; waitforjob:priv.job_id_a};
}; };
return that; return that;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment