Skip to content

Instantly share code, notes, and snippets.

View davebshow's full-sized avatar

David Michael Brown davebshow

  • Vancouver Island
View GitHub Profile
"""
This example demonstrates how to use Pulsar actors to create
nodes with Goblin. This is the basic concept on which other Pulsar/Goblin
apps would be based, but it may be better to use Pulsar's higher
level Application class interface...
Based on:
https://github.com/quantmind/pulsar/blob/master/examples/snippets/greeter.py
"""
import asyncio
import pulsar
"""
Simple client for the JSONRPC Server
"""
import asyncio
from pulsar.apps import rpc
proxy = rpc.JsonProxy("http://localhost:8060")
import asyncio
import datetime
from pytz import utc
from tornado.platform.asyncio import AsyncIOMainLoop
from mogwai import properties
from mogwai.connection import setup, close_global_pool
from mogwai.models import Vertex, Edge, V
@davebshow
davebshow / a_aioclient.py
Last active July 24, 2017 01:28
This gist details some simple profiling that I did to compare compare a Tornado based client implementation vs. a Aiohttp based implementation of gremlinclient. To do so, I simply dropped the Aiohttp websocket client in the place of the Tornado client in gremlinclient like shown in the following file. Next I did a simple IPython %timeit, followe…
import asyncio
import collections
import json
import uuid
import aiohttp
Message = collections.namedtuple(
"Message",
match path=(t:tweet {tid: '665496205854687232'})-[:REPLIES_TO|RETWEETS|TWEETS*1..4]-(:tweet) return filter(x in nodes(path) where exists(x.tid))
@davebshow
davebshow / traversal_dependency.py
Last active November 6, 2015 17:15
My basic idea for creating a schema dependency graph based on the traversal fragments generated by SylvaDB query builder.
def df_edge_traversal(g):
"""
Based on networkx dfs_edges
"""
visited = set()
start = g.nodes()[0]
stack = [(start, iter(g[start]))]
while stack:
parent, children = stack[-1]
try:
import uuid
from tornado.concurrent import Future
from tornado.websocket import websocket_connect
class GremlinResponseStream:
def __init__(self, conn):
self._conn = conn
@asyncio.coroutine
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
with open("output3.txt", "r") as f:
for line in f:
print(json.loads(line))
Django==1.6.7
GraphLab-Create==0.3.0 - 1.4.1 (2.7)
Parsley==1.1 - 1.2 (3.3)
Pillow==2.4.0 - 2.9.0 (3.4)
South==0.8.4
amqp==1.4.5 - 1.4.6 (3.3)
anyjson==0.3.3 - (3.1) (REMOVE???)
argparse==1.2.1
billiard==3.3.0.17 - 3.3.0.20 (3.3)
boto==2.29.1 - 2.3.8 (3.4)