Last active
March 29, 2018 23:47
-
-
Save mattbennett/53c0fb4bf8260b7e086ad0f817cdd005 to your computer and use it in GitHub Desktop.
This file contains 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
AMQP_URI: 'pyamqp://guest:guest@localhost' | |
WEB_SERVER_ADDRESS: '0.0.0.0:8000' | |
rpc_exchange: 'nameko-rpc' | |
max_workers: 10 | |
parent_calls_tracked: 10 | |
LOGGING: | |
version: 1 | |
handlers: | |
console: | |
class: logging.StreamHandler | |
formatter: simple | |
file: | |
class: logging.handlers.TimedRotatingFileHandler | |
level: DEBUG | |
formatter: simple | |
when: W0 | |
backupCount: 4 | |
filename: /var/log/reports.log | |
loggers: | |
nameko: | |
level: DEBUG | |
handlers: [console] | |
amqp: | |
level: DEBUG | |
handlers: [console] | |
formatters: | |
simple: | |
format: '%(asctime)s > %(thread)d - %(levelname)s - %(message)s' |
This file contains 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
FROM debian:stretch | |
RUN apt-get update | |
RUN apt-get install -y python3 python3-pip erlang rabbitmq-server unixodbc unixodbc-dev | |
RUN pip3 install pyodbc apscheduler nameko | |
COPY config.yaml /srv/config.yaml | |
COPY service.py /srv/service.py | |
CMD /etc/init.d/rabbitmq-server start; cd /srv; nameko run service --config config.yaml |
This file contains 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
build: | |
docker build -t debian-nameko-478 -f Dockerfile .; | |
run: | |
docker run -it --rm --name debian-nameko-478 debian-nameko-478 |
This file contains 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
from nameko.rpc import rpc | |
class Serv: | |
name = "serv" | |
@rpc | |
def meth(self): | |
return "OK" |
The code above is broken in many ways. You seem to be implementing a custom runner but have misunderstood the distinction between it and the class which defines the service. Please see the example app to get a better understanding of the fundamental concepts.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this
reports.py
Create
reports
directory and inside itservice.py
fileCreate
shared
directory and inside it `common.py``This code should work, but it hangs in the first
start()
call.