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

Proposed Changes QSB Frameworks #2

Conversation

kiranprakash154
Copy link

@kiranprakash154 kiranprakash154 commented May 13, 2024

You can still review this even though it is in draft. You can ignore the merge conflicts for now, the files and their changes are still visible, the conflicts are mainly due to renaming of ResourceLimitGroup to sandbox.

Description

This draft PR proposes changes to Kaushal's PR - opensearch-project#13311

Changes include :

  • Change ResourceLimitGroup to Sandbox. Either of the names work but ResourceLimitGroup seems a bit too long, so until that is settled, i'm referring to this as Sandbox.
  • framework related changes in
    • TaskCancellationStrategy & AbstractTaskCancellationStrategy
    • SandboxService
  • Introducing new classes TaskData, ResourceUsageData, SandboxResourceTaskComposite and CancellationContext as the DTO (Data Transfer Object) for the Sandbox Service to coordinate data.

Intention of the PR -

Get feedback from @kaushalmahi12 & @jainankitk and incorporate them.
Frameworks related PR depends on the PR Kaushal will soon create to make Sandbox (or RLG) and its schema available in main.

@kiranprakash154 kiranprakash154 self-assigned this May 13, 2024
@kiranprakash154 kiranprakash154 changed the title changes on Kaushal's branch Proposed Changes to https://github.com/opensearch-project/OpenSearch/pull/13311 May 13, 2024
@kiranprakash154 kiranprakash154 changed the title Proposed Changes to https://github.com/opensearch-project/OpenSearch/pull/13311 Proposed Changes QSB Frameworks May 13, 2024
Copy link

@jainankitk jainankitk left a comment

Choose a reason for hiding this comment

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

@kiranprakash154 - Can you limit this PR to non-renaming changes? Hard to review with all the stuff together

static final ParseField RESOURCE_VALUE_FIELD = new ParseField("value");
static final ParseField RESOURCE_TYPE_FIELD = new ParseField("resourceType");
static final ParseField THRESHOLD_FIELD = new ParseField("threshold");
static final ParseField THRESHOLD_IN_LONG_FIELD = new ParseField("thresholdInLong");
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need this parameter ?

Comment on lines +739 to +741
SandboxServiceSettings.MAX_RESOURCE_LIMIT_GROUP_COUNT,
SandboxServiceSettings.NODE_LEVEL_REJECTION_THRESHOLD,
SandboxServiceSettings.NODE_LEVEL_CANCELLATION_THRESHOLD
Copy link
Owner

Choose a reason for hiding this comment

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

We need to rename these to RESOURCE specific settings

*/

package org.opensearch.search.sandboxing;

Copy link
Owner

Choose a reason for hiding this comment

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

Can we add javadocs for these new classes wherever applicable ?


import java.util.Comparator;

public class LongestRunningTaskFirst extends AbstractTaskCancellationStrategy {
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should move these strategy classes into a package.

import java.util.Comparator;

public class MostResourceIntensiveTaskFirst extends AbstractTaskCancellationStrategy {
private final SandboxResourceType resourceType;
Copy link
Owner

Choose a reason for hiding this comment

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

We might have multiple resources in the future so we should keep this flexible and open to add more resource types.

public SandboxModule() {}

@Override
protected void configure() {
Copy link
Owner

Choose a reason for hiding this comment

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

This is no longer the case as we should be binding the interfaces to different implementations as discussed.

// Accumulate resource usage for each task in the sandbox
for (Task task : tasks) {
for (SandboxResourceType resourceType: TRACKED_RESOURCES) {
sandboxUsage.put(resourceType, resourceType.getResourceUsage(task));
Copy link
Owner

Choose a reason for hiding this comment

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

This logic is incorrect and the sandbox usage for a sandbox will only hold the resource usage for the last visited task.


import java.util.Map;

public class ResourceUsageData {
Copy link
Owner

Choose a reason for hiding this comment

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

Do we really need this class ? I would rather have this as a member variable of all the data related to sandbox.


import org.opensearch.tasks.Task;

public class TaskData {
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should move the data from this class and ResourceUsageData into CancellationContext instead of having multiple layers of indirection. SInce we are adding this code in core hence should minimise adding unnecessary construct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants