Skip to content

Instantly share code, notes, and snippets.

View jamii's full-sized avatar

Jamie Brandon jamii

View GitHub Profile
sudo apt-get install build-essential python python-dev erlang erlang-dev python-django python-flup python-sphinx libcmph-dev git-core emacs
git clone git://github.com/tuulos/disco.git
cd disco
make
make install
cd lib
python setup.py build
python setup.py install
cd ../contrib/discodex
make
make install
make install-core
make install-discodb
make install-discodex
root@li317-243:~/disco# discodex start
-bash: discodex: command not found
root@li317-243:~/disco# bin/discodex start
[Errno 2] No such file or directory
root@li317-243:~/disco# bin/discodex start -v
discodex settings are:
DISCODEX_DISCO_MASTER = disco://localhost
DISCODEX_DISCO_PREFIX = _discodex
root@li317-243:~/disco# bin/discodex start -v
discodex settings are:
DISCODEX_DISCO_MASTER = disco://localhost
DISCODEX_DISCO_PREFIX = _discodex
DISCODEX_ETC_DIR = /usr/local/lib/discodex/etc
DISCODEX_HOME = /usr/local/lib/discodex
DISCODEX_HTTP_HOST = localhost
DISCODEX_HTTP_PORT = 8080
root@li315-143:~# disco jobs
ExtractFeatures@51d:371d4:4cf64
BuildHistograms@51d:369b8:838a8
root@li315-143:~# ls /usr/local/var/disco/data/*/*/*
/usr/local/var/disco/data/_disco_8989/35/BuildHistograms@51d:369b8:838a8:
events jobfile
/usr/local/var/disco/data/_disco_8989/c3/ExtractFeatures@51d:371d4:4cf64:
events jobfile
# DISCO_GC_AFTER = 5
rm -rf /usr/local/var/disco/data/*/*
disco debug
temp_gc:start_link(whereis(disco_server)). % leave running
ipython
import poc
poc.build() # starts several jobs and purges when finished
# wait 10 minutes
jamie@alien:~/springer-analytics$ ls /usr/local/var/disco/data/*/*/*
/usr/local/var/disco/data/alien/01/CreateDB@51d:5d429:6b2d7:
in_journal() ->
receive
{Seq, Event} ->
transaction_manager ! {Seq, Event},
write({Seq, Event}),
sync(),
out_journal ! {journaled, Seq}
end.
% in cpp or ocaml
let recover_with recover f =
try
f ()
with Invalid_transition _ as exc ->
recover exc;
raise exc
let unrecoverable f =
try
f ()

Entities

An entity is an account, order, market, contract, deposit or withdrawal. Every entity has a unique uid. Once created entities are never deleted.

Error handling conventions

We distinguish between recoverable errors and failures.

Recoverable errors are exceptions of type Invalid_transition. If this exception reaches the top level then piston will return an rpc error and continue processing. Any other exceptions will cause piston to die. Deepred will then mark the offending event as unprocessable and replay from a snapshot.

(ns mechanical-sympathiser.core
(:require [mechanical-sympathiser.sound :as sound]
[mechanical-sympathiser.system :as system]
overtone.core)
(:import (java.util Timer TimerTask)))
(def timer (new Timer))
(defn poll [period poll-fn]
(let [task (proxy [TimerTask] []