|
[Rivet-svn] rivet: 4 new changesetsRivet Mercurial rivet at projects.hepforge.orgTue Mar 1 21:45:02 GMT 2016
details: https://rivet.hepforge.org/hg/rivet/rev/c0645ec85e05 branches: release-2-4-x changeset: 5002:c0645ec85e05 user: Andy Buckley <andy at insectnation.org> date: Tue Mar 01 21:36:17 2016 +0000 description: Typo fix details: https://rivet.hepforge.org/hg/rivet/rev/9556ede14c5a branches: release-2-4-x changeset: 5003:9556ede14c5a user: Andy Buckley <andy at insectnation.org> date: Tue Mar 01 21:37:18 2016 +0000 description: Rework signal handling in newly multiprocessing-based make-plots details: https://rivet.hepforge.org/hg/rivet/rev/996afb400f6b branches: release-2-4-x changeset: 5004:996afb400f6b user: Andy Buckley <andy at insectnation.org> date: Tue Mar 01 21:38:05 2016 +0000 description: Hiding details: https://rivet.hepforge.org/hg/rivet/rev/c413946922bb branches: release-2-4-x changeset: 5005:c413946922bb user: Andy Buckley <andy at insectnation.org> date: Tue Mar 01 21:38:38 2016 +0000 description: Not necessarily an improvement, but convenient for debugging diffs (truncated from 78 to 50 lines): --- a/.hgignore Tue Mar 01 16:01:43 2016 +0000 +++ b/.hgignore Tue Mar 01 21:38:38 2016 +0000 @@ -67,4 +67,4 @@ ^a\.out\.dSYM$ ^Rivet-.\..\..$ ^local/.*$ -^analyses\d\d\d$ +^(for|analyses)\d\d\d$ --- a/bin/make-plots Tue Mar 01 16:01:43 2016 +0000 +++ b/bin/make-plots Tue Mar 01 21:38:38 2016 +0000 @@ -2589,16 +2589,25 @@ RECVD_KILL_SIGNAL = signum signal.signal(signum, signal.SIG_DFL) ## Signals to handle - signal.signal(signal.SIGINT, handleKillSignal) - signal.signal(signal.SIGTERM, handleKillSignal) - signal.signal(signal.SIGHUP, handleKillSignal) - signal.signal(signal.SIGUSR2, handleKillSignal) + # signal.signal(signal.SIGINT, handleKillSignal) + # signal.signal(signal.SIGTERM, handleKillSignal) + # signal.signal(signal.SIGHUP, handleKillSignal) + # signal.signal(signal.SIGUSR2, handleKillSignal) + + def init_worker(): + signal.signal(signal.SIGINT, signal.SIG_IGN) ## Run threads datfiles = args plotword = "plots" if len(datfiles) > 1 else "plot" logging.info("Making %d %s" % (len(datfiles), plotword)) import multiprocessing - p = multiprocessing.Pool(opts.NUM_THREADS) - for i, _ in enumerate(p.imap(process_datfile, datfiles)): - logging.info("Plotting %s (%d/%d remaining)" % (datfiles[i], len(datfiles)-i, len(datfiles))) + pool = multiprocessing.Pool(opts.NUM_THREADS, init_worker) + try: + for i, _ in enumerate(pool.imap(process_datfile, datfiles)): + logging.info("Plotting %s (%d/%d remaining)" % (datfiles[i], len(datfiles)-i, len(datfiles))) + pool.close() + except KeyboardInterrupt: + print "Caught KeyboardInterrupt, terminating workers" + pool.terminate() + pool.join() --- a/bin/rivet-cmphistos Tue Mar 01 16:01:43 2016 +0000 +++ b/bin/rivet-cmphistos Tue Mar 01 21:38:38 2016 +0000 @@ -110,7 +110,8 @@ ## Make a path object and ensure the path is in standard form try: aop = rivet.AOPath(path) - except:
More information about the Rivet-svn mailing list |