oh dir is there anything important in here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def partition(items, predicate=int, n=2): | |
""" Partition an iterable of `items` into `n` streams by `predicate` | |
""" | |
def filterer(i, tee): | |
return (item for pred, item in tee if pred == i) | |
pred_items = ((predicate(item), item) for item in items) | |
teed_items = enumerate(itertools.tee(pred_items, n)) | |
return (filterer(x, t) for x, t in teed_items) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread, Event | |
from queue import Queue, Empty | |
from kafka import KafkaConsumer, KafkaProducer | |
from kafka.structs import TopicPartition, OffsetAndMetadata | |
from kafka.consumer.fetcher import ConsumerRecord | |
from kafka.errors import CommitFailedError | |
class KafkaWorker(object): | |
def __init__(self, topics, hosts, poll_timeout=1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2.1 | |
default_working_dir: &working_container | |
working_directory: /app | |
docker: | |
- image: docker:18.06.1-ce-git | |
default_steps: | |
steps: | |
- setup_remote_docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
credentials.py | |
venv/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This impliments a redis cluster backend for Flask-Cache as the standard redis cache cannot handle a redis cluster.
class Config(object):
A class which constructs a concurrent writer object so that you can write async to cassandra, but limit the number of concurrent writes to some number, and block when we hit that limit. This can result in improved write throuput withough having to construct your query with genorators, as the default cassandra concurrent method requires.
I would sugest adding callbacks to handle write time outs, as you may want to retry the write.
NewerOlder