mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
assymetric queueing logic
allow tagged job execution on an untagged node, but not vice-versa. This allows the admin to assign tags for UI grouping without worrying about nodes at all
This commit is contained in:
parent
9aa172e8f5
commit
ae213b4f74
@ -529,16 +529,16 @@ bool Laminar::nodeCanQueue(const Node& node, const Run& run) const {
|
|||||||
if(node.busyExecutors >= node.numExecutors)
|
if(node.busyExecutors >= node.numExecutors)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto it = jobTags.find(run.name);
|
// if the node has no tags, allow the build
|
||||||
// if both nodes have no tags, it's OK
|
if(node.tags.size() == 0)
|
||||||
if(it == jobTags.end() && node.tags.size() == 0)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// but if just one of them does, don't allow the build
|
auto it = jobTags.find(run.name);
|
||||||
if(it == jobTags.end() || node.tags.size() == 0)
|
// if the job has no tags, it cannot be run on this node
|
||||||
|
if(it == jobTags.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// in other cases, allow the build if they have a tag in common
|
// otherwise, allow the build if job and node have a tag in common
|
||||||
for(const std::string& tag : it->second) {
|
for(const std::string& tag : it->second) {
|
||||||
if(node.tags.find(tag) != node.tags.end())
|
if(node.tags.find(tag) != node.tags.end())
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user