moose-lib 0.5.23__py3-none-any.whl → 0.5.25__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.
moose_lib/commons.py CHANGED
@@ -5,6 +5,7 @@ from datetime import datetime, timezone
5
5
  import requests
6
6
  import json
7
7
  from typing import Optional, Literal
8
+ import os
8
9
 
9
10
 
10
11
  class CliLogData:
@@ -20,6 +21,9 @@ class CliLogData:
20
21
  self.message = message
21
22
 
22
23
 
24
+ moose_management_port = int(os.environ.get("MOOSE_MANAGEMENT_PORT", "5001"))
25
+
26
+
23
27
  def cli_log(log: CliLogData) -> None:
24
28
  try:
25
29
  # When dmv2 starts up, it imports all the dmv2 definitions. In python,
@@ -27,7 +31,7 @@ def cli_log(log: CliLogData) -> None:
27
31
  # If the user has a function being called at the module level, and that function
28
32
  # tries to send logs when moose hasn't fully started, the requests will fail.
29
33
  # The try catch is to ignore those errors.
30
- url = "http://localhost:5001/logs"
34
+ url = f"http://localhost:{moose_management_port}/logs"
31
35
  headers = {'Content-Type': 'application/json'}
32
36
  requests.post(url, data=json.dumps(log.__dict__), headers=headers)
33
37
  except:
@@ -30,7 +30,7 @@ from typing import Optional, Callable, Tuple, Any
30
30
 
31
31
  from moose_lib.dmv2 import get_streams, DeadLetterModel
32
32
  from moose_lib import cli_log, CliLogData, DeadLetterQueue
33
- from moose_lib.commons import EnhancedJSONEncoder
33
+ from moose_lib.commons import EnhancedJSONEncoder, moose_management_port
34
34
 
35
35
  # Force stdout to be unbuffered
36
36
  sys.stdout = io.TextIOWrapper(
@@ -372,7 +372,7 @@ def main():
372
372
  time.sleep(1)
373
373
  with metrics_lock:
374
374
  requests.post(
375
- "http://localhost:5001/metrics-logs",
375
+ f"http://localhost:{moose_management_port}/metrics-logs",
376
376
  json={
377
377
  'timestamp': datetime.now(timezone.utc).isoformat(),
378
378
  'count_in': metrics['count_in'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.5.23
3
+ Version: 0.5.25
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -1,6 +1,6 @@
1
1
  moose_lib/__init__.py,sha256=_XXfHrzRl-M5M1e3CwBQGGblVQYKnU5QJkipghe4bXU,184
2
2
  moose_lib/blocks.py,sha256=_wdvC2NC_Y3MMEnB71WTgWbeQ--zPNHk19xjToJW0C0,3185
3
- moose_lib/commons.py,sha256=z63RPtdHFRMFvPDWIvOCYV6UHlib7si34RpD5VPa0Gs,3602
3
+ moose_lib/commons.py,sha256=FUpRv8D3-LeGcjhcqtDyiimz5izwpCq53h50ydxC_uA,3711
4
4
  moose_lib/data_models.py,sha256=FjFNd88WWCGMG5p5gV-Vjgp1cXARBeFapEHqDy0-WX8,9792
5
5
  moose_lib/dmv2-serializer.py,sha256=CL_Pvvg8tJOT8Qk6hywDNzY8MYGhMVdTOw8arZi3jng,49
6
6
  moose_lib/internal.py,sha256=6qKPGUPxJV3oNruKg76umw_P_TcMgVAuaijn-7EdHXQ,14659
@@ -27,12 +27,12 @@ moose_lib/dmv2/types.py,sha256=5FsB0HLHFkYB-8cjJ0rtRUjqahVA-ToLr2JXT1lFiss,3276
27
27
  moose_lib/dmv2/view.py,sha256=fVbfbJgc2lvhjpGvpfKcFUqZqxKuLD4X59jdupxIe94,1350
28
28
  moose_lib/dmv2/workflow.py,sha256=ZNEMaYWGCkOw_1qropfl2m553aq5YG16Y0rOJjo8eak,5916
29
29
  moose_lib/streaming/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- moose_lib/streaming/streaming_function_runner.py,sha256=l8oF3qJpYDxPLQFvoF8TrbCWI0WPV6lVLYwdw9Oqyg4,23378
30
+ moose_lib/streaming/streaming_function_runner.py,sha256=toide6mpUIuHWv75Iv8PmKL6HlsPnBB2XRq2aIjOWBY,23421
31
31
  tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
32
32
  tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
33
33
  tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
34
34
  tests/test_redis_client.py,sha256=d9_MLYsJ4ecVil_jPB2gW3Q5aWnavxmmjZg2uYI3LVo,3256
35
- moose_lib-0.5.23.dist-info/METADATA,sha256=-ZU_EhpktG5j2r4fIsYPiALD6o2vs8ZnSQcbEDam9A8,730
36
- moose_lib-0.5.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- moose_lib-0.5.23.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
38
- moose_lib-0.5.23.dist-info/RECORD,,
35
+ moose_lib-0.5.25.dist-info/METADATA,sha256=pEdTwciQXBLBa9hAqmeNqeR3WyT2G3prT2kawyd2Nys,730
36
+ moose_lib-0.5.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ moose_lib-0.5.25.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
38
+ moose_lib-0.5.25.dist-info/RECORD,,