Skip to content

Comments

Python fix + cleanup#123

Merged
brendandburns merged 3 commits intometaparticle-io:masterfrom
wagoodman:general-cleanup
May 11, 2018
Merged

Python fix + cleanup#123
brendandburns merged 3 commits intometaparticle-io:masterfrom
wagoodman:general-cleanup

Conversation

@wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Apr 19, 2018

This isn't associated with any particular issue, and I didn't think it would be helpful creating an issue + PR for each of these fixes, so I made a general cleanup PR. Let me know if this is bothersome and I can break it up. Here is the summary of changes:

  • There is a json syntax error in the version.json and the json package was misused, both causing a critical failure on startup.
  • Looks like unittest won out over tox, so I removed tox references and updated the Makefile with the right test cmds
  • Updated the examples to be generally runnable + show verbose output. With simple.py only one entrypoint was chosen given that there is a web.py there to illustrate how to use metaparticle with port requirements.
  • The logger names for the runner and builder have been changed to the modules parent name to be more generic. E.g. instead of metaparticle_pkg.runner.docker_runner it is just metaparticle_pkg.runner since only one runner can be used at a time, and changing runners shouldn't involve a code change to see the correct logs.
  • I wasn't able to reproduce https://github.com/docker/docker-py/issues/300 exactly as the docker_runner suggested, however, I believe it was a misdiagnosis. Without a tty in the container the buffered output that python defaults to will not be shown (so nothing was visible from a docker logs -f ...). The easy fix is to use unbuffered python (via the -u switch on the entrypoint in the Dockerfile).

@brendandburns
Copy link
Contributor

THis looks great, thanks! I'll merge it into my local dev and test, and then merge to master assuming things look good.

Thanks Again.

@tomkukral
Copy link
Contributor

Good job! Thanks for fixing my mistakes. 👍

@huitseeker huitseeker mentioned this pull request May 1, 2018
Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

Commented on a few nits, this looks great!

from docker import APIClient

logger = logging.getLogger(__name__)
logger = logging.getLogger('.'.join(__name__.split('.')[:-1]))
Copy link
Contributor

@huitseeker huitseeker May 1, 2018

Choose a reason for hiding this comment

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

OK, that gets us common logging for builder and runner. But this is a specific choice, so it would be nice to have a comment line indicating the purpose (here and in the sibling line of this change, in runner).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I'll make the adjustment

max-line-length = 160
exclude =
./.git,
./venv No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: venv as a subdirectory is very specific/subjective. This might surprise some.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, however, this is also referenced in the Makefile https://github.com/metaparticle-io/package/blob/master/python/Makefile

python/setup.py Outdated
import json

config = json.loads('./metaparticle_pkg/version.json')
config = json.load(open('./metaparticle_pkg/version.json', 'r'))
Copy link
Contributor

Choose a reason for hiding this comment

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

with open('...') as ...: for idiomacy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@@ -1,2 +1,2 @@
six==1.10.0
metaparticle_pkg==0.4.1
metaparticle_pkg==0.4.1 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big fan of explicit package #s in master, but my opinions are better expressed in #126 – YMMV

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this would easily get around a few of the problems i was investigating... I'll make the change. (One outstanding problem with this approach: this wont make it any easier to dev on this package and test it within a container though)

@brendandburns
Copy link
Contributor

Thanks!

@brendandburns brendandburns merged commit b716c40 into metaparticle-io:master May 11, 2018
@wagoodman wagoodman deleted the general-cleanup branch May 11, 2018 12:30
srini85 added a commit to srini85/package that referenced this pull request Sep 19, 2018
* Updated Java package tutorial instructions (metaparticle-io#110)

* Correct the expected value of the @Package/repository value
* Mention the need for the @Package/publish=true field
* Removed use of the @Runtime/publicAddress field since the tutorial does not appear to be ACI specific
* Correct the type of service created on the remote Kubernetes cluster

* Added missing unit test dependencies (metaparticle-io#109)

* Update README.md (metaparticle-io#106)

Slight typo. "a nd language of choice" ===> "and language of choice"

* Create dotnet testrunner (metaparticle-io#87)

* fix up examples and documentation

* fix up indenting

* add initial code for a dotnet test runner as part of metaparticle

* add missed file

* renamed env vars to be conssitent and also moved braces to new lines

* Add travis for dotnet (#3)

* add initial travis file

* fix up missing dash

* try again going into the right directory this time

* no need for mono and we can set the dotnet core version

* make build.sh executable

* see what directory we are on

* set to unix type

* build the examples

* move tests to attributes rather than using env var

* Initial Set of Unit Tests For DotNet Metaparticle.Package (metaparticle-io#111)

* Create unit test project and added tests for Metaparticle.Package.Config

* Added unit tests for Config and an initial set of tests for the Driver

* Minor update to Java sharding tutorial instructions (metaparticle-io#112) (metaparticle-io#113)

* Fix typo in tutorial (metaparticle-io#114)

* Support containerizing of Spring Boot apps (metaparticle-io#115)

* Necessary to upgrade PowerMock version in order to run tests
* Additions to gitignore file

* Support sharding. (metaparticle-io#118)

* Update definition of local functions with explicit const (metaparticle-io#120)

* Add some words on Spring Boot support to package Java tutorial (metaparticle-io#121)

* Follow up to previous PR for issue metaparticle-io#6

* Lazy intialize the Docker client. (metaparticle-io#119)

* Fix missing comma, go fmt (metaparticle-io#122)

* Adding rust (metaparticle-io#86)

* learned a touch of rust

* no decorator

* base rust entrypoint

* with bare docker builder and executor (#3)

* Real traits jim (#4)

* add placeholder functions for actual interface
* move builder trait into builder module
* move docker builder struct into correct module
* move existing functions onto trait implementation
* move executor trait to appropriate module
* move executor struct into correct module

* initial builder working

* added docker run support; cleaned up command execs

* refactor to str refs; added readme

* We need strings here, I think

The result of the format! call is a string, (as is the result
of other ways of getting a u64 into a string).

This change makes the method compile without changing anything's
type signature. There might be other was to accomplish this,
but I haven't found one.

* added web example

* use executable's path as Docker context

* wrapped docker cmds in sh

* write dockerfile to docker context explicitly

* fix copy paste error in README

* Python fix + cleanup (metaparticle-io#123)

* general cleanup

* nested options should be processed into objects from dictionaries

* comments on logging; pythonic json read

* Drive-by cleanups (metaparticle-io#126)

* Let requirements match the latest version

* Make print statements Python3-compatible

* insulate more against Py2 -> Py3 changes

* Add python additionalFiles option (metaparticle-io#125)

* add python additionalFiles option

* in case a dir is given

* added tests for additionalFiles

* Lazy intialize the Docker client. (metaparticle-io#127)

* more efficient base image (metaparticle-io#131)

* more efficient base image

* squashed layers

* removed breaking character

* adding certs

* sized down to 6mb and tested with simple http server
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.

4 participants