Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion process_tracker/extract_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(
location_name=None,
location_path=None,
status=None,
config_location=None,
):
"""
ExtractTracker is the primary engine for tracking data extracts
Expand All @@ -43,8 +44,10 @@ def __init__(
:type location_name: string
:param status: Optional if status does not need to be 'initializing', which is default.
:type status: string
:param config_location: Optional location for the process_tracker configuration file.
:type config_location: string
"""
config = SettingsManager().config
config = SettingsManager(config_location=config_location).config

self.logger = logging.getLogger(__name__)
self.logger.setLevel(config["DEFAULT"]["log_level"])
Expand Down
12 changes: 9 additions & 3 deletions process_tracker/process_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def __init__(
directory.
:type config_location: file path
"""
config = SettingsManager().config
self.config_location = config_location
self.config = SettingsManager(config_location=self.config_location).config

self.logger = logging.getLogger(__name__)
self.logger.setLevel(config["DEFAULT"]["log_level"])
self.logger.setLevel(self.config["DEFAULT"]["log_level"])
self.logger.addHandler(console)

self.data_store = DataStore(config_location=config_location)
Expand Down Expand Up @@ -395,11 +396,16 @@ def register_extracts_by_location(self, location_path, location_name=None):
filename=file.key,
location=location,
status="ready",
config_location=self.config_location,
)
else:
for file in os.listdir(location_path):
ExtractTracker(
process_run=self, filename=file, location=location, status="ready"
process_run=self,
filename=file,
location=location,
status="ready",
config_location=self.config_location,
)

def register_new_process_run(self):
Expand Down
6 changes: 3 additions & 3 deletions process_tracker/utilities/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, config_location=None):
self.aws_utils = AwsUtilities()

exists = False
cloud = False

if config_location is None:
home = Path.home()
Expand Down Expand Up @@ -62,14 +63,13 @@ def __init__(self, config_location=None):
if self.aws_utils.determine_valid_s3_path(
path=self.config_path
) and self.aws_utils.determine_s3_file_exists(path=self.config_file):

cloud = True
exists = True

if exists:
self.read_config_file()
else:
# How to handle if exists is false and it's s3?

elif not cloud:
self.create_config_file()

def create_config_file(self):
Expand Down