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

Revert PayloadProcessor ModelId to remain consistent with original value #113

Closed
wants to merge 1 commit into from

Conversation

RobGeada
Copy link

@RobGeada RobGeada commented Oct 17, 2023

Motivation

PR 90 changed the modelId passed to the PayloadProcessor to the resolvedModelId, instead of the originalmodelOrVModelId.

Modifications

This PR reverts this change to restore the expected model ID to modelOrVModelId, whose value is either found inside vModelId or resolvedModelId depending on the flag isvModel

Result

modelId remains consistent with previous behaviour in payload processor payloads

@kserve-oss-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: RobGeada
To complete the pull request process, please assign rafvasq after the PR has been reviewed.
You can assign the PR to them by writing /assign @rafvasq in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@RobGeada RobGeada changed the title Revert PayloadProcessor ModelId to expected value Revert PayloadProcessor ModelId to remain consistent with original value Oct 17, 2023
@RobGeada RobGeada changed the title Revert PayloadProcessor ModelId to remain consistent with original value Revert PayloadProcessor ModelId to remain consistent with original value if possible Oct 17, 2023
@RobGeada RobGeada changed the title Revert PayloadProcessor ModelId to remain consistent with original value if possible Revert PayloadProcessor ModelId to remain consistent with original value Oct 17, 2023
@ckadner
Copy link
Member

ckadner commented Oct 17, 2023

@RobGeada -- can you add some details on how to test this fix? And it would be great to add a unit test as well

@ckadner ckadner self-requested a review October 17, 2023 18:53
@ckadner ckadner added this to the v0.11.1 milestone Oct 17, 2023
Copy link
Member

@ckadner ckadner left a comment

Choose a reason for hiding this comment

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

Thanks @RobGeada -- could you add a unit test that teases out the bug and shows how your change fixes it? The test should fail before your fix and pass with your fix. Thank you!

@RobGeada
Copy link
Author

RobGeada commented Oct 25, 2023

@ckadner it isn't actually a bug that this PR is fixing, it's just reverting to an older behavior. Prior to #90, the PayloadProcessor received the following modelId:

processPayload(reqMessage.readerIndex(reqReaderIndex),requestId, modelId, ...)
where String modelId = validateModelId(midIt.next(), isVModel); (L724)

After PR90, the payload processor receives:

processPayload(reqMessage.readerIndex(reqReaderIndex),requestId, resolvedModelId, ...)

where resolvedModelId is set by the following conditions:

String modelOrVModelId = validateModelId(midIt.next(), isVModel);
if (isVModel){
    vModelId = modelOrVModelId;
    resolvedModelId = ModelMeshApi.resolvedModelId.getIfExists();
} else {
    // vModelId remains null in this case
    resolvedModelId = modelOrVModelId;
} 

(see code here)

Essentially, the payload process used to receive the output of validateModelId(midIt.next(), isVModel), which is now stored in modelOrVModelId. We know that modelOrVModelId is stored into either vModelId or resolvedModelId depending on if isVModel is true or false, respectively. This PR checks which variable holds the modelOrVModelId value by checking if vModelId is null (in theory, we could just check isVModel), and then grabbing the value from the correct variable:

String payloadModelId = vModelId == null ? resolvedModelId : vModelId;

therefore restoring the original behavior.

@ckadner ckadner assigned ckadner and njhill and unassigned ckadner Oct 31, 2023
@RobGeada
Copy link
Author

@njhill any updates here?

@njhill
Copy link
Member

njhill commented Nov 13, 2023

@RobGeada apologies for the delay in getting to this. I think the reason that this was changed in #90 was to ensure consistency. I don't think it's good for the payload processor to get this id without knowing whether it's a model or vModel id.

When used as part of kserve/modelmesh-serving, the model id will always be the vModel id with some additional suffix. Do you think that this would be sufficient for your purposes? Otherwise we should probably just add a (possibly-null) vModelId string field to the Payload class.

@njhill
Copy link
Member

njhill commented Nov 13, 2023

And if we did the latter, we could even also add a Payload#getVModelOrModelId() method

@njhill
Copy link
Member

njhill commented Nov 13, 2023

Also related: #88

@RobGeada
Copy link
Author

Yeah, that works for me, I'll close this

@RobGeada RobGeada closed this Nov 14, 2023
@njhill
Copy link
Member

njhill commented Nov 16, 2023

@RobGeada I've opened #123 for this. Would you mind reviewing it?

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.

4 participants