dnaStreaming 2.2.1__py3-none-any.whl → 2.2.1.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dnaStreaming/__init__.py +11 -27
- {dnastreaming-2.2.1.dist-info → dnaStreaming-2.2.1.dev1.dist-info}/METADATA +4 -29
- {dnastreaming-2.2.1.dist-info → dnaStreaming-2.2.1.dev1.dist-info}/RECORD +6 -6
- {dnastreaming-2.2.1.dist-info → dnaStreaming-2.2.1.dev1.dist-info}/WHEEL +1 -1
- {dnastreaming-2.2.1.dist-info → dnaStreaming-2.2.1.dev1.dist-info}/LICENSE +0 -0
- {dnastreaming-2.2.1.dist-info → dnaStreaming-2.2.1.dev1.dist-info}/top_level.txt +0 -0
dnaStreaming/__init__.py
CHANGED
|
@@ -5,37 +5,21 @@ import sys
|
|
|
5
5
|
import logging
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
env_log_path = os.getenv("LOG_PATH")
|
|
10
|
-
fallback_log_dir = os.path.expanduser('~/.dj-dna-streaming-python/logs')
|
|
11
|
-
base_dir = os.path.dirname(__file__)
|
|
12
|
-
default_path = os.path.join(base_dir, 'logs')
|
|
13
|
-
|
|
14
|
-
candidates = [env_log_path, default_path, fallback_log_dir]
|
|
15
|
-
|
|
16
|
-
for path in candidates:
|
|
17
|
-
if path:
|
|
18
|
-
try:
|
|
19
|
-
os.makedirs(path, exist_ok=True)
|
|
20
|
-
testfile = os.path.join(path, '.write_test')
|
|
21
|
-
with open(testfile, 'w') as f:
|
|
22
|
-
f.write('test')
|
|
23
|
-
os.remove(testfile)
|
|
24
|
-
return path
|
|
25
|
-
except Exception as e:
|
|
26
|
-
print(f"WARNING: Cannot write to '{path}': {e}")
|
|
27
|
-
|
|
28
|
-
raise RuntimeError("ERROR: Could not find a writable log directory.")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
log_path = get_log_path()
|
|
32
|
-
print("Will log to: {}".format(log_path))
|
|
8
|
+
BASE_DIR = os.path.dirname(__file__)
|
|
33
9
|
|
|
34
|
-
# Logging setup
|
|
35
10
|
logging.basicConfig(level=logging.WARN)
|
|
11
|
+
|
|
36
12
|
logger = logging.getLogger()
|
|
37
13
|
|
|
38
|
-
|
|
14
|
+
log_path = os.path.join(BASE_DIR, 'logs')
|
|
15
|
+
|
|
16
|
+
print("Will log to: {}".format(log_path))
|
|
17
|
+
|
|
18
|
+
if not os.path.exists(log_path):
|
|
19
|
+
os.mkdir(log_path)
|
|
20
|
+
|
|
21
|
+
fileHandler = logging.FileHandler("{0}/{1}.log".format(log_path, 'dj-dna-streaming-python'))
|
|
22
|
+
|
|
39
23
|
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
|
|
40
24
|
fileHandler.setFormatter(logFormatter)
|
|
41
25
|
logger.addHandler(fileHandler)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dnaStreaming
|
|
3
|
-
Version: 2.2.1
|
|
3
|
+
Version: 2.2.1.dev1
|
|
4
4
|
Summary: Dow Jones DNA Streaming Project
|
|
5
5
|
Home-page: https://github.com/dowjones/dj-dna-streams-python
|
|
6
|
-
Download-URL: https://github.com/dowjones/dj-dna-streams-python/archive/release-2.2.1.tar.gz
|
|
6
|
+
Download-URL: https://github.com/dowjones/dj-dna-streams-python/archive/release-2.2.1.dev1.tar.gz
|
|
7
7
|
Author: Zachary Kagan
|
|
8
8
|
Author-email: zachary.kagan@dowjones.com
|
|
9
9
|
License: MIT
|
|
@@ -14,7 +14,6 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Description-Content-Type: text/x-rst
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: setuptools >=75.1.0
|
|
18
17
|
Requires-Dist: googleapis-common-protos >=1.56.4
|
|
19
18
|
Requires-Dist: google-auth >=2.11.0
|
|
20
19
|
Requires-Dist: google-cloud-pubsub ==2.13.6
|
|
@@ -67,13 +66,7 @@ To set your subscription ID, simply set an environment variable named 'SUBSCRIPT
|
|
|
67
66
|
export SUBSCRIPTION_ID="ABC1234567889"
|
|
68
67
|
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.. code-block::
|
|
73
|
-
|
|
74
|
-
export LOG_PATH="/your/custom/log/path"
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
The code above is the command line expression for setting this environment variable on Mac OSX. Other operating systems might have a slightly different techniques for setting environment variables on the command line.
|
|
77
70
|
|
|
78
71
|
2. Using the configuration file.
|
|
79
72
|
###################################################################
|
|
@@ -153,25 +146,7 @@ You may want to listen messages asynchronously like so:
|
|
|
153
146
|
Log Files
|
|
154
147
|
_________
|
|
155
148
|
|
|
156
|
-
|
|
157
|
-
Minimal logging is written to a file named `dj-dna-streaming-python.log`.
|
|
158
|
-
|
|
159
|
-
By default, logs are written to the first available directory from the following list:
|
|
160
|
-
|
|
161
|
-
1. A custom path set via the environment variable `LOG_PATH`.
|
|
162
|
-
2. A `logs/` folder located within the package installation directory.
|
|
163
|
-
3. A fallback directory: `~/.dj-dna-streaming-python/logs/`.
|
|
164
|
-
|
|
165
|
-
The first writable location found is selected. A message like `Will log to: /your/custom/log/path` is printed to the console on startup.
|
|
166
|
-
|
|
167
|
-
💡 The log file is overwritten each time the application starts to keep maintenance simple.
|
|
168
|
-
|
|
169
|
-
You can specify:
|
|
170
|
-
|
|
171
|
-
- **Absolute paths**: For example, `/var/log/dna-streaming`.
|
|
172
|
-
- **Relative paths**: For example, `./logs`, relative to the current working directory at runtime.
|
|
173
|
-
|
|
174
|
-
The code verifies that the specified path is writable. If it isn’t, it automatically falls back to the next available option.
|
|
149
|
+
Very minimal logging is written to the module's path 'logs/dj-dna-streaming-python.log'. To keep maintenance simple this log is overwritten every time the app starts.
|
|
175
150
|
|
|
176
151
|
|
|
177
152
|
Testing
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
dnaStreaming/__init__.py,sha256=
|
|
1
|
+
dnaStreaming/__init__.py,sha256=Brud0G1kzJ2Fu4FtDveQnHraKl7r26zdSdPK0EqrLp4,752
|
|
2
2
|
dnaStreaming/config.py,sha256=DLNFOvWlj5sLAr39i632yxgWQppYYw_YbUSiUMpy87U,3773
|
|
3
3
|
dnaStreaming/customer_config.json,sha256=hzrReqREkH-j39vgifA-VVUtnkBtQJO4d2QyF8j9NMo,46
|
|
4
4
|
dnaStreaming/listener.py,sha256=nNARri0SFpo3HbTayYbjNKJiP11VyFhozNLdow8GmjQ,7794
|
|
@@ -14,8 +14,8 @@ dnaStreaming/services/credentials_service.py,sha256=S9nJl1heuNZzDaTrzgzTF52UshR0
|
|
|
14
14
|
dnaStreaming/services/pubsub_service.py,sha256=P0YLy6MNXDVcAKsmVcuNf-WKar-LYawpah3dFnFr648,820
|
|
15
15
|
dnaStreaming/test/__init__.py,sha256=67-6hUa7BZvz64n27sEH0ulQtcg5qH8_Q2ot_XgFdFQ,79
|
|
16
16
|
dnaStreaming/test/test_config.py,sha256=mJPk-yxv49Zwsj0lHV-zcy8fhhlt0RFyfhbgg74g3Jo,3619
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
dnaStreaming-2.2.1.dev1.dist-info/LICENSE,sha256=l0T3WdIyACkYU-XdqJnaLC5_m1Wa0wJEZSJC4Owc7Y4,1077
|
|
18
|
+
dnaStreaming-2.2.1.dev1.dist-info/METADATA,sha256=gsxv7B8WaNLdIO4vGE_qM4rw1GrVtqs5DJ3q8nfc3X4,7554
|
|
19
|
+
dnaStreaming-2.2.1.dev1.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
20
|
+
dnaStreaming-2.2.1.dev1.dist-info/top_level.txt,sha256=08Lk4-qbvG3EGfiPeUI0NFUjIDJbA2RWO8ntC5friWs,13
|
|
21
|
+
dnaStreaming-2.2.1.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|