Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:abrarsheikh/data_pipeline into pr…
Browse files Browse the repository at this point in the history
…-2-abrar-internal_push
  • Loading branch information
abrarsheikh committed Nov 29, 2016
2 parents a43f6ca + 1e52061 commit 318fb2f
Show file tree
Hide file tree
Showing 24 changed files with 118 additions and 88 deletions.
17 changes: 4 additions & 13 deletions .travis.yml
Expand Up @@ -3,20 +3,11 @@ branches:
- master
- /^v[0-9.]+$/
language: python
services:
- docker
python:
- '2.7'
env:
matrix:
- MAKE_TARGET=test
- '2.7'
install: pip install coveralls tox
script: make -f Makefile-opensource "$MAKE_TARGET"
script: make -f Makefile-opensource test
after_success:
- coveralls
deploy:
provider: pypi
user: <TODO>
password:
secure: <TODO>
on:
tags: true
repo: Yelp/data_pipeline
3 changes: 1 addition & 2 deletions Makefile-opensource
Expand Up @@ -41,8 +41,7 @@ clean-vim:
find . -name '*.swo' -exec rm -f {} +

test:
# This will timeout after 15 minutes, in case there is a hang on jenkins
OPEN_SOURCE_MODE=true PULL_CONTAINERS=true FORCE_FRESH_CONTAINERS=true timeout -9 1800 tox -c tox-opensource.ini $(REBUILD_FLAG)
OPEN_SOURCE_MODE=true PULL_CONTAINERS=true FORCE_FRESH_CONTAINERS=true tox -c tox-opensource.ini $(REBUILD_FLAG)

docs: clean-docs
tox -c tox-opensource.ini -e docs $(REBUILD_FLAG)
Expand Down
14 changes: 10 additions & 4 deletions data_pipeline/config.py
Expand Up @@ -228,7 +228,7 @@ def kafka_zookeeper(self):
def zookeeper_discovery_path(self):
return data_pipeline_conf.read_string(
'zookeeper_discovery_path',
default='/nail/etc/zookeeper_discovery/generic/uswest2{ecosystem}.yaml'
default='zookeeper_discovery{ecosystem}.yaml'
)

@property
Expand Down Expand Up @@ -301,10 +301,11 @@ def encryption_type(self):

@property
def key_location(self):
"""Directory in which to look for key to encrypt pii."""
"""Directory in which to look for key to encrypt pii. ./key-1.key is meant for
unit tests and documentation purpose, please use a different key in production."""
return data_pipeline_conf.read_string(
'key_location',
default='/nail/srv/configs/data_pipeline/'
default='./'
)

@property
Expand All @@ -314,7 +315,7 @@ def data_pipeline_teams_config_file_path(self):
"""
return data_pipeline_conf.read_string(
'data_pipeline_teams_config_file_path',
default='/nail/etc/services/data_pipeline/teams.yaml'
default='teams.yaml'
)

@property
Expand Down Expand Up @@ -532,6 +533,11 @@ def max_producer_delay_seconds(self):
greater than this time will produce an alert"""
return data_pipeline_conf.read_int('sensu_max_delay_seconds', 300)

@property
def ecosystem_file_path(self):
"""Path to the file that specifies the ecosystem."""
return data_pipeline_conf.read_string('ecosystem_file_path', "ecosystem")


def configure_from_dict(config_dict):
"""Configure the :mod:`data_pipeline` clientlib from a dictionary.
Expand Down
2 changes: 1 addition & 1 deletion data_pipeline/environment_configs.py
Expand Up @@ -18,4 +18,4 @@

import os

IS_OPEN_SOURCE_MODE = os.getenv('OPEN_SOURCE_MODE', 'false').lower() in ['t', 'true', 'y', 'yes']
IS_OPEN_SOURCE_MODE = os.getenv('OPEN_SOURCE_MODE', 'true').lower() in ['t', 'true', 'y', 'yes']
14 changes: 11 additions & 3 deletions data_pipeline/testing_helpers/containers.py
Expand Up @@ -36,7 +36,15 @@

class ContainerUnavailableError(Exception):
def __init__(self, project='unknown', service='unknown'):
Exception.__init__(self, "Container for project {0} and service {1} failed to start".format(project, service))
try:
msg = open("logs/docker-compose.log", 'r').read()
except IOError:
msg = "no error log."
Exception.__init__(self, "Container for project {0} and service {1} failed to start with {2}".format(
project,
service,
msg
))


class Containers(object):
Expand Down Expand Up @@ -164,7 +172,7 @@ def get_container_info(cls, project, service, docker_client=None):
raise ContainerUnavailableError(project=project, service=service)

@classmethod
def get_container_ip_address(cls, project, service, timeout_seconds=60):
def get_container_ip_address(cls, project, service, timeout_seconds=100):
"""Fetches the ip address assigned to the running container.
Throws ContainerUnavailableError if the retry limit is reached.
Expand Down Expand Up @@ -418,4 +426,4 @@ def _run_compose(self, *args):
)

def _is_envvar_set(self, envvar):
return os.getenv(envvar, 'false').lower() in ['t', 'true', 'y', 'yes']
return os.getenv(envvar, 'true').lower() in ['t', 'true', 'y', 'yes']
6 changes: 3 additions & 3 deletions data_pipeline/testing_helpers/docker-compose-opensource.yml
Expand Up @@ -11,11 +11,11 @@ kafka:
# TODO (DATAPIPE-1858|abrar): change all the yelpcorp url's to docker hub once we
# push our docker images to docker hub.
schematizerdatabase:
image: docker-dev.yelpcorp.com/schematizer_database:latest
image: docker.io/yelp/schematizer_database:latest
schematizerconfigs:
image: docker-dev.yelpcorp.com/schematizer_configs:latest
image: docker.io/yelp/schematizer_configs:latest
schematizer:
image: docker-dev.yelpcorp.com/schematizer_service:latestopensource
image: docker.io/yelp/schematizer_service:latest
links:
- schematizerdatabase
volumes_from:
Expand Down
1 change: 1 addition & 0 deletions data_pipeline/tools/bootstrapper.py
Expand Up @@ -383,6 +383,7 @@ def get_source_from_sql_file_path(self, sql_file_path):
def is_file_bootstrapper_class(obj):
return inspect.isclass(obj) and FileBootstrapperBase in obj.__bases__


FILE_BOOTSTRAPPER_CLASSES = [
obj for _, obj in inspect.getmembers(sys.modules[__name__], is_file_bootstrapper_class)
]
Expand Down
1 change: 1 addition & 0 deletions data_pipeline/tools/compaction_setter.py
Expand Up @@ -148,5 +148,6 @@ def run(self):
self.log.info("Found {} topics to compact".format(len(topics)))
self.apply_log_compaction(topics)


if __name__ == '__main__':
CompactionSetter().start()
1 change: 1 addition & 0 deletions data_pipeline/tools/redshift_sql_to_avsc.py
Expand Up @@ -465,5 +465,6 @@ def convert_sql_to_avsc(self, avsc_file_path, sql_file_path):
sort_keys=True
)


if __name__ == "__main__":
RedshiftSQLToAVSCBatch().start()
2 changes: 1 addition & 1 deletion data_pipeline/zookeeper.py
Expand Up @@ -44,7 +44,7 @@ def max_tries(self):

@cached_property
def ecosystem(self):
return open('/nail/etc/ecosystem').read().strip()
return open(get_config().ecosystem_file_path).read().strip()

