Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer command #30

Merged
merged 101 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
8449c22
Add consumer and producer method to write to and read from file
Bibob7 Jul 3, 2019
76a73e3
Merge remote-tracking branch 'origin/master' into transfer-command
Bibob7 Jul 4, 2019
d835438
Add schema registry to config
Bibob7 Jul 5, 2019
05d919e
Merge remote-tracking branch 'origin/master' into transfer-command
Bibob7 Jul 7, 2019
064876f
Add serializer for avro messages
Bibob7 Jul 7, 2019
df51bf1
Set Serializer as super class for all serializer
Bibob7 Jul 7, 2019
801072d
Refactor Producer and Consumer for PlainText and Avro
Bibob7 Jul 8, 2019
d2a936e
Fix coding styles
Bibob7 Jul 8, 2019
7005747
Remove unused imports
Bibob7 Jul 8, 2019
f433564
Add create methods for Producer and Consumer
Bibob7 Jul 8, 2019
4b65ca6
Do not use test topic anymore
Bibob7 Jul 8, 2019
edfa860
Revert config change for testing
Bibob7 Jul 8, 2019
c209d12
Extract methods in commands
Bibob7 Jul 8, 2019
3751aff
Remove unused method
Bibob7 Jul 8, 2019
fafe570
Better process handling of edge cases
Bibob7 Jul 8, 2019
49134b3
Refactor write_to_file method
Bibob7 Jul 8, 2019
14dba5c
Add more output and fix bugs
Bibob7 Jul 8, 2019
8e1777b
Fix coding styles
Bibob7 Jul 9, 2019
b08b0a3
Remove unused method in SchemaRegistryClient
Bibob7 Jul 10, 2019
2b04309
Adjust max line length to 119
Bibob7 Jul 10, 2019
80fa96b
Add flag to keep message file
Bibob7 Jul 10, 2019
1f5578e
Remove factory methods
Bibob7 Jul 10, 2019
cef7be6
Super producer and consumer implement consume and produce
Bibob7 Jul 10, 2019
b1f82bd
Merge remote-tracking branch 'origin/master' into transfer-command
Bibob7 Jul 12, 2019
0af62e1
Update version
Bibob7 Jul 12, 2019
e632360
Update Pipfile.lock
Bibob7 Jul 12, 2019
2fa4884
Update pip files
Bibob7 Jul 12, 2019
87f3788
Add avro-python3
Bibob7 Jul 12, 2019
e4002e9
Subscribe to topic instead of assign to partition 0
Bibob7 Jul 12, 2019
cb022ff
Change to list of topics
Bibob7 Jul 12, 2019
f7c08d4
Make FileWriter and Reader handleable for with
Bibob7 Jul 12, 2019
040ce59
Make FileWriter and FileReader usable with "with".
Bibob7 Jul 13, 2019
a605ad2
Use abc library
Bibob7 Jul 13, 2019
58e5c95
Update travis.yml and setup.py
Bibob7 Jul 13, 2019
9adc0a1
Remove assertions for methods
Bibob7 Jul 13, 2019
2bac25f
Update fixture file_consumer
Bibob7 Jul 13, 2019
87e15da
Update tests
Bibob7 Jul 13, 2019
c55c0f2
Update tests for consume and produce to and from file
Bibob7 Jul 13, 2019
1bc83e7
Fix styling
Bibob7 Jul 13, 2019
583b369
Check written files in tests and bug fixes
Bibob7 Jul 14, 2019
f14e1ec
Fix schema_registry uri
Bibob7 Jul 14, 2019
2070333
Add schema registry to travis
Bibob7 Jul 14, 2019
ee03928
Use confluent package with schema registry for travis
Bibob7 Jul 14, 2019
f22a585
Fix travis.yml
Bibob7 Jul 14, 2019
accb8ce
Fix travis.yml
Bibob7 Jul 14, 2019
dbf6698
Fix travis.yml
Bibob7 Jul 14, 2019
739dc3a
Use newer version of confluent package
Bibob7 Jul 14, 2019
849b6f3
Use higher time out for kafka broker start
Bibob7 Jul 14, 2019
16f031e
Fix ci
Bibob7 Jul 14, 2019
9ce200a
Fix ci
Bibob7 Jul 14, 2019
6b7412f
Fix ci
Bibob7 Jul 14, 2019
5daee5a
Fix ci
Bibob7 Jul 14, 2019
523701f
Update Pipfiles
Bibob7 Jul 14, 2019
b620dd0
Fix docker-compose.test.yml
Bibob7 Jul 14, 2019
85052e8
Add tests and update ci config
Bibob7 Jul 14, 2019
fa310b9
Try alternative ci config
Bibob7 Jul 14, 2019
b9f5931
Revert "Try alternative ci config"
Bibob7 Jul 14, 2019
7d01ea8
Try alternative ci config
Bibob7 Jul 14, 2019
8b9de18
Increase waiting time for ci environment startup
Bibob7 Jul 15, 2019
f146ee7
Update schema registry config for ci
Bibob7 Jul 15, 2019
782c7e1
Revert "Update schema registry config for ci"
Bibob7 Jul 15, 2019
a5a3c07
Update tests to check content of messages
Bibob7 Jul 15, 2019
1d7912f
Merge methods
Bibob7 Jul 15, 2019
ad54d1f
Update extract_schema_id
Bibob7 Jul 15, 2019
deff96c
Use named tuples
Bibob7 Jul 15, 2019
0653c85
Content of DecodedAvroMessage could be anything
Bibob7 Jul 15, 2019
c02b3f2
Update travis ci config
Bibob7 Jul 15, 2019
4974655
Use .avsc ending for avro files
Bibob7 Jul 15, 2019
51f7935
Let KafkaMessage do not rely on str key and value
Bibob7 Jul 15, 2019
95d9994
Update test to check consumed and produced content
Bibob7 Jul 15, 2019
adaa8ae
Update travis.yml
Bibob7 Jul 15, 2019
146bdd6
Update travis.yml
Bibob7 Jul 15, 2019
a33b18b
Fix coding style
Bibob7 Jul 15, 2019
ce7acc6
Optimize tests
Bibob7 Jul 15, 2019
4697e50
Enable partition wise storing of messages
Bibob7 Jul 16, 2019
d03e98f
Add tests for topics with multiple partitions
Bibob7 Jul 16, 2019
081281f
Update topic fixtures
Bibob7 Jul 16, 2019
dbce4d3
Update conftest.py
Bibob7 Jul 16, 2019
7e37a28
Randomly produce messages in partitions
Bibob7 Jul 16, 2019
37bc8c7
Fix tests
Bibob7 Jul 16, 2019
ffdcc18
Remove useless assertion
Bibob7 Jul 16, 2019
905da82
Fix tests
Bibob7 Jul 16, 2019
74fd5a8
Fix tests
Bibob7 Jul 16, 2019
4891849
Fix tests
Bibob7 Jul 16, 2019
60f47d9
Update repo config and fix test
Bibob7 Jul 16, 2019
a9fa37b
Use topic_id fixture
Bibob7 Jul 17, 2019
e334200
Remove unnecessary usage of keys()
Bibob7 Jul 19, 2019
2f7d8d3
Refactor clients.py
Bibob7 Jul 19, 2019
426888f
Remove line-length in travis.yml for black
Bibob7 Jul 19, 2019
4ebcfe8
Fix Readme
Bibob7 Jul 19, 2019
2e5adf1
Simplify consume_single_message
Bibob7 Jul 19, 2019
e113441
Simplify IoHandler
Bibob7 Jul 19, 2019
ee4fb43
Remove unnecessary format
Bibob7 Jul 19, 2019
97fa771
Remove unused import
Bibob7 Jul 19, 2019
35f6c28
Merge remote-tracking branch 'origin/master' into transfer-command
Bibob7 Jul 19, 2019
2b857aa
Add help description for --last/--first
Bibob7 Jul 19, 2019
a3dfbb9
Re-add retry mechanism for consume_single_message
Bibob7 Jul 22, 2019
1bd1c77
Catch MessageEmptyException and return counter for Consumer
Bibob7 Jul 22, 2019
87f1fb6
Add more detailed description if no messages were consumed.
Bibob7 Jul 22, 2019
51ec6a7
Add queue limit and flush before it is reached
Bibob7 Jul 22, 2019
d270ad1
Reduce internal queue limit
Bibob7 Jul 22, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80
max-line-length = 119
max-complexity = 18
select = B,C,E,F,W,T4,B9
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ dist: xenial
language: python
cache: pip
env:
- TEST_CMD="pytest tests/ --integration --cov=esque --local"
- >
TEST_CMD="pytest tests/ --integration --cov=esque --local"
BROKER_URL="localhost:9092"
ZOOKEEPER_URL="localhost:2181"
SCHEMA_REGISTRY_URL="localhost:8081"
before_install:
Bibob7 marked this conversation as resolved.
Show resolved Hide resolved
- wget https://mirror.netcologne.de/apache.org/kafka/2.2.0/kafka_2.12-2.2.0.tgz -O kafka.tgz
- mkdir -p kafka && tar xzf kafka.tgz -C kafka --strip-components 1
- nohup bash -c "cd kafka && bin/zookeeper-server-start.sh config/zookeeper.properties &"
- nohup bash -c "cd kafka && bin/kafka-server-start.sh config/server.properties &"
- scripts/wait-for-it.sh localhost:9092
- scripts/wait-for-it.sh localhost:2181
- wget http://packages.confluent.io/archive/5.2/confluent-community-5.2.1-2.12.tar.gz -O confluent-community.tgz
- mkdir -p confluent-community && tar xzf confluent-community.tgz -C confluent-community --strip-components 1
- confluent-community/bin/zookeeper-server-start -daemon confluent-community/etc/kafka/zookeeper.properties
- bash -c "scripts/wait-for-it.sh ${ZOOKEEPER_URL} -t 60"
- confluent-community/bin/kafka-server-start -daemon confluent-community/etc/kafka/server.properties
- bash -c "scripts/wait-for-it.sh ${BROKER_URL} -t 60"
- confluent-community/bin/schema-registry-start -daemon confluent-community/etc/schema-registry/schema-registry.properties
- bash -c "scripts/wait-for-it.sh ${SCHEMA_REGISTRY_URL} -t 60"
install:
- pip install coverage coveralls flake8 pipenv
- pipenv install --system --dev --deploy
Expand All @@ -26,11 +32,13 @@ notifications:
matrix:
include:
- name: black
before_install: []
python: 3.7
env:
- TEST_CMD="black --check --verbose ."
- TEST_CMD="black --check --verbose --line-length=119 ."
swenzel marked this conversation as resolved.
Show resolved Hide resolved
- name: flake8
python: 3.7
before_install: []
env:
- TEST_CMD="flake8 esque/"
- name: '3.6'
Expand Down
110 changes: 86 additions & 24 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ While this `docker-compose` stack is up, you can run the tests from the CLI via
Alternatively, you can also run the entire test suite, without needing to setup the development environment, in docker compose via `docker-compose -f docker-compose.yml -f docker-compose.test.yml`


