Skip to content

Commit

Permalink
removed dependency on datanator_query_python
Browse files Browse the repository at this point in the history
  • Loading branch information
lzy7071 committed Oct 31, 2019
1 parent cc4cb67 commit c4adc0c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 230 deletions.
25 changes: 14 additions & 11 deletions karr_lab_aws_manager/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ def __init__(self, credential_path=None, config_path=None, profile_name=None):
os.environ['AWS_SECRET_ACCESS_KEY'] = self.credentials[profile_name]['aws_secret_access_key']
os.environ['AWS_DEFAULT_REGION'] = config['profile ' + profile_name]['region']
else:
os.environ['AWS_PROFILE'] = os.getenv(
profile_name.upper() + '_AWS_PROFILE')
os.environ['AWS_ACCESS_KEY_ID'] = os.getenv(profile_name.upper() + '_AWS_ACCESS_KEY_ID')
os.environ['AWS_ACCESS_KEY_ID'] = os.getenv(profile_name.upper() + '_AWS_ACCESS_KEY_ID', 'test')
os.environ['AWS_SECRET_ACCESS_KEY'] = os.getenv(
profile_name.upper() + '_AWS_SECRET_ACCESS_KEY')
profile_name.upper() + '_AWS_SECRET_ACCESS_KEY', 'test')
os.environ['AWS_DEFAULT_REGION'] = os.getenv(
profile_name.upper() + '_AWS_DEFAULT_REGION')
profile_name.upper() + '_AWS_DEFAULT_REGION', 'test')


class establishSession(credentialsFile):
Expand All @@ -41,12 +39,13 @@ def __init__(self, credential_path=None, config_path=None, profile_name=None,
service_name=None):
super().__init__(credential_path=credential_path, config_path=config_path,
profile_name=profile_name)
self.session = boto3.Session(profile_name=profile_name)
self.session = boto3.Session(aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'))
self.access_key = self.session.get_credentials().access_key
self.secret_key = self.session.get_credentials().secret_key
self.region = self.session.region_name
self.awsauth = AWS4Auth(self.access_key, self.secret_key,
self.region, service_name)
self.region, service_name)


class establishES(establishSession):
Expand All @@ -57,10 +56,14 @@ def __init__(self, credential_path=None, config_path=None, profile_name=None,
super().__init__(credential_path=credential_path, config_path=config_path,
profile_name=profile_name, service_name=service_name)
self.client = self.session.client(service_name)
self.es_config = str(Path(elastic_path).expanduser())
config = ConfigParser()
config.read(self.es_config)
self.es_endpoint = config['elasticsearch-endpoint']['address']
self._test = 'test'
if elastic_path is not None:
self.es_config = str(Path(elastic_path).expanduser())
config = ConfigParser()
config.read(self.es_config)
self.es_endpoint = config['elasticsearch-endpoint']['address']
else:
self.es_endpoint = os.getenv("FTX_ENDPOINT")


class establishS3(establishSession):
Expand Down
1 change: 0 additions & 1 deletion karr_lab_aws_manager/elasticsearch_kl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import batch_load
from . import query_builder
from . import util
164 changes: 0 additions & 164 deletions karr_lab_aws_manager/elasticsearch_kl/batch_load.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ cement >= 3.0.0 # for command line programs
urllib3 == 1.24.2 # for quilt3 compatibility
ruamel.yaml == 0.15.70 # for quilt3 compatibility
setuptools # for pkg_resources module
datanator_query_python >= 0.2.5
pkg_utils
mock
boto3
Expand Down
52 changes: 0 additions & 52 deletions tests/elasticsearch/test_batch_load.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/elasticsearch/test_elasticsearch_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import unittest
from karr_lab_aws_manager.elasticsearch_kl import util
from datanator_query_python.config import config
from pathlib import Path
import json
import tempfile
Expand Down

0 comments on commit c4adc0c

Please sign in to comment.