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

[WIP] Efficiency #788

Closed
wants to merge 15 commits into from
Closed

[WIP] Efficiency #788

wants to merge 15 commits into from

Conversation

shin-
Copy link
Contributor

@shin- shin- commented Sep 24, 2015

For context, see

What is it?

  1. Compilation of helper functions that help perform common tasks outside of the API proper. Example:
In [1]: from docker import efficiency
In [2]: efficiency.start_auto_remove?
Signature: efficiency.start_auto_remove(container, *args, **kwargs)
Docstring:
Start a container and try to remove it when it's finished running,
similar to using --autorm in the docker CLI.

**Params:**
    container: ID of the container to be started
    args, kwargs: `Client.start()` arguments
File:      ~/work/pydocker/docker/efficiency/efficiency.py
Type:      function
  1. "Smart objects" providing an object-oriented interface on top of the client layer
In [29]: import docker

In [30]: c = docker.Client()

In [31]: docker.efficiency.init(c)

In [32]: docker.efficiency.get_image('busybox:latest')
Out[32]: <DockerImage(id=d7057cb020844f24)>

In [33]: img = _

In [34]: img.os
Out[34]: u'linux'

In [36]: img.architecture
Out[36]: u'amd64'

In [37]: img.create_container(command='true')
Out[37]: <DockerContainer(id=58bf1374a4116b38)>

In [38]: ctnr = _

In [39]: ctnr.status
Out[39]: 'stopped'

In [40]: ctnr.start()

In [41]: ctnr.wait()
Out[41]: 0 

TODO

  • Test coverage
  • Documentation (lots of docstring already available)
  • Cleanup (smart objects in their own files, etc.)

Signed-off-by: Moysés Borges <moysesb@gmail.com>
Signed-off-by: Moysés Borges <moyses.furtado@wplex.com.br>
Signed-off-by: Moysés Borges <moyses.furtado@wplex.com.br>
Signed-off-by: Moysés Borges <moyses.furtado@wplex.com.br>
Signed-off-by: Moysés Borges <moysesb@gmail.com>
Signed-off-by: Moysés Borges <moyses.furtado@wplex.com.br>
Signed-off-by: Moysés Borges <moysesb@gmail.com>
Signed-off-by: Moysés Borges <moyses.furtado@wplex.com.br>
Signed-off-by: Moysés Borges <moysesb@gmail.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
More clearly separate unit and integration tests
Allow splitting into multiple files
Cleaner

Signed-off-by: Joffrey F <joffrey@docker.com>
@@ -0,0 +1,221 @@
import json
Copy link
Contributor

Choose a reason for hiding this comment

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

efficiency seems a bit strange to me for a module name. What do you think about just making this docker.build ?

@bfirsh
Copy link
Contributor

bfirsh commented Nov 28, 2016

Carried and merged in #1186. 🎉

@bfirsh bfirsh closed this Nov 28, 2016
@shin- shin- deleted the efficiency branch January 26, 2017 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants