Merge pull request #660 from HaveAGitGat/tags_fix

Tags subset fix
make-only-subtitle-default
HaveAGitGat 2 years ago committed by GitHub
commit c132a2f864
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,7 +4,7 @@ exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Tags: Requeue',
description: "\nPlace the file back in the staging queue with specific tags.\n\nOnly Nodes/Workers which match the tags will be able to process the file.\n\nThe tags must have one of the following: 'requireCPU', 'requireGPU', or 'requireCPUorGPU'.\n\nThe above tells the server what type of worker is required to process the file.\n\nSubsequent tags must not use the reserved word 'require' in them.\n\nYou can set the 'Node Tags' in the Node options panel.\n\nThe the item tags in the staging section must be a subset of the required tags for a worker to process the file.\n",
description: "\nPlace the file back in the staging queue with specific tags.\n\nOnly Nodes/Workers which match the tags will be able to process the file.\n\nThe tags must have one of the following: 'requireCPU', 'requireGPU', or 'requireCPUorGPU'.\n\nThe above tells the server what type of worker is required to process the file.\n\nSubsequent tags must not use the reserved word 'require' in them.\n\nYou can set the 'Node Tags' in the Node options panel.\n\nA worker will only process a file if the Custom Queue Tags are a subset of the Worker/Node Tags\n",
style: {
borderColor: 'yellow',
},

@ -4,7 +4,7 @@ exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Tags: Worker Type',
description: "\nRequeues the item into the staging section if the current worker\ndoes not match the required worker type and tags.\n\nYou can set the 'Node Tags' in the Node options panel.\n\nThe current tags must be a subset of the required tags.\n ",
description: "\nRequeues the item into the staging section if the current worker\ndoes not match the required worker type and tags.\n\nYou can set the 'Node Tags' in the Node options panel.\n\nThe required tags must be a subset of the current tags for the current worker to process the item,\nelse the item will be requeued with the required tags.\n ",
style: {
borderColor: 'yellow',
},
@ -91,22 +91,26 @@ var plugin = function (args) {
args.jobLog("Required Tags: ".concat(requiredTags.join(',')));
args.jobLog("Current Tags: ".concat(currentTags.join(',')));
var isSubset = true;
for (var i = 0; i < currentTags.length; i += 1) {
if (!requiredTags.includes(currentTags[i])) {
for (var i = 0; i < requiredTags.length; i += 1) {
if (!currentTags.includes(requiredTags[i])) {
isSubset = false;
break;
}
}
// requiredTags needs to be subset of currentTags
args.jobLog("Current tags: ".concat(currentTags));
args.jobLog("Required tags: ".concat(requiredTags));
args.jobLog("Is Subset: ".concat(isSubset));
if (isSubset) {
// eslint-disable-next-line no-param-reassign
args.variables.queueTags = '';
args.jobLog('Worker type and tags are subset of required tags');
args.jobLog('Required tags are subset of current tags, continuing to next plugin.');
}
else {
args.jobLog('Required tags are not subset of current tags, requeueing.');
// eslint-disable-next-line no-param-reassign
args.variables.queueTags = requiredTags.join(',');
args.jobLog('Worker type and tags are not subset of required tags,'
+ " requeueing with tags ".concat(args.variables.queueTags));
args.jobLog("Requeueing with tags ".concat(args.variables.queueTags));
}
return {
outputFileObj: args.inputFileObj,

@ -20,7 +20,7 @@ Subsequent tags must not use the reserved word 'require' in them.
You can set the 'Node Tags' in the Node options panel.
The the item tags in the staging section must be a subset of the required tags for a worker to process the file.
A worker will only process a file if the Custom Queue Tags are a subset of the Worker/Node Tags
`,
style: {
borderColor: 'yellow',

@ -13,7 +13,8 @@ does not match the required worker type and tags.
You can set the 'Node Tags' in the Node options panel.
The current tags must be a subset of the required tags.
The required tags must be a subset of the current tags for the current worker to process the item,
else the item will be requeued with the required tags.
`,
style: {
borderColor: 'yellow',
@ -109,22 +110,26 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
let isSubset = true;
for (let i = 0; i < currentTags.length; i += 1) {
if (!requiredTags.includes(currentTags[i])) {
for (let i = 0; i < requiredTags.length; i += 1) {
if (!currentTags.includes(requiredTags[i])) {
isSubset = false;
break;
}
}
// requiredTags needs to be subset of currentTags
args.jobLog(`Current tags: ${currentTags}`);
args.jobLog(`Required tags: ${requiredTags}`);
args.jobLog(`Is Subset: ${isSubset}`);
if (isSubset) {
// eslint-disable-next-line no-param-reassign
args.variables.queueTags = '';
args.jobLog('Worker type and tags are subset of required tags');
args.jobLog('Required tags are subset of current tags, continuing to next plugin.');
} else {
args.jobLog('Required tags are not subset of current tags, requeueing.');
// eslint-disable-next-line no-param-reassign
args.variables.queueTags = requiredTags.join(',');
args.jobLog('Worker type and tags are not subset of required tags,'
+ ` requeueing with tags ${args.variables.queueTags}`);
args.jobLog(`Requeueing with tags ${args.variables.queueTags}`);
}
return {

Loading…
Cancel
Save