+
Skip to content

Conversation

WashingtonKK
Copy link
Contributor

What type of PR is this?

This is an enhancement since it enhances computation termination by sending back a response on the status of the activity.

What does this do?

This returns a response on computation termination to inform the user on the status of computation termination.

Which issue(s) does this PR fix/relate to?

No issue

Have you included tests for your changes?

Tested manually.

Did you document any new/modified feature?

Notes

Required for: https://github.com/ultravioletrs/prism/pull/407

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Comment on lines 76 to 96
msg := &pkgmanager.ClientStreamMessage_StopComputationRes{StopComputationRes: &pkgmanager.StopComputationResponse{
ComputationId: mes.StopComputation.ComputationId,
}}
if err := client.svc.Stop(ctx, mes.StopComputation.ComputationId); err != nil {
if errors.Contains(err, manager.ErrNotFound) {
msg.StopComputationRes.Message = err.Error()
msg.StopComputationRes.Stopped = false
if err := client.stream.Send(&pkgmanager.ClientStreamMessage{Message: msg}); err != nil {
return err
}
return nil
}
msg.StopComputationRes.Message = err.Error()
msg.StopComputationRes.Stopped = false
if err := client.stream.Send(&pkgmanager.ClientStreamMessage{Message: msg}); err != nil {
return err
}
return err
}
msg.StopComputationRes.Stopped = true
if err := client.stream.Send(&pkgmanager.ClientStreamMessage{Message: msg}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

refactor and simplify definition of the stop message and sending it. ideally you should have only one stream send and one definition of the message.

Comment on lines 26 to 27
bool stopped = 2;
string message = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

you probably don't need stopped, message can be an empty string for nil error and some message in case of error

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
assert.Len(t, ms.vms, 0)
}

// Clear the events channel
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Clear the events channel

return ErrNotFound
}
if err := cvm.Stop(); err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

another event here

Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
@drasko drasko merged commit 7155027 into ultravioletrs:main Aug 23, 2024
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

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载