*I try to perform multi-process analysis in the code to analyze the data of 
a certain file, but the code cannot perform the join normally, and there is 
no method to perform multiprocessing.Process. May I ask what I did wrong, 
please forgive me for not knowing how to format in the google group So I 
formatted it manually. Thank you very much for reading my question. Below 
is my test code*

#coding:utf-8
from prometheus_client import generate_latest, CollectorRegistry
from prometheus_client.core import CollectorRegistry
from flask import Response,Flask
import multiprocessing
class CustomCollector(object):
       def get_data(self,data):
              print(data)

      def collect(self):
             plist = []
             for x in range(30):
                   p = multiprocessing.Process(target=self.get_data,args=(
"test",))
                   plist.append(p)
                   p.start()

             for p in plist:
                   p.join()
                   print('Process close')

def rundata():
      REGISTRY = CollectorRegistry(auto_describe=False)
      REGISTRY.register(CustomCollector())
      coll = CustomCollector()
      coll.collect()
      return Response(generate_latest(REGISTRY), mimetype="text/plain")

rundata()

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/23729221-704a-462a-8abc-d44c6f9015bfn%40googlegroups.com.

Reply via email to