### Pre Commit Hooks

To install pre commit hooks run:

```
pip install pre-commit
pre-commit install
pre-commit install-hooks`
swenzel marked this conversation as resolved.
Show resolved Hide resolved
``


## Alternatives

- [LinkedIn KafkaTools](https://github.com/linkedin/kafka-tools)
Expand Down
2 changes: 2 additions & 0 deletions config/sample_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ current = docker
bootstrap_hosts = localhost
bootstrap_port = 9092
security_protocol = LOCAL
schema_registry = http://localhost:8081

[Context.docker]
bootstrap_hosts = kafka
bootstrap_port = 9093
security_protocol = PLAINTEXT
schema_registry = http://schema_registry:8081
3 changes: 2 additions & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ services:
ESQUE_TEST_ENV: "ci"
depends_on:
- kafka
- schema_registry
command: >
-c
"(until (kafkacat -b kafka:9093 -X debug=all -L); do sleep 5s; done) \
&& pytest tests/ --integration"
&& python3 -u -m pytest -v -x tests/ --integration"
14 changes: 12 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,15 @@ services:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0



schema_registry:
image: confluentinc/cp-schema-registry:5.2.2
container_name: schema_registry
environment:
- SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=zookeeper:2181
- SCHEMA_REGISTRY_HOST_NAME=schema-registry
- SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081
- SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS=PLAINTEXT://kafka:9093
depends_on:
- kafka
ports:
- 8081:8081