Commit 4e2aed2
feat: Remove docker_py usage in favor of custom client that uses Docker CLI (#33)
#### Relevant issue or PR
Fixes #10
Enables #8
#### Description of changes
- Created a new `docker_client.py` file that contains a
`CLIDockerClient` class that is a custom python wrapper over
`docker_cli` that mimics the interface of `docker_py`.
- The file has 3 additional classes, `Container`, `Compose`, and
`Image`.
- Removed a lot of functions from existing files (all calls to
subprocess) and docker errors. Migrated them to the `docker_client.py`
and replaced errors with our new errors.
- `teardown` function in cli has the most amount of changes as handling
of `--all` flag is moved to `engine.teardown` instead as we no longer
need to filter through all the projects in docker and parse which ones
belong to Tesseract as our `DockerWrapper` class already knows all the
projects that are Tesseracts.
- Renamed `_display_container_meta` to `_display_project_meta` as I
think it's more fitting to the function since we are listing the
metadata of all the containers in a project, aka the project's metadata.
- Modified some unit tests to fit the new mocked class.
BREAKING CHANGE: Tesseract Core does not clear build caches anymore.
That means, the option `--keep-build-cache` and environment variable
`TESSERACT_KEEP_BUILD_CACHE` are now removed, and users are advised to
clean up Docker resources manually as needed (e.g. via `docker system
prune`).
#### Testing done
Unit tests + Manually tested commands:
`serve` `build` `ps` `list` `teardown` `teardown --all` `apidoc`
#### License
- [x] By submitting this pull request, I confirm that my contribution is
made under the terms of the [Apache 2.0
license](https://pasteurlabs.github.io/tesseract/LICENSE).
- [x] I sign the Developer Certificate of Origin below by adding my name
and email address to the `Signed-off-by` line.
<details>
<summary><b>Developer Certificate of Origin</b></summary>
```text
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
</details>
Signed-off-by: [Angela Ko] <angela.ko@simulation.science>
---------
Co-authored-by: Dion Häfner <dion.haefner@simulation.science>1 parent 90d486c commit 4e2aed2
File tree
14 files changed
+3102
-2086
lines changed- docs/content/creating-tesseracts
- tesseract_core/sdk
- tests
- endtoend_tests
- sdk_tests
14 files changed
+3102
-2086
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 85 | | |
93 | 86 | | |
94 | 87 | | |
| |||
100 | 93 | | |
101 | 94 | | |
102 | 95 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
108 | 101 | | |
109 | 102 | | |
110 | 103 | | |
| |||
140 | 133 | | |
141 | 134 | | |
142 | 135 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
147 | 139 | | |
148 | 140 | | |
149 | 141 | | |
| |||
181 | 173 | | |
182 | 174 | | |
183 | 175 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| |||
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | | - | |
37 | 33 | | |
38 | 34 | | |
39 | 35 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 36 | + | |
43 | 37 | | |
44 | 38 | | |
45 | 39 | | |
| |||
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 55 | + | |
0 commit comments