From e311c278e7ab073d15e9bb6bb4f44bbf8daaee6c Mon Sep 17 00:00:00 2001 From: Jan Lerking Date: Mon, 19 Feb 2018 04:36:37 +0100 Subject: [PATCH] Added multiprocessing testing --- __pycache__/h2inc.cpython-35.pyc | Bin 3748 -> 3818 bytes __pycache__/h2inc_gui.cpython-35.pyc | Bin 6817 -> 6564 bytes h2inc_gui.py | 16 ++--- mp_counter.py | 29 ++++++++ mp_test.py | 40 +++++++++++ multiprocessing_test.py | 104 +++++++++++++++++++++++++++ 6 files changed, 181 insertions(+), 8 deletions(-) create mode 100644 mp_counter.py create mode 100644 mp_test.py diff --git a/__pycache__/h2inc.cpython-35.pyc b/__pycache__/h2inc.cpython-35.pyc index 1df678b448d8ede54381f4d4cfdc83334602eb8a..2dec8fc417e5ee7a12f514df8a54c322b679b88d 100644 GIT binary patch delta 467 zcmYk1ze@u#6vtog(!16sQngi)wrZ_P{Z$bJM<<;G(MiFU(wtCfdq?g%h)M?qag?mO ziM#kuh#>9(CpS0$0rBNr4CM2^`6lnZyobV9VP=%`fmZGM@IC|Z3ICRbdJ}i}ay!%C z_G~!Gz$L)p5C{q)0avJpK{z1XSdV~6f=I#?5aAJc%L9r>hu;3h>1Vj!*uB!3zy`!lcjC^ zj+{k9-Sc9$iz1{5FttxHR>ssj&pUC2BlXR9W((-*R5R$|6uoXFr|>Lu2IB^E1|_vW UxJb&XKbTJwW--o&Sdy*$0@s3LWB>pF delta 477 zcmYk0!7D^T9LImZdGGC8%&=>%D31_&6elE#gWO0tU`yJ}TW#&zT{CZskOSqcNiL3Z zaFeTl!ga1r{1s;2O6J#mf1jD}cc$NW@Dz;qGuF9Vx-Ib>z$g4$#PFKg^8If7YMHyh zJ-7iV<$z~^`zhyvXMuO5+zY%Dcvs2=;1oDZx$pJs9C7e1B6End>fU+ANwwn6U(J}$ zF96C$5y}Xs1CS6{Kghu)fy99e0@nz5Qh;3!uoL1|=n7^YX`e?j;Z-5J?1?r-<0z8y zuu`o>p`$ah(Go|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i zveC}lT!pqVxpJ0c+xZp5Rm37fCVLH~>xfSg`w3zSVQ!zJbP<7B_O4I%Tn_dAWS<24 zUHH5K0HIl`bsi0TMQK^=9xnIGQ{;J 0: + tempstr = 'Number of headers: '+str(filecnt) + temptot = 'Total progress: 0 of '+str(filecnt) + print ('Source directory: ', sourcedir.get()) + self.destlabel.config(state=NORMAL) + self.destentry.config(state=NORMAL) + self.destdir_button.config(state=NORMAL) + self.infofiles.config(text=tempstr) + self.totallabel.config(text=temptot) + self.filecnt = filecnt + foldercnt = sourcedir_foldercnt(root.directory) + if foldercnt > 0: + tempstr = 'Number of folders: '+str(foldercnt) + self.infofolders.config(text=tempstr) + + def select_destdir(self, destdir): + root.directory = filedialog.askdirectory() + if root.directory: + destdir.set(root.directory) + print ('Destination directory: ', destdir.get()) + self.incchkbox.config(state=NORMAL) + self.infofolders.config(state=NORMAL) + self.infofiles.config(state=NORMAL) + self.translate_button.config(state=NORMAL) + self.cfilelabel.config(state=NORMAL) + self.totallabel.config(state=NORMAL) + + def translate(self, destdir, sourcedir, addinc): + doinc = addinc.get() + dest = destdir.get() + source = sourcedir.get() + if doinc == 'yes': + dest = dest+'/include' + print(os.path.exists(os.path.dirname(dest))) + if not os.path.exists(os.path.dirname(dest)): + try: + os.makedirs(os.path.dirname(dest)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise + destdir.set(dest) + print ('Destination directory: ', destdir.get()) + process_files(source, dest) + + def cfileprogress_update(cnt): + self.cfilevar = cnt + + def currentfile_update(current): + self.currentfile = 'Current file: '+current + +root = Tk() +root.update() +#root.minsize(350, 210) +#width = (root.winfo_screenwidth()/2)-(350/2) +#height = (root.winfo_screenheight()/2)-(210/2) +#root.geometry('+%d+%d' % (width, height)) +root.resizable(False, False) +f_progress = file_progress(root) +root.mainloop() cpu_info = cpuinfo.get_cpu_info() num_cores = mp.cpu_count()