Permalink
Browse files

Merge pull request #73 from branch 'bwf-fitting-pulse'

  • Loading branch information...
2 parents 83099a1 + 194842a commit 8413349033176c8e8f30a40ba11963c811565cd5 Bryan Fink committed May 1, 2013
View
@@ -2,6 +2,7 @@ REPO ?= riak_pipe
RIAK_TAG = $(shell git describe --tags)
REVISION ?= $(shell echo $(RIAK_TAG) | sed -e 's/^$(REPO)-//')
PKG_VERSION ?= $(shell echo $(REVISION) | tr - .)
+PULSE_TESTS = reduce_fitting_pulse
.PHONY: deps
@@ -22,6 +23,12 @@ distclean: clean ballclean
test: all
./rebar skip_deps=true eunit
+# You should 'clean' before your first run of this target
+# so that deps get built with PULSE where needed.
+pulse:
+ ./rebar compile -D PULSE
+ ./rebar eunit -D PULSE skip_deps=true suite=$(PULSE_TESTS)
+
docs:
./rebar skip_deps=true doc
@@ -46,6 +46,14 @@
-include("riak_pipe.hrl").
-include("riak_pipe_debug.hrl").
+-ifdef(PULSE).
+-include_lib("pulse/include/pulse.hrl").
+%% have to transform the 'receive' of the work results
+-compile({parse_transform, pulse_instrument}).
+%% don't trasnform toplevel test functions
+-compile({pulse_replace_module,[{gen_fsm,pulse_gen_fsm}]}).
+-endif.
+
-record(state, {options :: riak_pipe:exec_opts(),
pipe :: #pipe{},
alive :: [{#fitting{}, reference()}], % monitor ref
@@ -38,6 +38,14 @@
-include("riak_pipe.hrl").
+-ifdef(PULSE).
+-include_lib("pulse/include/pulse.hrl").
+%% have to transform the 'receive' of the work results
+-compile({parse_transform, pulse_instrument}).
+%% don't trasnform toplevel test functions
+-compile({pulse_replace_module,[{supervisor,pulse_supervisor}]}).
+-endif.
+
-define(SERVER, ?MODULE).
%%%===================================================================
@@ -52,6 +52,14 @@
-include_lib("eunit/include/eunit.hrl").
-endif.
+-ifdef(PULSE).
+-include_lib("pulse/include/pulse.hrl").
+%% have to transform the 'receive' of the work results
+-compile({parse_transform, pulse_instrument}).
+%% don't trasnform toplevel test functions
+-compile({pulse_replace_module,[{gen_fsm,pulse_gen_fsm}]}).
+-endif.
+
-record(worker, {partition :: riak_pipe_vnode:partition(),
pid :: pid(),
monitor :: reference()}).
@@ -34,6 +34,14 @@
-include("riak_pipe.hrl").
-include("riak_pipe_debug.hrl").
+-ifdef(PULSE).
+-include_lib("pulse/include/pulse.hrl").
+%% have to transform the 'receive' of the work results
+-compile({parse_transform, pulse_instrument}).
+%% don't trasnform toplevel test functions
+-compile({pulse_replace_module,[{supervisor,pulse_supervisor}]}).
+-endif.
+
-define(SERVER, ?MODULE).
%%%===================================================================
@@ -33,6 +33,14 @@
-include("riak_pipe.hrl").
+-ifdef(PULSE).
+-include_lib("pulse/include/pulse.hrl").
+%% have to transform the 'receive' of the work results
+-compile({parse_transform, pulse_instrument}).
+%% don't trasnform toplevel test functions
+-compile({pulse_replace_module,[{gen_fsm,pulse_gen_fsm}]}).
+-endif.
+
-export_type([sink_type/0]).
-type sink_type() :: raw
| {fsm, Period::integer(), Timeout::timeout()}.
@@ -126,7 +134,14 @@ send_to_sink_fsm(Pid, Msg, Timeout, true, _Count) ->
put(sink_sync, 0),
ok
catch
- exit:{timeout,_} -> {error, timeout};
- exit:{noproc,_} -> {error, sink_died}
+ exit:{timeout,_} ->
+ {error, timeout};
+ exit:{_Reason,{gen_fsm,sync_send_event,_}} ->
+ %% we don't care why it died, just that it did ('noproc'
+ %% and 'normal' have been seen; others could be possible)
+ {error, sink_died};
+ exit:{_Reason,{pulse_gen_fsm,sync_send_event,_}} ->
+ %% the pulse parse transform won't catch just the atom 'gen_fsm'
+ {error, sink_died}
end.
Oops, something went wrong.

0 comments on commit 8413349

Please sign in to comment.