Skip to content

Instantly share code, notes, and snippets.

@mattbennett
Last active March 29, 2018 23:47
Show Gist options
  • Save mattbennett/53c0fb4bf8260b7e086ad0f817cdd005 to your computer and use it in GitHub Desktop.
Save mattbennett/53c0fb4bf8260b7e086ad0f817cdd005 to your computer and use it in GitHub Desktop.
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'
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
build:
docker build -t debian-nameko-478 -f Dockerfile .;
run:
docker run -it --rm --name debian-nameko-478 debian-nameko-478
from nameko.rpc import rpc
class Serv:
name = "serv"
@rpc
def meth(self):
return "OK"
@mattbennett
Copy link
Author

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