From f79a2fadfc28ec42b4e786736db710f52c7e3331 Mon Sep 17 00:00:00 2001 From: fawce Date: Fri, 27 Jul 2012 17:06:45 -0400 Subject: [PATCH] cancellation tweaks. --- zipline/core/monitor.py | 2 +- zipline/protocol.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/zipline/core/monitor.py b/zipline/core/monitor.py index eae70ae7..d3a831f1 100644 --- a/zipline/core/monitor.py +++ b/zipline/core/monitor.py @@ -6,7 +6,7 @@ import time import itertools import logbook from setproctitle import setproctitle -from signal import SIGHUP, SIGINT +from signal import SIGHUP, SIGINT, SIGKILL, signal from collections import OrderedDict, Counter diff --git a/zipline/protocol.py b/zipline/protocol.py index a8369167..efe85100 100644 --- a/zipline/protocol.py +++ b/zipline/protocol.py @@ -129,6 +129,8 @@ from utils.date_utils import EPOCH, UN_EPOCH, epoch_now # Control Protocol # ----------------------- +PRODUCTION_PREFIXES = ['PERF', 'RISK', 'EXCEPTION', 'CANCEL'] + INVALID_CONTROL_FRAME = FrameExceptionFactory('CONTROL') CONTROL_STATES = Enum( @@ -532,6 +534,14 @@ def EXCEPTION_FRAME(exception_tb): return BT_UPDATE_FRAME('EXCEPTION', result) +def CANCEL_FRAME(date): + result = { + 'date' : EPOCH(date) + } + + return BT_UPDATE_FRAME('CANCEL', result) + + def BT_UPDATE_FRAME(prefix, payload): """ Frames prepared by RISK_FRAME and PERF_FRAME methods are sent via the same