shigoto_batch (shigoto v1.9.10)
View SourceBatch/workflow system for Shigoto. Groups jobs into batches with completion and discard callbacks.
Usage
%% Create a batch with a callback worker
{ok, Batch} = shigoto:new_batch(#{
callback_worker => my_batch_callback,
callback_args => #{<<\"report_id\">> => 42}
}),
BatchId = maps:get(id, Batch),
%% Insert jobs into the batch
shigoto:insert(#{worker => step_one, args => #{}, batch => BatchId}),
shigoto:insert(#{worker => step_two, args => #{}, batch => BatchId}),
%% When all jobs complete, my_batch_callback:perform/1 is called
%% with the callback_args. If any job is discarded, the batch
%% state changes to 'callback_discarding' and the callback is
%% called with an added <<\"_batch_event\">> => <<\"discard\">> key.
Summary
Functions
Create a new batch.
Get a batch by ID.
Increment total job count for a batch.
Record a completed job in the batch. May trigger callback.
Record a discarded job in the batch. May trigger callback.
Functions
Create a new batch.
Get a batch by ID.
Increment total job count for a batch.
Record a completed job in the batch. May trigger callback.
Record a discarded job in the batch. May trigger callback.