s3workers package¶
Submodules¶
s3workers.cli module¶
s3workers.jobs module¶
-
class
s3workers.jobs.
S3ListJob
(bucket, prefix, selector, key_handler, progress)[source]¶ Bases:
s3workers.jobs.Job
Iterate through S3 objects invoking a callback for each
Parameters: - bucket – the S3 bucket manager
- prefix – the key prefix to use when listing from the S3 bucket
- selector – optional callback to be evaluated for when an object is “interesting”
- key_handler – the callback to be invoked for each selected object (or all if no selector provided)
- progress – the callback to be invoked for reporting progress through the listing
s3workers.manager module¶
-
class
s3workers.manager.
Manager
(worker_count, stop_signals=[2, 15, 13], listen_for_unhandled_exceptions=True)[source]¶ Bases:
object
Manage several worker threads and their shared job work queue.
Parameters: - worker_count – number of worker threads to use (i.e. concurrency)
- stop_signals – list of signals to act on for automatically stopping workers
- listen_For_unhandled_exceptions – when enabled, automatically stop workers when an exception is thrown and not processed (will call orignal handler)
-
start_workers
()[source]¶ Tell workers to start listening and handling jobs posted to the shared work queue.
s3workers.reducer module¶
-
class
s3workers.reducer.
Reducer
(reduction_string, accumulation_string='0')[source]¶ Bases:
object
Execute reduction logic against an accumulator value.
This abstraction allows for a caller to perform a reduction of many values into one or a smaller set. For example, to provide summation of values, collect interesting values into an array, or produce grouped summations in a dictionary.
Parameters: - reduction_string – exec’d to perform accumulation logic (must set the accumulator during each call or nothing will aggregate)
- accumulation_string – eval’d to an initial value to accumulate the reduction results