<86>Jul 16 09:00:05 userdel[1430834]: delete user 'rooter' <86>Jul 16 09:00:05 userdel[1430834]: removed shadow group 'rooter' owned by 'rooter' <86>Jul 16 09:00:05 groupadd[1430839]: group added to /etc/group: name=rooter, GID=651 <86>Jul 16 09:00:05 groupadd[1430839]: group added to /etc/gshadow: name=rooter <86>Jul 16 09:00:05 groupadd[1430839]: new group: name=rooter, GID=651 <86>Jul 16 09:00:05 useradd[1430843]: new user: name=rooter, UID=651, GID=651, home=/root, shell=/bin/bash <86>Jul 16 09:00:05 userdel[1430852]: delete user 'builder' <86>Jul 16 09:00:05 userdel[1430852]: removed group 'builder' owned by 'builder' <86>Jul 16 09:00:05 userdel[1430852]: removed shadow group 'builder' owned by 'builder' <86>Jul 16 09:00:05 groupadd[1430857]: group added to /etc/group: name=builder, GID=652 <86>Jul 16 09:00:05 groupadd[1430857]: group added to /etc/gshadow: name=builder <86>Jul 16 09:00:05 groupadd[1430857]: new group: name=builder, GID=652 <86>Jul 16 09:00:05 useradd[1430862]: new user: name=builder, UID=652, GID=652, home=/usr/src, shell=/bin/bash <13>Jul 16 09:00:06 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Jul 16 09:00:06 rpmi: libexpat-2.2.9-alt1 sisyphus+252464.200.2.1 1590958865 installed <13>Jul 16 09:00:06 rpmi: libp11-kit-0.23.15-alt2 sisyphus+252784.100.2.2 1591274901 installed <13>Jul 16 09:00:06 rpmi: libtasn1-4.16.0-alt1 sisyphus+245480.100.1.1 1580825062 installed <13>Jul 16 09:00:06 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Jul 16 09:00:06 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Jul 16 09:00:06 rpmi: ca-certificates-2020.06.29-alt1 sisyphus+254237.300.1.1 1593450881 installed <13>Jul 16 09:00:06 rpmi: ca-trust-0.1.2-alt1 sisyphus+233348.100.1.1 1561653823 installed <13>Jul 16 09:00:06 rpmi: p11-kit-trust-0.23.15-alt2 sisyphus+252784.100.2.2 1591274901 installed <13>Jul 16 09:00:07 rpmi: libcrypto1.1-1.1.1g-alt1 sisyphus+249982.60.8.1 1587743711 installed <13>Jul 16 09:00:07 rpmi: libssl1.1-1.1.1g-alt1 sisyphus+249982.60.8.1 1587743711 installed <13>Jul 16 09:00:07 rpmi: python3-3.8.3-alt1 sisyphus+251775.300.4.1 1592726546 installed <13>Jul 16 09:00:07 rpmi: python3-base-3.8.3-alt1 sisyphus+251775.300.4.1 1592726546 installed <13>Jul 16 09:00:07 rpmi: libpython3-3.8.3-alt1 sisyphus+251775.300.4.1 1592726546 installed <13>Jul 16 09:00:07 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>Jul 16 09:00:07 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>Jul 16 09:00:09 rpmi: libverto-0.3.0-alt1_7 sisyphus+225932.100.1.1 1553994919 installed <13>Jul 16 09:00:09 rpmi: liblmdb-0.9.23-alt1 sisyphus+225277.100.2.1 1553001679 installed <13>Jul 16 09:00:09 rpmi: libkeyutils-1.6-alt2 sisyphus+226520.100.2.1 1554512089 installed <13>Jul 16 09:00:09 rpmi: libffi6-1:3.2.1-alt4 sisyphus+251953.300.2.1 1589891360 installed <13>Jul 16 09:00:09 rpmi: libcom_err-1.44.6-alt1 sisyphus+224154.100.1.1 1552091678 installed <86>Jul 16 09:00:09 groupadd[1440199]: group added to /etc/group: name=_keytab, GID=499 <86>Jul 16 09:00:09 groupadd[1440199]: group added to /etc/gshadow: name=_keytab <86>Jul 16 09:00:09 groupadd[1440199]: new group: name=_keytab, GID=499 <13>Jul 16 09:00:09 rpmi: libkrb5-1.18.2-alt2 sisyphus+254565.100.4.1 1594375666 installed <13>Jul 16 09:00:09 rpmi: libtirpc-1.2.6-alt1 sisyphus+250076.100.1.1 1587038270 installed <13>Jul 16 09:00:09 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed <13>Jul 16 09:00:09 rpmi: python-modules-encodings-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-compiler-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-email-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-unittest-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-nis-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-ctypes-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-multiprocessing-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-modules-logging-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 16 09:00:10 rpmi: python-tools-2to3-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed Building target platforms: i586 Building for target i586 Wrote: /usr/src/in/nosrpm/python3-module-pp-1.6.5-alt2.nosrc.rpm <13>Jul 16 09:00:11 rpmi: python3-module-pkg_resources-1:46.1.3-alt1 sisyphus+250566.200.3.1 1587973342 installed <13>Jul 16 09:00:11 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Jul 16 09:00:11 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Jul 16 09:00:11 rpmi: python3-dev-3.8.3-alt1 sisyphus+251775.300.4.1 1592726546 installed <13>Jul 16 09:00:11 rpmi: python3-module-setuptools-1:46.1.3-alt1 sisyphus+250566.200.3.1 1587973342 installed Installing python3-module-pp-1.6.5-alt2.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.94467 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf pp-1.6.5 + echo 'Source #0 (pp-1.6.5.tar.gz):' Source #0 (pp-1.6.5.tar.gz): + /bin/tar -xf - + /bin/gzip -dc /usr/src/RPM/SOURCES/pp-1.6.5.tar.gz + cd pp-1.6.5 + /bin/chmod -c -Rf u+rwX,go-w . + find -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: No changes to ./setup.py RefactoringTool: Refactored ./ppworker.py RefactoringTool: Refactored ./pptransport.py RefactoringTool: Refactored ./ppserver.py --- ./ppworker.py (original) +++ ./ppworker.py (refactored) @@ -31,8 +31,8 @@ """ import sys import os -import StringIO -import cPickle as pickle +import io +import pickle as pickle import pptransport copyright = "Copyright (c) 2005-2012 Vitalii Vanovschi. All rights reserved" @@ -46,10 +46,10 @@ try: if not module.startswith("from ") and not module.startswith("import "): module = "import " + module - exec module + exec(module) globals().update(locals()) except: - print "An error has occured during the module import" + print("An error has occured during the module import") sys.excepthook(*sys.exc_info()) return fname, fobjs @@ -58,7 +58,7 @@ def __init__(self): self.hashmap = {} self.e = sys.__stderr__ - self.sout = StringIO.StringIO() + self.sout = io.StringIO() # self.sout = open("/tmp/pp.debug","a+") sys.stdout = self.sout sys.stderr = self.sout @@ -76,11 +76,11 @@ for __fobj in __fobjs: try: - exec __fobj + exec(__fobj) globals().update(locals()) except: - print "An error has occured during the " + \ - "function import" + print("An error has occured during the " + \ + "function import") sys.excepthook(*sys.exc_info()) __args = pickle.loads(__sargs) @@ -89,7 +89,7 @@ try: __result = __f(*__args) except: - print "An error has occured during the function execution" + print("An error has occured during the function execution") sys.excepthook(*sys.exc_info()) __result = None @@ -99,7 +99,7 @@ self.t.send(__sresult) self.sout.truncate(0) except: - print "A fatal error has occured during the function execution" + print("A fatal error has occured during the function execution") sys.excepthook(*sys.exc_info()) __result = None __sresult = pickle.dumps((__result, self.sout.getvalue()), --- ./pptransport.py (original) +++ ./pptransport.py (refactored) @@ -171,7 +171,7 @@ def send(self, data): size = struct.pack("!Q", len(data)) t_size = struct.calcsize("!Q") - s_size = 0L + s_size = 0 while s_size < t_size: p_size = self.socket.send(size[s_size:]) if p_size == 0: @@ -179,7 +179,7 @@ s_size += p_size t_size = len(data) - s_size = 0L + s_size = 0 while s_size < t_size: p_size = self.socket.send(data[s_size:]) if p_size == 0: --- ./ppserver.py (original) +++ ./ppserver.py (refactored) @@ -74,7 +74,7 @@ proto, socket_timeout) if pid_file: with open(pid_file, 'w') as pfile: - print >>pfile, os.getpid() + print(os.getpid(), file=pfile) atexit.register(os.remove, pid_file) self.host = interface self.bcast = broadcast @@ -124,7 +124,7 @@ self.ssocket.settimeout(LISTEN_SOCKET_TIMEOUT) self.ssocket.bind((self.host, self.port)) self.ssocket.listen(5) - except socket.error, e: + except socket.error as e: self.logger.error("Cannot create socket for %s:%s, %s", self.host, self.port, e) try: @@ -160,7 +160,7 @@ mysocket.send(version) #generate a random string srandom = "".join([random.choice(string.ascii_letters) - for i in xrange(16)]) + for i in range(16)]) mysocket.send(srandom) answer = sha_new(srandom+self.secret).hexdigest() clientanswer = mysocket.receive() @@ -214,13 +214,13 @@ # If we don't have configobj installed then let the user know and exit try: from configobj import ConfigObj - except ImportError, ie: - print >> sys.stderr, ("ERROR: You must have config obj installed to use" - "configuration files. You can still use command line switches.") + except ImportError as ie: + print(("ERROR: You must have config obj installed to use" + "configuration files. You can still use command line switches."), file=sys.stderr) sys.exit(1) if not os.access(file_loc, os.F_OK): - print >> sys.stderr, "ERROR: Can not access %s." % arg + print("ERROR: Can not access %s." % arg, file=sys.stderr) sys.exit(1) # Load the configuration file @@ -293,39 +293,39 @@ def print_usage(): """Prints help""" - print "Parallel Python Network Server (pp-" + version + ")" - print "Usage: ppserver.py [-hdar] [-f format] [-n proto]"\ + print("Parallel Python Network Server (pp-" + version + ")") + print("Usage: ppserver.py [-hdar] [-f format] [-n proto]"\ " [-c config_path] [-i interface] [-b broadcast]"\ " [-p port] [-w nworkers] [-s secret] [-t seconds]"\ - " [-k seconds] [-P pid_file]" - print - print "Options: " - print "-h : this help message" - print "-d : set log level to debug" - print "-f format : log format" - print "-a : enable auto-discovery service" - print "-r : restart worker process after each"\ - " task completion" - print "-n proto : protocol number for pickle module" - print "-c path : path to config file" - print "-i interface : interface to listen" - print "-b broadcast : broadcast address for auto-discovery service" - print "-p port : port to listen" - print "-w nworkers : number of workers to start" - print "-s secret : secret for authentication" - print "-t seconds : timeout to exit if no connections with "\ - "clients exist" - print "-k seconds : socket timeout in seconds" - print "-P pid_file : file to write PID to" - print - print "To print server stats send SIGUSR1 to its main process (unix only). " - print - print "Due to the security concerns always use a non-trivial secret key." - print "Secret key set by -s switch will override secret key assigned by" - print "pp_secret variable in .pythonrc.py" - print - print "Please visit http://www.parallelpython.com for extended up-to-date" - print "documentation, examples and support forums" + " [-k seconds] [-P pid_file]") + print() + print("Options: ") + print("-h : this help message") + print("-d : set log level to debug") + print("-f format : log format") + print("-a : enable auto-discovery service") + print("-r : restart worker process after each"\ + " task completion") + print("-n proto : protocol number for pickle module") + print("-c path : path to config file") + print("-i interface : interface to listen") + print("-b broadcast : broadcast address for auto-discovery service") + print("-p port : port to listen") + print("-w nworkers : number of workers to start") + print("-s secret : secret for authentication") + print("-t seconds : timeout to exit if no connections with "\ + "clients exist") + print("-k seconds : socket timeout in seconds") + print("-P pid_file : file to write PID to") + print() + print("To print server stats send SIGUSR1 to its main process (unix only). ") + print() + print("Due to the security concerns always use a non-trivial secret key.") + print("Secret key set by -s switch will override secret key assigned by")RefactoringTool: No changes to ./ppcommon.py RefactoringTool: No changes to ./ppauto.py RefactoringTool: Refactored ./pp.py + print("pp_secret variable in .pythonrc.py") + print() + print("Please visit http://www.parallelpython.com for extended up-to-date") + print("documentation, examples and support forums") def create_network_server(argv): --- ./pp.py (original) +++ ./pp.py (refactored) @@ -39,7 +39,7 @@ import time import atexit import user -import cPickle as pickle +import pickle as pickle import pptransport import ppauto import ppcommon @@ -118,7 +118,7 @@ self.result, sout = pickle.loads(self.sresult) self.unpickled = True if len(sout) > 0: - print sout, + print(sout, end=' ') if self.callback: args = self.callbackargs + (self.result, ) self.callback(*args) @@ -362,12 +362,12 @@ (broadcast, port))) self.__stats_lock = threading.Lock() if secret is not None: - if not isinstance(secret, types.StringType): + if not isinstance(secret, bytes): raise TypeError("secret must be of a string type") self.secret = str(secret) elif hasattr(user, "pp_secret"): secret = getattr(user, "pp_secret") - if not isinstance(secret, types.StringType): + if not isinstance(secret, bytes): raise TypeError("secret must be of a string type") self.secret = str(secret) else: @@ -416,7 +416,7 @@ raise TypeError("globals argument must be a dictionary") for module in modules: - if not isinstance(module, types.StringType): + if not isinstance(module, bytes): raise TypeError("modules argument must be a list of strings") tid = self.__gentid() @@ -426,9 +426,9 @@ modules = tuple(set(modules)) self.logger.debug("Task %i will autoimport next modules: %s" % (tid, str(modules))) - for object1 in globals.values(): + for object1 in list(globals.values()): if isinstance(object1, types.FunctionType) \ - or isinstance(object1, types.ClassType): + or isinstance(object1, type): depfuncs += (object1, ) task = _Task(self, tid, callback, callbackargs, group) @@ -438,8 +438,8 @@ self.__waittasks_lock.release() # if the function is a method of a class add self to the arguments list - if isinstance(func, types.MethodType) and func.im_self is not None: - args = (func.im_self, ) + args + if isinstance(func, types.MethodType) and func.__self__ is not None: + args = (func.__self__, ) + args # if there is an instance of a user deined class in the arguments add # whole class to dependancies @@ -465,7 +465,7 @@ self.__queue_lock.release() self.logger.debug("Task %i submited, function='%s'" % - (tid, func.func_name)) + (tid, func.__name__)) self.__scheduler() return task @@ -510,7 +510,7 @@ """Returns active nodes as a dictionary [keys - nodes, values - ncpus]""" active_nodes = {} - for node, stat in self.__stats.items(): + for node, stat in list(self.__stats.items()): if node == "local" or node in self.autopp_list \ and self.autopp_list[node]: active_nodes[node] = stat.ncpus @@ -518,7 +518,7 @@ def get_stats(self): """Returns job execution statistics as a dictionary""" - for node, stat in self.__stats.items(): + for node, stat in list(self.__stats.items()): if stat.rworker: try: stat.rworker.send("TIME") @@ -532,26 +532,26 @@ """Prints job execution statistics. Useful for benchmarking on clusters""" - print "Job execution statistics:" + print("Job execution statistics:") walltime = time.time() - self.__creation_time - RefactoringTool: Refactored ./examples/sum_primes_functor.py RefactoringTool: Refactored ./examples/sum_primes.py statistics = self.get_stats().items() + statistics = list(self.get_stats().items()) totaljobs = 0.0 for ppserver, stat in statistics: totaljobs += stat.njobs - print " job count | % of all jobs | job time sum | " \ - "time per job | job server" + print(" job count | % of all jobs | job time sum | " \ + "time per job | job server") for ppserver, stat in statistics: if stat.njobs: - print " %6i | %6.2f | %8.4f | %11.6f | %s" \ + print(" %6i | %6.2f | %8.4f | %11.6f | %s" \ % (stat.njobs, 100.0*stat.njobs/totaljobs, stat.time, - stat.time/stat.njobs, ppserver, ) - print "Time elapsed since server creation", walltime - print self.__active_tasks, "active tasks,", self.get_ncpus(), "cores" + stat.time/stat.njobs, ppserver, )) + print("Time elapsed since server creation", walltime) + print(self.__active_tasks, "active tasks,", self.get_ncpus(), "cores") if not self.__accurate_stats: - print "WARNING: statistics provided above is not accurate" \ - " due to job rescheduling" - print + print("WARNING: statistics provided above is not accurate" \ + " due to job rescheduling") + print() # all methods below are for internal use only @@ -637,14 +637,14 @@ if hashs not in self.__sfuncHM: sources = [self.__get_source(func) for func in funcs] self.__sfuncHM[hashs] = pickle.dumps( - (funcs[0].func_name, sources, modules), + (funcs[0].__name__, sources, modules), self.__pickle_proto) return self.__sfuncHM[hashs] def __find_modules(self, prefix, dict): """recursively finds all the modules in dict""" modules = [] - for name, object in dict.items(): + for name, object in list(dict.items()): if isinstance(object, types.ModuleType) \ and name not in ("__builtins__", "pp"): if object.__name__ == prefix+name or prefix == "": --- ./examples/sum_primes_functor.py (original) +++ ./examples/sum_primes_functor.py (refactored) @@ -28,13 +28,13 @@ def sum_primes(n): """Calculates sum of all primes below given integer n""" - return sum([x for x in xrange(2,n) if isprime(x)]) + return sum([x for x in range(2,n) if isprime(x)]) -print """Usage: python sum_primes.py [ncpus] +print("""Usage: python sum_primes.py [ncpus] [ncpus] - the number of workers to run in parallel, if omitted it will be set to the number of processors in the system -""" +""") # tuple of all parallel python servers to connect with #ppservers = ("*",) # auto-discover @@ -49,7 +49,7 @@ # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) -print "Starting pp with", job_server.get_ncpus(), "workers" +print("Starting pp with", job_server.get_ncpus(), "workers") # Creates a template # Template is created using all the parameters of the jobs except @@ -71,14 +71,14 @@ # execution will wait here until result is available result = job1() -print "Sum of primes below 100 is", result +print("Sum of primes below 100 is", result) # The following submits 8 jobs and then retrieves the results inputs = (100000, 100100, 100200, 100300, 100400, 100500, 100600, 100700) jobs = [(input, fn.submit(input)) for input in inputs] for input, job in jobs: - print "Sum of primes below", input, "is", job() + print("Sum of primes below", input, "is", job()) job_server.print_stats() --- ./examples/sum_primes.py (original) +++ ./examples/sum_primes.py (refactored) @@ -29,12 +29,12 @@ def sum_primes(n): """Calculates sum of all primes below given integer n""" - return sum([x for x in xrange(2, n) if isprime(x)]) + return sum([x for x in range(RefactoringTool: Refactored ./examples/reverse_md5.py RefactoringTool: Refactored ./examples/quicksort.py RefactoringTool: Refactored ./examples/dynamic_ncpus.py 2, n) if isprime(x)]) -print """Usage: python sum_primes.py [ncpus] +print("""Usage: python sum_primes.py [ncpus] [ncpus] - the number of workers to run in parallel, - if omitted it will be set to the number of processors in the system""" + if omitted it will be set to the number of processors in the system""") # tuple of all parallel python servers to connect with ppservers = () @@ -48,7 +48,7 @@ # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) -print "Starting pp with", job_server.get_ncpus(), "workers" +print("Starting pp with", job_server.get_ncpus(), "workers") # Submit a job of calulating sum_primes(100) for execution. # sum_primes - the function @@ -65,7 +65,7 @@ # wait here until result is available result = job1() -print "Sum of primes below 100 is", result +print("Sum of primes below 100 is", result) # The following submits 8 jobs and then retrieves the results @@ -74,7 +74,7 @@ ("math", ))) for input in inputs] for input, job in jobs: - print "Sum of primes below", input, "is", job() + print("Sum of primes below", input, "is", job()) job_server.print_stats() --- ./examples/reverse_md5.py (original) +++ ./examples/reverse_md5.py (refactored) @@ -14,15 +14,15 @@ def md5test(hash, start, end): """Calculates md5 of the integerss between 'start' and 'end' and compares it with 'hash'""" - for x in xrange(start, end): + for x in range(start, end): if md5.new(str(x)).hexdigest() == hash: return x -print """Usage: python reverse_md5.py [ncpus] +print("""Usage: python reverse_md5.py [ncpus] [ncpus] - the number of workers to run in parallel, if omitted it will be set to the number of processors in the system -""" +""") # tuple of all parallel python servers to connect with #ppservers = ("*",) # auto-discover @@ -37,11 +37,11 @@ # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) -print "Starting pp with", job_server.get_ncpus(), "workers" +print("Starting pp with", job_server.get_ncpus(), "workers") #Calculates md5 hash from the given number hash = md5.new("1829182").hexdigest() -print "hash =", hash +print("hash =", hash) #Now we will try to find the number with this hash value start = 1 @@ -54,7 +54,7 @@ step = (end - start) / parts + 1 jobs = [] -for index in xrange(parts): +for index in range(parts): starti = start+index*step endi = min(start+(index+1)*step, end) # Submit a job which will test if a number in the range starti-endi @@ -77,9 +77,9 @@ # Print the results if result: - print "Reverse md5 for", hash, "is", result + print("Reverse md5 for", hash, "is", result) else: - print "Reverse md5 for", hash, "has not been found" + print("Reverse md5 for", hash, "has not been found") job_server.print_stats() --- ./examples/quicksort.py (original) +++ ./examples/quicksort.py (refactored) @@ -19,10 +19,10 @@ return [srv.submit(quicksort, (a,))] -print """Usage: python quicksort.py [ncpus] +print("""Usage: python quicksort.py [ncpus] [ncpus] - the number of workers to run in parallel, if omitted it will be set to the number of processors in the system -""" +""") # tuple of all parallel python servers to connect with #ppservers = ("*",) @@ -37,11 +37,11 @@ # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) -print "Starting pp with", job_server.get_ncpus(), "workers" +print("Starting pp with", job_server.get_ncpus(), "workers") n = 1000000 input = [] -for i in xrange(n): +for i in range(n): input.append(random.randint(0,100000)) # set n to a positive integer to create 2^n PP jobs @@ -62,7 +62,7 @@ else: output.append(x) -print "first 30 numbers in increasing order:", output[:30] +print("first 30 numbers in increasing order:", output[:30]) job_server.print_stats() --- ./examples/dynamic_nRefactoringTool: Refactored ./examples/callback.py RefactoringTool: Refactored ./examples/auto_diff.py cpus.py (original) +++ ./examples/dynamic_ncpus.py (refactored) @@ -16,15 +16,15 @@ def part_sum(start, end): """Calculates partial sum""" sum = 0 - for x in xrange(start, end): + for x in range(start, end): if x % 2 == 0: sum -= 1.0 / x else: sum += 1.0 / x return sum -print """Usage: python dynamic_ncpus.py""" -print +print("""Usage: python dynamic_ncpus.py""") +print() start = 1 end = 20000000 @@ -42,8 +42,8 @@ job_server.set_ncpus(ncpus) jobs = [] start_time = time.time() - print "Starting ", job_server.get_ncpus(), " workers" - for index in xrange(parts): + print("Starting ", job_server.get_ncpus(), " workers") + for index in range(parts): starti = start+index*step endi = min(start+(index+1)*step, end) # Submit a job which will calculate partial sum @@ -57,10 +57,10 @@ # Retrieve all the results and calculate their sum part_sum1 = sum([job() for job in jobs]) # Print the partial sum - print "Partial sum is", part_sum1, "| diff =", math.log(2) - part_sum1 + print("Partial sum is", part_sum1, "| diff =", math.log(2) - part_sum1) - print "Time elapsed: ", time.time() - start_time, "s" - print + print("Time elapsed: ", time.time() - start_time, "s") + print() job_server.print_stats() # Parallel Python Software: http://www.parallelpython.com --- ./examples/callback.py (original) +++ ./examples/callback.py (refactored) @@ -9,7 +9,7 @@ import math import time -import thread +import _thread import sys import pp @@ -20,7 +20,7 @@ def __init__(self): self.value = 0.0 - self.lock = thread.allocate_lock() + self.lock = _thread.allocate_lock() def add(self, value): """ @@ -35,7 +35,7 @@ def part_sum(start, end): """Calculates partial sum""" sum = 0 - for x in xrange(start, end): + for x in range(start, end): if x % 2 == 0: sum -= 1.0 / x else: @@ -43,10 +43,10 @@ return sum -print """Usage: python callback.py [ncpus] +print("""Usage: python callback.py [ncpus] [ncpus] - the number of workers to run in parallel, if omitted it will be set to the number of processors in the system -""" +""") start = 1 end = 20000000 @@ -68,7 +68,7 @@ # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) -print "Starting pp with", job_server.get_ncpus(), "workers" +print("Starting pp with", job_server.get_ncpus(), "workers") # Create anm instance of callback class sum = Sum() @@ -77,7 +77,7 @@ # of active workers and measure the time start_time = time.time() -for index in xrange(parts): +for index in range(parts): starti = start+index*step endi = min(start+(index+1)*step, end) # Submit a job which will calculate partial sum @@ -90,7 +90,7 @@ job_server.wait() # Print the partial sum -print "Partial sum is", sum.value, "| diff =", math.log(2) - sum.value +print("Partial sum is", sum.value, "| diff =", math.log(2) - sum.value) job_server.print_stats() --- ./examples/auto_diff.py (original) +++ ./examples/auto_diff.py (refactored) @@ -85,13 +85,13 @@ """ partial sum for truncated natural logarithm """ - return sum([float(i%2 and 1 or -1)*x**i/i for i in xrange(1, self.n)]) + return sum([float(i%2 and 1 or -1)*x**i/i for i in range(1, self.n)]) -print """Usage: python auto_diff.py [ncpus] +print("""Usage: python auto_diff.py [ncpus] [ncpus] - the number of workers to run in parallel, if omitted it will be set to the number of processors in the system -""" +""") # tuple of all parallel python servers to connect with #ppservers = ("*",) # auto-discover @@ -106,7 +106,7 @@ # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) -print "Starting pp with", job_server.get_ncpus(), "workers" +print("Starting pp with", job_server.get_ncpus(), "workers") RefactoringTool: Files that were modified: RefactoringTool: ./setup.py RefactoringTool: ./ppworker.py RefactoringTool: ./pptransport.py RefactoringTool: ./ppserver.py RefactoringTool: ./ppcommon.py RefactoringTool: ./ppauto.py RefactoringTool: ./pp.py RefactoringTool: ./examples/sum_primes_functor.py RefactoringTool: ./examples/sum_primes.py RefactoringTool: ./examples/reverse_md5.py RefactoringTool: ./examples/quicksort.py RefactoringTool: ./examples/dynamic_ncpus.py RefactoringTool: ./examples/callback.py RefactoringTool: ./examples/auto_diff.py proc = PartialSum(20000) @@ -121,7 +121,7 @@ for x, f in results: # Retrieves the result of the calculation val = f() - print "t_log(%lf) = %lf, t_log'(%lf) = %lf" % (x, val.x, x, val.dx) + print("t_log(%lf) = %lf, t_log'(%lf) = %lf" % (x, val.x, x, val.dx)) # Print execution statistics job_server.print_stats() + sed -i 's|import user|import types|' pp.py + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.98545 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd pp-1.6.5 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py build --debug running build running build_py creating build creating build/lib copying pp.py -> build/lib copying ppauto.py -> build/lib copying ppcommon.py -> build/lib copying pptransport.py -> build/lib copying ppworker.py -> build/lib running build_scripts creating build/scripts-3.8 copying and adjusting ppserver.py -> build/scripts-3.8 changing mode of build/scripts-3.8/ppserver.py from 644 to 755 + exit 0 Executing(%install): /bin/sh -e /usr/src/tmp/rpm-tmp.98545 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + /bin/chmod -Rf u+rwX -- /usr/src/tmp/python3-module-pp-buildroot + : + /bin/rm -rf -- /usr/src/tmp/python3-module-pp-buildroot + cd pp-1.6.5 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py install --skip-build --root=/usr/src/tmp/python3-module-pp-buildroot --force running install running install_lib creating /usr/src/tmp/python3-module-pp-buildroot creating /usr/src/tmp/python3-module-pp-buildroot/usr creating /usr/src/tmp/python3-module-pp-buildroot/usr/lib creating /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3 creating /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages copying build/lib/ppworker.py -> /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages copying build/lib/pptransport.py -> /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages copying build/lib/ppcommon.py -> /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages copying build/lib/ppauto.py -> /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages copying build/lib/pp.py -> /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages byte-compiling /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppworker.py to ppworker.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py to pptransport.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppcommon.py to ppcommon.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppauto.py to ppauto.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py to pp.cpython-38.pyc running install_scripts creating /usr/src/tmp/python3-module-pp-buildroot/usr/bin copying build/scripts-3.8/ppserver.py -> /usr/src/tmp/python3-module-pp-buildroot/usr/bin changing mode of /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py to 755 running install_egg_info Writing /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp-1.6.5-py3.8.egg-info + /usr/lib/rpm/brp-alt Cleaning files in /usr/src/tmp/python3-module-pp-buildroot (auto) Verifying and fixing files in /usr/src/tmp/python3-module-pp-buildroot (binconfig,pkgconfig,libtool,desktop) Checking contents of files in /usr/src/tmp/python3-module-pp-buildroot/ (default) Compressing files in /usr/src/tmp/python3-module-pp-buildroot (auto) Adjusting library links in /usr/src/tmp/python3-module-pp-buildroot ./usr/lib: Verifying ELF objects in /usr/src/tmp/python3-module-pp-buildroot (arch=normal,fhs=normal,lfs=relaxed,lint=relaxed,rpath=normal,stack=normal,textrel=normal,unresolved=normal) Bytecompiling python modules in /usr/src/tmp/python3-module-pp-buildroot using /usr/bin/python2.7 Bytecompiling python modules with optimization in /usr/src/tmp/python3-module-pp-buildroot using /usr/bin/python2.7 -O Bytecompiling python3 modules in /usr/src/tmp/python3-module-pp-buildroot using /usr/bin/python3 unlink /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/__pycache__/pp.cpython-38.pyc unlink /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-38.pyc unlink /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-38.pyc unlink /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-38.pyc unlink /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-38.pyc compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppauto.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppcommon.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppworker.py Bytecompiling python3 modules with optimization in /usr/src/tmp/python3-module-pp-buildroot using /usr/bin/python3 -O compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppauto.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppcommon.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppworker.py Bytecompiling python3 modules with optimization-2 in /usr/src/tmp/python3-module-pp-buildroot using /usr/bin/python3 -OO compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppauto.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppcommon.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py compile /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppworker.py Hardlinking identical .pyc and .opt-?.pyc files './usr/lib/python3/site-packages/__pycache__/ppworker.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/__pycache__/ppworker.cpython-38.pyc' './usr/lib/python3/site-packages/__pycache__/pptransport.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/__pycache__/pptransport.cpython-38.pyc' './usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-38.pyc' './usr/lib/python3/site-packages/__pycache__/ppauto.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/__pycache__/ppauto.cpython-38.pyc' './usr/lib/python3/site-packages/__pycache__/pp.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/__pycache__/pp.cpython-38.pyc' Hardlinking identical .pyc and .pyo files Processing files: python3-module-pp-1.6.5-alt2 Executing(%doc): /bin/sh -e /usr/src/tmp/rpm-tmp.66303 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd pp-1.6.5 + DOCDIR=/usr/src/tmp/python3-module-pp-buildroot/usr/share/doc/python3-module-pp-1.6.5 + export DOCDIR + rm -rf /usr/src/tmp/python3-module-pp-buildroot/usr/share/doc/python3-module-pp-1.6.5 + /bin/mkdir -p /usr/src/tmp/python3-module-pp-buildroot/usr/share/doc/python3-module-pp-1.6.5 + cp -prL AUTHORS CHANGELOG README doc/example.config doc/ppdoc.html /usr/src/tmp/python3-module-pp-buildroot/usr/share/doc/python3-module-pp-1.6.5 + chmod -R go-w /usr/src/tmp/python3-module-pp-buildroot/usr/share/doc/python3-module-pp-1.6.5 + chmod -R a+rX /usr/src/tmp/python3-module-pp-buildroot/usr/share/doc/python3-module-pp-1.6.5 + exit 0 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.UdfK0Z find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.HICAX0 find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks,systemd-services) python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: skipping atexit python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: skipping errno python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: skipping sys python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: line=59 IGNORE (for REQ=slight and deep=8) module=hashlib /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: line=62 IGNORE (for REQ=slight and deep=8) module=sha /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/bin/ppserver.py: line=216 IGNORE (for REQ=slight and deep=12) module=configobj python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py: skipping sys python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py: skipping time python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py: skipping atexit /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py: line=60 IGNORE (for REQ=slight and deep=8) module=sets /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py: line=64 IGNORE (for REQ=slight and deep=8) module=subprocess /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pp.py: line=67 IGNORE (for REQ=slight and deep=8) module=popen2 python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppauto.py: skipping sys python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppauto.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py: line=45 IGNORE (for REQ=slight and deep=8) module=hashlib /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py: line=49 IGNORE (for REQ=slight and deep=8) module=sha /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/pptransport.py: line=50 IGNORE (for REQ=slight and deep=8) module=md5 python3.req: /usr/src/tmp/python3-module-pp-buildroot/usr/lib/python3/site-packages/ppworker.py: skipping sys Provides: python3(pp), python3(ppauto), python3(ppcommon), python3(pptransport), python3(ppworker) Requires: /usr/bin/python3, /usr/lib/python3/site-packages, python3(getopt) < 0, python3(inspect) < 0, python3(io) < 0, python3(logging) < 0, python3(os) < 0, python3(pickle) < 0, python3(random) < 0, python3(signal) < 0, python3(socket) < 0, python3(string) < 0, python3(struct) < 0, python3(threading) < 0, python3(types) < 0 Wrote: /usr/src/RPM/RPMS/noarch/python3-module-pp-1.6.5-alt2.noarch.rpm 5.66user 0.46system 0:07.58elapsed 80%CPU (0avgtext+0avgdata 18764maxresident)k 0inputs+0outputs (0major+132191minor)pagefaults 0swaps 12.24user 3.64system 0:17.18elapsed 92%CPU (0avgtext+0avgdata 112360maxresident)k 0inputs+0outputs (0major+574691minor)pagefaults 0swaps --- python3-module-pp-1.6.5-alt2.noarch.rpm.repo 2019-11-08 09:43:06.000000000 +0000 +++ python3-module-pp-1.6.5-alt2.noarch.rpm.hasher 2020-07-16 09:00:20.636148574 +0000 @@ -2,18 +2,18 @@ /usr/lib/python3/site-packages/__pycache__ 40755 -/usr/lib/python3/site-packages/__pycache__/pp.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/pp.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/pp.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/pp-1.6.5-py3.7.egg-info 100644 +/usr/lib/python3/site-packages/__pycache__/pp.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/pp.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/pp.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppauto.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppcommon.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/pptransport.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/__pycache__/ppworker.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/pp-1.6.5-py3.8.egg-info 100644 /usr/lib/python3/site-packages/pp.py 100644