GithubHelp home page GithubHelp logo

kute / eventor Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 0.0 21 KB

多线程,进程,协程 任务执行器

Home Page: https://kute.github.io/2017/01/05/Python-Eventor-module.html

License: MIT License

Python 100.00%
eventor async gevent muti-process mutilthread couroutine python35

eventor's People

Contributors

kute avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eventor's Issues

Multiprocessing not working

 import multiprocessing
 from multiprocessing import Pool
 
 class pdf_gen():
   def __init__(self):
     pdf = self.pdf = FPDF()
     pdf.set_auto_page_break(True,0.1)
   
   def get_data_from_mysql(self) :
     pdf = self.pdf
     # connection is established and result is stored in 'res'.
     dup = []
     dup.insert(0,res)
     z = tuple(dup)
     return z

   def mysql_to_pdf_data(self,*result) :
     try : 
       pdf = self.pdf 
       # Entered data need to be in pdf
     finally : 
       pdf.output('save_pdf.pdf','F')

 def main() :
   pdf = pdf_gen()
   recover_data = pdf.get_data_from_mysql()
   pool = multiprocessing.Pool(multiprocessing.cpu_count())
   pool.map(pdf.mysql_to_pdf_data,recover_data)

Below picture shows that CPU was using only 1 core instead 2 were there.
capture

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.