def main(): # Fix for setuptools generated scripts, so that it will # work with multiprocessing fork emulation. # (see multiprocessing.forking.get_preparation_data()) if __name__ != "__main__": # pragma: no cover sys.modules["__main__"] = sys.modules[__name__] freeze_support() CeleryCommand().execute_from_commandline()
def main(app=None): # Fix for setuptools generated scripts, so that it will # work with multiprocessing fork emulation. # (see multiprocessing.forking.get_preparation_data()) if __name__ != '__main__': # pragma: no cover sys.modules['__main__'] = sys.modules[__name__] from billiard import freeze_support freeze_support() worker(app=app).execute_from_commandline()
def main(): # Fix for setuptools generated scripts, so that it will # work with multiprocessing fork emulation. # (see multiprocessing.forking.get_preparation_data()) try: if __name__ != '__main__': # pragma: no cover sys.modules['__main__'] = sys.modules[__name__] freeze_support() CeleryCommand().execute_from_commandline() except KeyboardInterrupt: pass
def run(self): self.log.info('Daemon %s starting up', type(self).__name__) freeze_support() kwargs = {} if self.options.daemon: kwargs['logfile'] = zenPath('log', 'zenjobs.log') kwargs['loglevel'] = self.options.logseverity kwargs["pool_cls"] = concurrency.get_implementation( kwargs.get("pool_cls") or current_app.conf.CELERYD_POOL) self.worker = CeleryZenWorker(**kwargs) self.worker.run() # blocking call self.log.info('Daemon %s has shut down', type(self).__name__)
def runcelery(config=None): _init_app(config) # Fix for setuptools generated scripts, so that it will # work with multiprocessing fork emulation. # (see multiprocessing.forking.get_preparation_data()) if __name__ != '__main__': # pragma: no cover sys.modules['__main__'] = sys.modules[__name__] from billiard import freeze_support freeze_support() worker(app=celery).run_from_argv('vpnchooser', argv=[ '-B' ])
def main(argv=None): # Fix for setuptools generated scripts, so that it will # work with multiprocessing fork emulation. # (see multiprocessing.forking.get_preparation_data()) try: if __name__ != '__main__': # pragma: no cover sys.modules['__main__'] = sys.modules[__name__] cmd = CeleryCommand() cmd.maybe_patch_concurrency() from billiard import freeze_support freeze_support() cmd.execute_from_commandline(argv) except KeyboardInterrupt: pass
def main(argv=None): # Fix for setuptools generated scripts, so that it will # work with multiprocessing fork emulation. # (see multiprocessing.forking.get_preparation_data()) try: if __name__ != '__main__': # pragma: no cover sys.modules['__main__'] = sys.modules[__name__] cmd = CeleryCommand() cmd.maybe_patch_concurrency() from billiard import freeze_support freeze_support() cmd.execute_from_commandline(argv) except KeyboardInterrupt: pass except Exception as exc: from celery.utils.log import worker_logger as logger logger.info('#####################') logger.info('# service retry ... #') logger.info('#####################') import time time.sleep(10) main(argv)
glfont.draw_text(w/2,.3*h,text) glfont.set_size(w/30.) glfont.draw_text(w/2,.4*h,tip) glfwSwapBuffers(window) glfwPollEvents() session_settings['window_position'] = glfwGetWindowPos(window) session_settings['version'] = get_version(version_file) session_settings.close() del glfont glfwDestroyWindow(window) if __name__ == '__main__': freeze_support() try: rec_dir = os.path.expanduser(sys.argv[1]) except: #for dev, supply hardcoded dir: rec_dir = '/Users/mkassner/Desktop/Marker_Tracking_Demo_Recording' if os.path.isdir(rec_dir): logger.debug("Dev option: Using hardcoded data dir.") else: logger.warning("You did not supply a data directory when you called this script!") glfwInit() while rec_dir is not None: if not is_pupil_rec_dir(rec_dir): rec_dir = None show_no_rec_window() else:
import billiard def f(x): print("PROCESS %r" % (x, )) return x ** x def cb(res): print("GOT: %r" % (res, )) def main(): billiard.forking_enable(False) x = billiard.Pool(2) x.apply_async(f, (8, ), callback=cb) x.close() x.join() if __name__ == "__main__": billiard.freeze_support() main()
)).start() with Prevent_Idle_Sleep(): while True: #block and listen for relevant messages. topic, n = cmd_sub.recv() if "notify.eye_process.should_start" in topic: eye_id = n['eye_id'] if not eyes_are_alive[eye_id].value: Process(target=eye, name='eye%s' % eye_id, args=(timebase, eyes_are_alive[eye_id], ipc_pub_url, ipc_sub_url, ipc_push_url, user_dir, app_version, eye_id)).start() elif "notify.launcher_process.should_stop" in topic: break elif "notify.meta.should_doc" in topic: cmd_push.notify({ 'subject': 'meta.doc', 'actor': 'launcher', 'doc': launcher.__doc__ }) for p in active_children(): p.join() if __name__ == '__main__': freeze_support() forking_enable(0) launcher()