Skip to content

Instantly share code, notes, and snippets.

View mattbennett's full-sized avatar

Matt Yule-Bennett mattbennett

  • London, England
View GitHub Profile
@mattbennett
mattbennett / app.py
Last active June 3, 2024 14:14
Nameko celery integration
from flask import Flask, request
from nameko.standalone.rpc import ServiceRpcProxy
app = Flask(__name__)
@app.route('/')
def task_list():
return """
<html>
@mattbennett
mattbennett / .gitignore
Last active November 2, 2023 10:38
Nameko websocket test
*.pyc
@mattbennett
mattbennett / conftest.py
Created May 19, 2016 15:55
pytest and eventlet combination hanging on os x
import eventlet
eventlet.monkey_patch()
def pytest_configure(config):
import logging
logging.basicConfig(level=logging.DEBUG) # or comment out this line, works fine
@mattbennett
mattbennett / circle.yml
Created May 24, 2016 11:42
Nameko CircleCI config
machine:
python:
version: 3.4.3
services:
- rabbitmq-server
environment:
IMAGE_TAG: ${CIRCLE_SHA1}
pre:
- sudo rabbitmq-plugins enable rabbitmq_management
@mattbennett
mattbennett / hello.py
Last active June 16, 2016 18:09
nameko rpc hello world
from nameko.rpc import rpc
class HelloService(object):
name = "hello"
@rpc
def hello(self, name):
return "Hello, {}!".format(name)
@mattbennett
mattbennett / Dockerfile.eventlet
Last active December 20, 2016 18:12 — forked from kooba/Dockerfile
dnspython docker dns issue
FROM python:3.4
RUN pip install eventlet
COPY test.py /var/tmp/test.py
CMD [ "python", "/var/tmp/test.py" ]
@mattbennett
mattbennett / client.py
Last active January 10, 2017 12:14
Network Checker
import getopt
import uuid
import sqlite3
import sys
from datetime import datetime
import os
import time
import socket
""" Regression tests for https://github.com/nameko/nameko/issues/428
The tests in this module show detailed examples of possible failures caused
by the above bug. It's being left here rather than in the repo since the tests
themselves are quite slow, and one is sufficient to verify the regression.
"""
import itertools
import time
from functools import partial
@mattbennett
mattbennett / client.py
Created April 14, 2017 15:00
Nameko Auth Toy
from nameko.standalone.rpc import ClusterRpcProxy
config = {
'AMQP_URI': 'amqp://guest:guest@localhost:5672/'
}
with ClusterRpcProxy(config) as rpc:
session_token = rpc.auth.login("admin", "secret")
with ClusterRpcProxy(config, context_data={'session': session_token}) as rpc:
@mattbennett
mattbennett / growing.py
Last active May 1, 2017 10:01
Eventlet memory leak
import eventlet
import eventlet.debug
eventlet.debug.hub_exceptions(False)
import objgraph
import gc
import uuid
threads = {}