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

Tweaked invoker and added tests #540

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

aryans1204
Copy link

Summary

A small summary of the requirements (in one/two sentences).

Implementation Notes ⚒️

  • Briefly outline the overall technical solution. If necessary, identify talking points where the reviewer's attention should be drawn to.

External Dependencies 🍀

Breaking API Changes ⚠️

Simply specify none (N/A) if not applicable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Split it into two files: gprc_invoker and grpc_vswarm_invoker. Also there is a weird indentation going on, please run through gofmt.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are still issues with indentations. There is an additional space on each line. Please run it through gofmt.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is no point in touching this file at all. You swapped a couple of lines and renamed one of the imports, nothing substantial.

pkg/driver/clients/grpc_client_test.go Outdated Show resolved Hide resolved
pkg/driver/clients/grpc_client_test.go Outdated Show resolved Hide resolved
pkg/driver/clients/vhivemetadata.go Outdated Show resolved Hide resolved
newinvoker := CreateInvoker(cfgSwarm, nil, nil)

start = time.Now()
success, record = newinvoker.Invoke(&testFunction, &testRuntimeSpecs)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should fail. We deploy the same gRPC server as runs in the invitro images. It should fail to correctly respond to vSwarm invoker.

pkg/driver/clients/grpc_client_test.go Outdated Show resolved Hide resolved
@leokondrashov
Copy link
Contributor

I don't see the tests for the driver/clients actually running in the CI. Can you please check the workflow?

Also, there is a linter error, please fix.

@leokondrashov
Copy link
Contributor

Please squash your commits, sign off, and rebase the branch on current main.

@@ -18,7 +18,12 @@ func CreateInvoker(cfg *config.LoaderConfiguration, announceDoneExe *sync.WaitGr
return newAWSLambdaInvoker(announceDoneExe)
case "Dirigent", "Dirigent-RPS":
if cfg.InvokeProtocol == "grpc" {
return newGRPCInvoker(cfg)
if !cfg.VSwarm {
Copy link
Contributor

Choose a reason for hiding this comment

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

You put it into Dirigent mode, the intended place should be knative.

@aryans1204 aryans1204 force-pushed the new-vswarm-invoker branch 2 times, most recently from 39cdf02 to 4c372fb Compare November 13, 2024 16:38
@aryans1204
Copy link
Author

Hi, I've rebased on main and squashed and signed off my commits. I've also fixed the Dirigent mode to Knative mode. Please check

Copy link
Contributor

@leokondrashov leokondrashov left a comment

Choose a reason for hiding this comment

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

Please rebase and fix the indentation in pkg/driver/clients/grpc_client.go

@@ -62,5 +62,5 @@ func main() {
log.Infof("Function type: EMPTY\n")
}

standard.StartGRPCServer("", serverPort, functionType, *zipkin)
standard.StartGRPCServer("", serverPort, functionType, *zipkin, false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you extract the vSwarm from here? I don't like that we are introducing this vSwarm greeter into our Invitro workload. Since we are creating it just for testing, we don't need to reuse all of the features of the workload that we have (tracing, handling SIGTERM); you can just put this mock server into test file instead. Or if you can, you can try to reuse the relay server from vSwarm, not to duplicate the code.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed this, fixed the formatting as well and rebased on main. Please review again.

Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you did what I was asking for.

Since we use StartVSwarmGRPCServer only in tests, we don't need anything from it except the ability to accept and respond with VSwarm protobufs. So, you can significantly slim it down by removing everything unnecessary for the simplest gRPC server (signal handling, TraceFunctionExecution, tracing).

@aryans1204 aryans1204 force-pushed the new-vswarm-invoker branch 2 times, most recently from 197fbbc to af79127 Compare November 30, 2024 01:51
Copy link
Contributor

@leokondrashov leokondrashov left a comment

Choose a reason for hiding this comment

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

Please fix the failing linter test and look at the comment about test VSwarm server once again.

Comment on lines 71 to 73
if strings.Contains(strings.ToLower(i.cfg.Platform), "dirigent") {
dialOptions = append(dialOptions, grpc.WithAuthority(function.Name)) // Dirigent specific
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove that?

I don't see a reason to change this file at all. Can you clarify why do you need that?

Copy link
Author

Choose a reason for hiding this comment

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

Seems like this is a bad merge. Added the lines again.

}
func TestVSwarmClientWithServerBatchWorkload(t *testing.T) {
logrus.SetLevel(logrus.TraceLevel)
err := os.Setenv("ITERATIONS_MULTIPLIER", "225")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed for any VSwarm functions.

Copy link
Author

Choose a reason for hiding this comment

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

Removed this test

@@ -62,5 +62,5 @@ func main() {
log.Infof("Function type: EMPTY\n")
}

standard.StartGRPCServer("", serverPort, functionType, *zipkin)
standard.StartGRPCServer("", serverPort, functionType, *zipkin, false)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you did what I was asking for.

Since we use StartVSwarmGRPCServer only in tests, we don't need anything from it except the ability to accept and respond with VSwarm protobufs. So, you can significantly slim it down by removing everything unnecessary for the simplest gRPC server (signal handling, TraceFunctionExecution, tracing).

@aryans1204 aryans1204 force-pushed the new-vswarm-invoker branch 3 times, most recently from c447b94 to 46a4c3b Compare December 13, 2024 12:19
Signed-off-by: aryans1204 <[email protected]>

Add VHIVE_REPO and LOADER_REPO to setup script config

Signed-off-by: Mohsen Ghasemi <[email protected]>

Added tests and created new vSwarm invoker

Fixed linting

Fixed VSwarm Invoker for Knative mode

Committer: aryans1204 [email protected]

Fixed VSwarm Invoker for Knative mode

Added new invoker for vSwarm functions and added tests

Signed-off-by: aryans1204 <[email protected]>

Fixed formatting under grpc_client.go

Signed-off-by: aryans1204 <[email protected]>

Fixed driver tests

Signed-off-by: aryans1204 <[email protected]>

Fixed linting and slimmed VSwarm tests

Signed-off-by: aryans1204 <[email protected]>

Fixed linting errors

Signed-off-by: aryans1204 <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is no point in touching this file at all. You swapped a couple of lines and renamed one of the imports, nothing substantial.

type vSwarmServer struct {
helloworld.UnimplementedGreeterServer
}
func (s *vSwarmServer) SayHello(_ context.Context, req *helloworld.HelloRequest) (*helloworld.HelloReply, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is used only for tests. Please remove everything except the return statement in the body and move this together with StartVSwarmGRPCServer to the respective test file.

Please re-read previous comments, I've mentioned slimming down this part and moving to the test file several times already.

Comment on lines +87 to +92
record.Instance = extractInstanceName(response.GetMessage())
if strings.HasPrefix(response.GetMessage(), "FAILURE - mem_alloc") {
record.MemoryAllocationTimeout = true
} else {
record.ActualMemoryUsage = common.Kib2Mib(0)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this make sense with the messages that the relay sends? Here, we rely on our workload to fill the message with instance ID or failure message. Does the relay do the same? I doubt that

Comment on lines +86 to +88

}
func TestVSwarmClientUnreachable(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The blank line should be between the closing brace and new function, not inside the previous function. Please format carefully and look at all of your changes for similar inconsistent formatting.

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.

2 participants