-
Notifications
You must be signed in to change notification settings - Fork 12
COCOS-165 - Add Docker support #180
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
Conversation
656d428
to
78d7204
Compare
test/manual/README.md
Outdated
# 2023/09/21 10:43:53 Uploading algorithm binary: test/manual/algo/lin_reg.bin | ||
|
||
# In order to run the Docker image, run the CLI program with the algorithm docker option | ||
go run ./cmd/cli/main.go algo -a docker -d "python3 /cocos/lin_reg.py" <path_to_docker_image.tar> <private_key_file_path> |
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.
please add the docker file to test/algo for the example used, also add docs there on how to build and output the docker image
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.
I have added an README file for the docker.
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.
results fails
go run ./cmd/cli/main.go result private.pem ✔ 10s
2024/08/02 16:57:50 Retrieving computation result file
2024/08/02 16:58:00 Error retrieving computation result: rpc error: code = Unknown desc = could not copy from the Docker container: failed to copy from container: Error response from daemon: Could not find the file /result/result.bin in container agent_container
exit status 1
Fixed, the problem was in the |
agent/service.go
Outdated
return | ||
} | ||
} else if err != nil { | ||
fmt.Printf("Could not create result dir\n") |
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.
fmt.Printf("Could not create result dir\n") |
agent/algorithm/docker/docker.go
Outdated
func (d *docker) AddDataset(dataset string) { | ||
d.logger.Debug("dataset method called") | ||
} |
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.
remove
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.
Done
agent/algorithm/docker/docker.go
Outdated
case <-statusCh: | ||
} | ||
|
||
agentResultOutput := path.Join(algorithm.AlgorithmResultOutputDir, algorithm.AlgorithmResultOutputFile) |
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.
there could be multiple files. results dir is zipped by agent
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.
The code is now changed to reflect this change.
90b3f44
to
7e45b82
Compare
test/manual/algo/lin_reg.py
Outdated
DATA_DIR = "/datasets" | ||
RESULTS_DIR = "/results" |
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.
this absolute path will work on docker but not on python or python or bin. on docker can you have the algo mount be in a relative path to datasets and results mounts
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.
Done
77dbc27
to
62fb08e
Compare
agent/algorithm/docker/docker.go
Outdated
|
||
const ( | ||
containerName = "agent_container" | ||
DockerRunCommand = "python3 /cocos/algorithm.py" |
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.
This is not clear to me, what is this const? Does that mean that we can run only Python algorithms? Should we just run a docker, whatever the binary is inside, and it is a docker creator's obligation to ensure that the container will boot properly, that the binary (or script, or whatever) will run inside and that it will find datasets mapped on the volume
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.
it is just the default, but the user can supply their own command to run in docker
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.
I have changed the code so that the docker start command must be a part of the docker image. The datasets
and results
are left as options in the CLI. They are there because the python
, wasm
and bin
will not work if the datasets and results dirs are /datasets
and /results
. They need to be relative for those algorithms.
@drasko, @SammyOina Please re-review. |
9499f1a
to
c321b3b
Compare
Now, the |
test/manual/docker/README.md
Outdated
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.
move to algo readme and combine with existing readme
test/manual/README.md
Outdated
|
||
```sh | ||
python3 test/manual/algo/lin_reg_test.py test/manual/data/iris.csv result.bin | ||
python3 test/manual/algo/lin_reg.py predict result.zip /test/manual/data |
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.
./test
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.
Sorry, mistake happened during copy/paste.
5a5a568
to
7f39ff4
Compare
7f39ff4
to
67a723c
Compare
What type of PR is this?
This is a feature because it enables the Agent to run Docker images inside the VM.
What does this do?
This PR introduces a new way of executing algorithms by using Docker.
Which issue(s) does this PR fix/relate to?
Resolves #165
Have you included tests for your changes?
The
agent-config/main.go
has been changed to create an option for the Agent to run docker.Did you document any new/modified feature?
The official documentation will be updated in a separate PR. The manual testing documentation has been updated.
Notes