-
Notifications
You must be signed in to change notification settings - Fork 0
Grpc manager #69
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
Merged
Merged
Grpc manager #69
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0289b97
worker-controller communication protocol
jcdkiki d6e222d
new communication protocol: wip
jcdkiki 22945b8
fix communication protocol
95fba68
fix linter errors
jcdkiki 3026f2c
fix linter errors in worker.hpp
jcdkiki 5bd5036
Merge branch 'main' into communication_protocol + wiki fix
jcdkiki e5cb5e3
Fix manager entrypoint
jcdkiki 6d2dd0b
fix integration test + small changes
jcdkiki d345487
fix manager_integration_test.sh
jcdkiki 90de7ef
adjust timings in manager_integration_test.sh
jcdkiki 98112a4
fix codestyle + refactor manager_integration_test
jcdkiki 68c216f
remove go worker
jcdkiki 0c9fbeb
combine grpc_server and manager
jcdkiki ca52a7f
Fix cpp linter errors
jcdkiki 3e8ac36
Merge branch 'main' into grpc_manager
jcdkiki 097033e
unstash some things
jcdkiki b4be9ee
adapted bazel build for new protocol
jcdkiki 45139d3
remove grpc_server test for now
jcdkiki 6f926ec
Merge branch 'main' into grpc_manager
jcdkiki 22d0392
add grpcserver_integration_test.sh
jcdkiki f222ce7
remove dangling bazel stuff
jcdkiki 776e42b
ignore proto files when linting
jcdkiki c769b01
fix .golangci.yml
jcdkiki 2a4c963
fix .golangci.yml 2
jcdkiki 73283fa
fix .golangci.yml 3
jcdkiki fa5a54d
Manager class + grpcserver testing with mocking
jcdkiki 6b35f80
generate pb go files in GH action
jcdkiki bda2518
fix grpcserver test.go
jcdkiki 5a5ab53
try fix 'import cycle not allowed in test'
jcdkiki 207dd7f
fix lint errors
jcdkiki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: manager integration test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
manager_integration_test: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Bazel via Bazelisk | ||
run: | | ||
sudo curl -L https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 -o /usr/local/bin/bazel | ||
sudo chmod +x /usr/local/bin/bazel | ||
|
||
- name: Run tests | ||
working-directory: ./ | ||
run: ./scripts/manager_integration_test.sh log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ run: | |
linters: | ||
enable: | ||
- gofmt | ||
- govet | ||
- govet |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
load("@rules_go//go:def.bzl", "go_binary", "go_library") | ||
|
||
go_binary( | ||
name = "manager", | ||
embed = [":manager_lib"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_library( | ||
name = "manager_lib", | ||
srcs = ["main.go"], | ||
importpath = "github.com/moevm/grpc_server/cmd/manager", | ||
visibility = ["//visibility:private"], | ||
deps = ["//internal/manager"], | ||
name = "manager", | ||
srcs = ["test.go"], | ||
deps = [ | ||
"//internal/manager", | ||
], | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"crypto/md5" | ||
"crypto/rand" | ||
"fmt" | ||
"log" | ||
"os" | ||
"time" | ||
|
||
"github.com/moevm/grpc_server/internal/manager" | ||
) | ||
|
||
func main() { | ||
tasks := make([][]byte, 5) | ||
tasks[0] = make([]byte, 30) | ||
tasks[1] = make([]byte, 188588) | ||
tasks[2] = make([]byte, 5138788) | ||
tasks[3] = make([]byte, 17338664) | ||
tasks[4] = make([]byte, 55777333) | ||
|
||
for i := range tasks { | ||
_, err := rand.Read(tasks[i]) | ||
if err != nil { | ||
log.Panic(err) | ||
} | ||
} | ||
|
||
expected := make([][16]byte, 5) | ||
for i, task := range tasks { | ||
expected[i] = md5.Sum(task) | ||
} | ||
|
||
mgr, err := manager.NewManager() | ||
if err != nil { | ||
log.Fatalf("manager.NewManager(): %v", err) | ||
} | ||
|
||
time.Sleep(10 * time.Second) | ||
|
||
ids := make(map[uint64]int, 5) | ||
for i, task := range tasks { | ||
id := mgr.AddTask(task, nil) | ||
ids[id] = i | ||
} | ||
|
||
for range 5 { | ||
solution := mgr.GetTaskSolution() | ||
task_id := ids[solution.Id] | ||
if !bytes.Equal(solution.Body, expected[task_id][:]) { | ||
fmt.Printf("%v != %v", solution.Body, expected[task_id][:]) | ||
os.Exit(1) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: иногда чтоб не перечислять всё по отдельности что нужно скопировать проще воспользоваться
.dockerignore