Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent out of the setting only_run_on_ml_node #2299

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public DiscoveryNode[] getEligibleNodes(FunctionName functionName) {
if (excludedNodeNames != null && excludedNodeNames.contains(node.getName())) {
continue;
}
if (functionName == FunctionName.REMOTE) {// remote model
if (functionName == FunctionName.REMOTE || functionName == FunctionName.AGENT) {// remote model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] update the comment as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

getEligibleNode(remoteModelEligibleNodeRoles, eligibleNodes, node);
} else { // local model
if (onlyRunOnMLNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private MLCommonsSettings() {}
public static final Setting<Integer> ML_COMMONS_MAX_ML_TASK_PER_NODE = Setting
.intSetting("plugins.ml_commons.max_ml_task_per_node", 10, 0, 10000, Setting.Property.NodeScope, Setting.Property.Dynamic);
public static final Setting<Boolean> ML_COMMONS_ONLY_RUN_ON_ML_NODE = Setting
.boolSetting("plugins.ml_commons.only_run_on_ml_node", false, Setting.Property.NodeScope, Setting.Property.Dynamic);
.boolSetting("plugins.ml_commons.only_run_on_ml_node", true, Setting.Property.NodeScope, Setting.Property.Dynamic);

public static final Setting<Boolean> ML_COMMONS_ENABLE_INHOUSE_PYTHON_MODEL = Setting
.boolSetting("plugins.ml_commons.enable_inhouse_python_model", false, Setting.Property.NodeScope, Setting.Property.Dynamic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ public void testGetEligibleNodes_MLNode_RemoteModel() {
assertFalse(nodeIds.contains(warmDataNode1.getId()));
}

public void testGetEligibleNodes_MLNode_Agent() {
DiscoveryNode[] eligibleNodes = discoveryNodeHelper.getEligibleNodes(FunctionName.AGENT);
assertEquals(5, eligibleNodes.length);
Set<String> nodeIds = new HashSet<>();
nodeIds.addAll(Arrays.asList(eligibleNodes).stream().map(n -> n.getId()).collect(Collectors.toList()));
assertTrue(nodeIds.contains(mlNode1.getId()));
assertTrue(nodeIds.contains(mlNode2.getId()));
assertTrue(nodeIds.contains(dataNode1.getId()));
assertTrue(nodeIds.contains(dataNode2.getId()));
assertTrue(nodeIds.contains(allRoleNode.getId()));
assertFalse(nodeIds.contains(warmDataNode1.getId()));
}

public void testGetEligibleNodes_MLNode_LocalModel() {
DiscoveryNode[] eligibleNodes = discoveryNodeHelper.getEligibleNodes(FunctionName.TEXT_EMBEDDING);
assertEquals(3, eligibleNodes.length);
Expand Down
Loading