def __init__(self):
retry_policy = KazooRetry(max_tries=self.max_tries)
Expand Down
1 change: 1 addition & 0 deletions ecosystem
@@ -0,0 +1 @@
devc
49 changes: 49 additions & 0 deletions key-1.key
@@ -0,0 +1,49 @@
MIIJKQIBAAKCAgEAgtOJ7j/3h+fynqWCV0C9EV0PMl7x6ht/QX9Ool6aGXuG7IOb
+PHhmpcPrSmoRaC2m3dJooLxzxAtIJ1JbNb9c55lvCg2ft/3d0CwwD/HMmCSQ3V7
QykcgDgqW3W9RWlUa6mb4ExxFowwx5TLa0snCVhPv8FjwLC5z7NqispjuSVdwgoQ
nY4fg4wpvH/ziHT2qkNBLP/y1xHmhzsaWWLxdFT4IBmHCWorQEmfB9WHwxEO510u
cjkOjSZ66ba6yLgsgY1VMsCYj/rQpQeZYgjk7ZwelGJyvz/lrH87piSRE70zReAj
GuGKEULYVPxsFT7xEhgwDbH6+8ZKo1Sz49DTgB9MtSOtI5UkSct1/Hv3SJoZXmDS
Avn0MlyOxAYhlX9FVS2placyksM6lPfRHUH9SndOK4OOLVhnLvKyY/F9pFXx6QP1
Ni0J+s5ylNBNl8dXbPBRtFRFgHnyZ85XDMQ0tDWULydkQEqbfuy0SWIgfS9ClBPo
1nQNTNvlUp6re0CSz+I0siQ/ctl6F172/8m3TbNVf6FL7VKte6gksVWjeqDH66ww
EyEQC7dLSGFiD/CFv/6k6zv5VZRrpjBISjvXg89h5BhWQ8bXqlbPdEGN0vgx9Kwm
DV8eW3uQZenbepNdLOVIkDzKQZZ+q5C7FNiFM4dyzXQ3uMPcOw+p9nTXUwkCAwEA
AQKCAgBbn174FqB68/y9Etjn1pUTNgNQmaH+/ObwrgIaQPrXYeWqermfbXc81xLJ
iWUp7lY1JyPQxrgm9gNE1iL4MNEsSgCh99/Cl4QuZoXi/ke5hlypFfwPmxk0yyEP
ELRPimbvR8e9HIwO6Hu5KwIT0Hw0VT704rHD34Eib1rsfLW+kubI4FemoER90ong
VBPwu0mNELDynQYrjYPPrZrUgzDq8h8cDATAmTRVP7o6uFbuTGINsvq2UDN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/HNarHIk
3j2M4/b72cIAtQtZfwRR8WZ5JXs8ZIn5UN4kM0MvoVTDdYh0ieLevuIfqA08
1 change: 0 additions & 1 deletion requirements.d/dev-internal.txt
Expand Up @@ -19,4 +19,3 @@ terminaltables>=1.0.2
wheel>=0.22
factory_boy==2.5.2
pytest-benchmark==3.0.0
clog
1 change: 0 additions & 1 deletion requirements.d/dev.txt
Expand Up @@ -17,4 +17,3 @@ SQLAlchemy==1.0.8
terminaltables>=1.0.2
wheel>=0.22
factory_boy==2.5.2
clog
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -57,7 +57,8 @@
'PyStaticConfiguration>=0.9.0',
'simplejson>=2.1.2',
'swagger_zipkin>=0.1.0',
'yelp-avro==1.9.2'
'yelp-avro==1.9.2',
'yelp-clog==2.2.11'
],
extras_require={
'tools': [
Expand Down
6 changes: 6 additions & 0 deletions teams.yaml
@@ -0,0 +1,6 @@
---
teams:
bam:
email: team1@yelp.com
team2:
email: team2@yelp.com
52 changes: 0 additions & 52 deletions tests/config/teams.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion tests/config_test.py
Expand Up @@ -88,7 +88,7 @@ def test_active_encryption_key(self, config):
assert config.encryption_type is None

def test_data_pipeline_teams_config_file_path(self, config):
assert config.data_pipeline_teams_config_file_path == '/nail/etc/services/data_pipeline/teams.yaml'
assert config.data_pipeline_teams_config_file_path == 'teams.yaml'

def test_kafka_client_ack_count(self, config):
assert config.kafka_client_ack_count == -1
Expand Down Expand Up @@ -124,6 +124,8 @@ def setup_class(cls):
"""SmartStack needs to be configured to use service discovery, so
doing that for the entire class.
"""
if IS_OPEN_SOURCE_MODE:
return
staticconf.YamlConfiguration(
'/nail/etc/services/services.yaml',
namespace='smartstack_services'
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Expand Up @@ -344,7 +344,7 @@ def kafka_docker(containers):
def configure_teams():
config_path = os.path.join(
os.path.dirname(__file__),
'config/teams.yaml'
'../teams.yaml'
)
with reconfigure(data_pipeline_teams_config_file_path=config_path):
yield
Expand Down
1 change: 1 addition & 0 deletions tests/tools/introspector/schema_check_command_test.py
Expand Up @@ -30,6 +30,7 @@
class FakeParserError(Exception):
pass


Args = namedtuple(
"Namespace", [
"schema",
Expand Down
7 changes: 7 additions & 0 deletions tests/zookeeper_test.py
Expand Up @@ -23,6 +23,7 @@
from kazoo.client import KazooClient
from kazoo.exceptions import LockTimeout

from data_pipeline.environment_configs import IS_OPEN_SOURCE_MODE
from data_pipeline.zookeeper import ZK
from data_pipeline.zookeeper import ZKLock

Expand Down Expand Up @@ -121,10 +122,16 @@ def test_lock_exception(
assert locked_zk_client.stop.call_count >= 1
assert locked_zk_client.close.call_count >= 1

@pytest.mark.skipif(
IS_OPEN_SOURCE_MODE,
reason="This test is acquiring lock on local ZK instance and not on the mock."
)
def test_double_lock(
self,
patch_exit
):
# TODO (DATAPIPE-2122|abrar): this test is aqcuiring
# lock on actual zookeeper instance, needs to be fixed.
with ZKLock(self.fake_name, self.fake_namespace):
assert patch_exit.call_count == 0
with ZKLock(self.fake_name, self.fake_namespace):
Expand Down
4 changes: 0 additions & 4 deletions tox-opensource.ini
Expand Up @@ -3,14 +3,10 @@
# py34, py35, pypy
envlist = py27, docs
skipsdist = true
indexserver =
default = https://pypi.yelpcorp.com/simple/

[testenv]
basepython = python2.7
envdir = venv/py27
setenv =
PIP_INDEX_URL = https://pypi.yelpcorp.com/simple
venv_update = {toxinidir}/bin/venv-update venv= {envdir} install=
commands =
{[testenv]venv_update} -r {toxinidir}/requirements.d/dev.txt
Expand Down
11 changes: 11 additions & 0 deletions travis.yml
@@ -0,0 +1,11 @@
branches:
only:
- master
- "/^v[0-9.]+$/"
language: python
python:
- '2.7'
install: pip install coveralls tox
script: make -f Makefile-opensource test
after_success:
- coveralls
3 changes: 3 additions & 0 deletions zookeeper_discoverydevc.yaml
@@ -0,0 +1,3 @@
---
- - zk
- 2181

0 comments on commit 318fb2f

Please sign in to comment.