lib/workflow-in-memory-backend.js
function validateJobTarget(job, callback) {
            // If no target is given, we don't care:
            if (!job.target) {
                return callback(null);
            }

            var locked = _lockedTargets().some(function (r) {
                var re = new RegExp(r);
                return (re.test(job.target));
            });

            if (locked) {
                return callback(new e.BackendInvalidArgumentError(
                    'Job target is currently locked by another job'));
            }

            if (_jobTargets().indexOf(job.target) === -1) {
                return callback(null);
            }

            var filtered = Object.keys(jobs).filter(function (uuid) {
                return (
                  uuid !== job.uuid &&
                  jobs[uuid].target === job.target &&
                  Object.keys(job.params).every(function (p) {
                    return (jobs[uuid].params[p] &&
                      jobs[uuid].params[p] === job.params[p]);
                }) &&
                  (jobs[uuid].execution === 'queued' ||
                   jobs[uuid].execution === 'running'));
            });

            if (filtered.length !== 0) {
                return callback(new e.BackendInvalidArgumentError(
                  'Another job with the same target' +
                  ' and params is already queued'));
            } else {
                return callback(null);
            }
        }
function validateJobTarget(job, callback) {
            // If no target is given, we don't care:
            if (!job.target) {
                return callback(null);
            }

            var locked = _lockedTargets().some(function (r) {
                var re = new RegExp(r);
                return (re.test(job.target));
            });

            if (locked) {
                return callback(new e.BackendInvalidArgumentError(
                    'Job target is currently locked by another job'));
            }

            if (_jobTargets().indexOf(job.target) === -1) {
                return callback(null);
            }

            var filtered = Object.keys(jobs).filter(function (uuid) {
                return (
                  uuid !== job.uuid &&
                  jobs[uuid].target === job.target &&
                  Object.keys(job.params).every(function (p) {
                    return (jobs[uuid].params[p] &&
                      jobs[uuid].params[p] === job.params[p]);
                }) &&
                  (jobs[uuid].execution === 'queued' ||
                   jobs[uuid].execution === 'running'));
            });

            if (filtered.length !== 0) {
                return callback(new e.BackendInvalidArgumentError(
                  'Another job with the same target' +
                  ' and params is already queued'));
            } else {
                return callback(null);
            }
        }
job - the job object callback - f(err) called with error in case there is a duplicated job with the same target and same params