Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
ipcluster doesn't handle stale pid info well #428
I kept getting this message:
(austin-demo)dreamweaver[docs]> ipcluster start -n 2 [IPClusterApp] Using existing cluster dir: /home/fperez/.ipython/cluster_default [IPClusterApp] Cluster directory set to: /home/fperez/.ipython/cluster_default [IPClusterApp] Cluster is already running with [pid=30280]. use "ipcluster stop" to stop the cluster.
when in reality, that info was from a stale pid set of files. When I tried
[...] /home/fperez/usr/lib/python2.6/site-packages/IPython/parallel/apps/ipclusterapp.pyc in start_app_stop(self=) 562 try: 563 pid = self.get_pid_from_file() 564 except PIDFileError: 565 self.log.critical( 566 'Problem reading pid file, cluster is probably not running.' 567 ) 568 # Here I exit with a unusual exit status that other processes 569 # can watch for to learn how I existed. 570 self.exit(ALREADY_STOPPED) 571 else: 572 if os.name=='posix': 573 sig = config.Global.signal 574 self.log.info( 575 "Stopping cluster [pid=%r] with [signal=%r]" % (pid, sig) 576 ) --> 577 os.kill(pid, sig) 578 elif os.name=='nt': 579 # As of right now, we don't support daemonize on Windows, so 580 # stop will not do anything. Minimally, it should clean up the 581 # old .pid files. 582 self.remove_pid_file() 583 584 585 def launch_new_instance(): 586 """Create and run the IPython cluster.""" 587 app = IPClusterApp() 588 app.start() 589 590 591 if __name__ == '__main__': 592 launch_new_instance() OSError: [Errno 3] No such process
We probably should catch that exception and simply clean up the stale PID data and move on, since effectively it means the 'stop' worked (in the sense that the named process isn't around anymore).
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
On Wed, May 11, 2011 at 7:28 AM, minrk
I'm a bit torn. On the one hand, I'd rather not add overhead for the
It's just that I'm always trying to keep the critical path as lean and
added a commit
May 11, 2011