funboost 19.1__py3-none-any.whl → 19.2__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.

Potentially problematic release.


This version of funboost might be problematic. Click here for more details.

@@ -1,6 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # @Author : ydf
3
3
  # @Time : 2022/8/8 0008 12:23
4
+ import os
5
+
4
6
  import json
5
7
  from funboost.utils.dependency_packages.mongomq import MongoQueue
6
8
  from funboost.publishers.base_publisher import AbstractPublisher
@@ -11,18 +13,26 @@ from funboost.utils.mongo_util import MongoMixin
11
13
  class MongoMqPublisher(AbstractPublisher, MongoMixin):
12
14
  # 使用mongo-queue包实现的基于mongodb的队列。 队列是一个col,自动存放在consume_queues库中。
13
15
  # noinspection PyAttributeOutsideInit
16
+
17
+ pid__queue_map = {}
18
+
14
19
  def custom_init(self):
15
20
  pass
16
21
 
17
22
  @property
18
23
  def queue(self):
19
- return MongoQueue(
20
- # self.mongo_client.get_database('consume_queues').get_collection(self._queue_name),
21
- self.get_mongo_collection('consume_queues', self._queue_name),
22
- consumer_id=f"consumer-{time_util.DatetimeConverter().datetime_str}",
23
- timeout=600,
24
- max_attempts=3,
25
- ttl=24 * 3600 * 365)
24
+ ''' 不能提前实例化,mongo fork进程不安全,这样是动态生成queue'''
25
+ pid = os.getpid()
26
+ if pid not in MongoMqPublisher.pid__queue_map:
27
+ queuex = MongoQueue(
28
+ # self.mongo_client.get_database('consume_queues').get_collection(self._queue_name),
29
+ self.get_mongo_collection('consume_queues', self._queue_name),
30
+ consumer_id=f"consumer-{time_util.DatetimeConverter().datetime_str}",
31
+ timeout=600,
32
+ max_attempts=3,
33
+ ttl=24 * 3600 * 365)
34
+ MongoMqPublisher.pid__queue_map[pid] =queuex
35
+ return MongoMqPublisher.pid__queue_map[pid]
26
36
 
27
37
  def concrete_realization_of_publish(self, msg):
28
38
  # noinspection PyTypeChecker
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: funboost
3
- Version: 19.1
3
+ Version: 19.2
4
4
  Summary: pip install funboost,python全功能分布式函数调度框架,。支持python所有类型的并发模式和一切知名消息队列中间件,python函数加速器,框架包罗万象,一统编程思维,兼容50% python业务场景,适用范围广。只需要一行代码即可分布式执行python一切函数。旧名字是function_scheduling_distributed_framework
5
5
  Home-page: https://github.com/ydf0509/funboost
6
6
  Author: bfzs
@@ -86,7 +86,7 @@ funboost/publishers/httpsqs_publisher.py,sha256=7cf5ijwrbp4smq6ofndrKisruAqG0Wzf
86
86
  funboost/publishers/kafka_publisher.py,sha256=49JKL9PopDSIiQ3ZKBSSNPhByR-owxc2pbM4nT4Tc6g,2156
87
87
  funboost/publishers/kombu_publisher.py,sha256=ChX3qVE7Kvdu9XVFCKezV2KAwUqY7EhpvMS8nFelsY8,4567
88
88
  funboost/publishers/local_python_queue_publisher.py,sha256=veskMS5tjeneYU9HmrJLXZSK9_UT48NzHzcljjOoy3g,1365
89
- funboost/publishers/mongomq_publisher.py,sha256=t-vayvMsGhWEREJ1PzOFNuEMK9TOSKhD-DggzkS__nc,1453
89
+ funboost/publishers/mongomq_publisher.py,sha256=Aia8xIJc6GhFNftyYhTQq0KtLbPDR8IM3AnAm6bky4Y,1814
90
90
  funboost/publishers/mqtt_publisher.py,sha256=NKVDE5R12QL99IXgRjJtF4phyW8QaXKxHkqW5p_kXr4,3050
91
91
  funboost/publishers/msg_result_getter.py,sha256=R_tYQUgnZtTUWge--i1j_aYZLY3wysNTTFKCQ2JKQbE,6161
92
92
  funboost/publishers/nats_publisher.py,sha256=hFfaQovij9dm8w-iRN0SgiHHoS_TlrTAjw42dPwCLSA,776
@@ -157,8 +157,8 @@ funboost/utils/pysnooper_ydf/pycompat.py,sha256=ehsCfjsLdwoK0_o5fwYWDo3WeqCVfHW5
157
157
  funboost/utils/pysnooper_ydf/tracer.py,sha256=2leNcEhT0qt2B_7Vn094dep9AG0qnRX94imQHm4Qp8k,19122
158
158
  funboost/utils/pysnooper_ydf/utils.py,sha256=Y0nGXPqdiHBwO93TQAyYNbrzXtcK3_BQXrDVyjcTqVw,2748
159
159
  funboost/utils/pysnooper_ydf/variables.py,sha256=N12-WKrg4GFt3X1aw9c-jwuVbn2wQTNZXscrYP9RM2k,3678
160
- funboost-19.1.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
161
- funboost-19.1.dist-info/METADATA,sha256=8ZXXWh1xRShpwof3PlLa0WKttv4lJocbx0G_BL3MkUU,25630
162
- funboost-19.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
163
- funboost-19.1.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
164
- funboost-19.1.dist-info/RECORD,,
160
+ funboost-19.2.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
161
+ funboost-19.2.dist-info/METADATA,sha256=_8V8rpfUTACU5cBPRhdxHkF_Nduoi8X3swyry2mQ1hA,25630
162
+ funboost-19.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
163
+ funboost-19.2.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
164
+ funboost-19.2.dist-info/RECORD,,