Skip to content

Commit a1d9bfb

Browse files
committed
process_tracker_python-60 Settings Manager should not try to create config file outright
🐛 disabled config file creation when environment is cloud based. Hit bug when importing process_tracker in lambda where the SettingsManager could not write since the directory structure is read only. Will create a build and test. Closes #60
1 parent ae4730c commit a1d9bfb

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

process_tracker/extract_tracker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(
2727
location_name=None,
2828
location_path=None,
2929
status=None,
30+
config_location=None,
3031
):
3132
"""
3233
ExtractTracker is the primary engine for tracking data extracts
@@ -43,8 +44,10 @@ def __init__(
4344
:type location_name: string
4445
:param status: Optional if status does not need to be 'initializing', which is default.
4546
:type status: string
47+
:param config_location: Optional location for the process_tracker configuration file.
48+
:type config_location: string
4649
"""
47-
config = SettingsManager().config
50+
config = SettingsManager(config_location=config_location).config
4851

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

process_tracker/process_tracker.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ def __init__(
7171
directory.
7272
:type config_location: file path
7373
"""
74-
config = SettingsManager().config
74+
self.config_location = config_location
75+
self.config = SettingsManager(config_location=self.config_location).config
7576

7677
self.logger = logging.getLogger(__name__)
77-
self.logger.setLevel(config["DEFAULT"]["log_level"])
78+
self.logger.setLevel(self.config["DEFAULT"]["log_level"])
7879
self.logger.addHandler(console)
7980

8081
self.data_store = DataStore(config_location=config_location)
@@ -395,11 +396,16 @@ def register_extracts_by_location(self, location_path, location_name=None):
395396
filename=file.key,
396397
location=location,
397398
status="ready",
399+
config_location=self.config_location,
398400
)
399401
else:
400402
for file in os.listdir(location_path):
401403
ExtractTracker(
402-
process_run=self, filename=file, location=location, status="ready"
404+
process_run=self,
405+
filename=file,
406+
location=location,
407+
status="ready",
408+
config_location=self.config_location,
403409
)
404410

405411
def register_new_process_run(self):

0 commit comments

Comments
 (0)