##// END OF EJS Templates
The ipcluster command is now able to reuse FURL files....
Brian Granger -
Show More
@@ -478,15 +478,31 b' Try running ipcluster with the -xy flags: ipcluster local -xy -n 4""")'
478 cont_args.append('-y')
478 cont_args.append('-y')
479 return True
479 return True
480
480
481 def check_reuse(args, cont_args):
482 if args.r:
483 cont_args.append('-r')
484 if args.client_port == 0 or args.engine_port == 0:
485 log.err("""
486 To reuse FURL files, you must also set the client and engine ports using
487 the --client-port and --engine-port options.""")
488 reactor.stop()
489 return False
490 cont_args.append('--client-port=%i' % args.client_port)
491 cont_args.append('--engine-port=%i' % args.engine_port)
492 return True
481
493
482 def main_local(args):
494 def main_local(args):
483 cont_args = []
495 cont_args = []
484 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
496 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
485
497
486 # Check security settings before proceeding
498 # Check security settings before proceeding
487 if not check_security(args, cont_args):
499 if not check_security(args, cont_args):
488 return
500 return
489
501
502 # See if we are reusing FURL files
503 if not check_reuse(args, cont_args):
504 return
505
490 cl = ControllerLauncher(extra_args=cont_args)
506 cl = ControllerLauncher(extra_args=cont_args)
491 dstart = cl.start()
507 dstart = cl.start()
492 def start_engines(cont_pid):
508 def start_engines(cont_pid):
@@ -514,14 +530,17 b' def main_local(args):'
514
530
515
531
516 def main_mpi(args):
532 def main_mpi(args):
517 print vars(args)
518 cont_args = []
533 cont_args = []
519 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
534 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
520
535
521 # Check security settings before proceeding
536 # Check security settings before proceeding
522 if not check_security(args, cont_args):
537 if not check_security(args, cont_args):
523 return
538 return
524
539
540 # See if we are reusing FURL files
541 if not check_reuse(args, cont_args):
542 return
543
525 cl = ControllerLauncher(extra_args=cont_args)
544 cl = ControllerLauncher(extra_args=cont_args)
526 dstart = cl.start()
545 dstart = cl.start()
527 def start_engines(cont_pid):
546 def start_engines(cont_pid):
@@ -555,11 +574,15 b' def main_mpi(args):'
555 def main_pbs(args):
574 def main_pbs(args):
556 cont_args = []
575 cont_args = []
557 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
576 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
558
577
559 # Check security settings before proceeding
578 # Check security settings before proceeding
560 if not check_security(args, cont_args):
579 if not check_security(args, cont_args):
561 return
580 return
562
581
582 # See if we are reusing FURL files
583 if not check_reuse(args, cont_args):
584 return
585
563 cl = ControllerLauncher(extra_args=cont_args)
586 cl = ControllerLauncher(extra_args=cont_args)
564 dstart = cl.start()
587 dstart = cl.start()
565 def start_engines(r):
588 def start_engines(r):
@@ -599,6 +622,10 b' def main_ssh(args):'
599 if not check_security(args, cont_args):
622 if not check_security(args, cont_args):
600 return
623 return
601
624
625 # See if we are reusing FURL files
626 if not check_reuse(args, cont_args):
627 return
628
602 cl = ControllerLauncher(extra_args=cont_args)
629 cl = ControllerLauncher(extra_args=cont_args)
603 dstart = cl.start()
630 dstart = cl.start()
604 def start_engines(cont_pid):
631 def start_engines(cont_pid):
@@ -621,6 +648,26 b' def main_ssh(args):'
621 def get_args():
648 def get_args():
622 base_parser = argparse.ArgumentParser(add_help=False)
649 base_parser = argparse.ArgumentParser(add_help=False)
623 base_parser.add_argument(
650 base_parser.add_argument(
651 '-r',
652 action='store_true',
653 dest='r',
654 help='try to reuse FURL files. Use with --client-port and --engine-port'
655 )
656 base_parser.add_argument(
657 '--client-port',
658 type=int,
659 dest='client_port',
660 help='the port the controller will listen on for client connections',
661 default=0
662 )
663 base_parser.add_argument(
664 '--engine-port',
665 type=int,
666 dest='engine_port',
667 help='the port the controller will listen on for engine connections',
668 default=0
669 )
670 base_parser.add_argument(
624 '-x',
671 '-x',
625 action='store_true',
672 action='store_true',
626 dest='x',
673 dest='x',
@@ -308,6 +308,11 b' This is possible. The only thing you have to do is decide what ports the contro'
308
308
309 $ ipcontroller -r --client-port=10101 --engine-port=10102
309 $ ipcontroller -r --client-port=10101 --engine-port=10102
310
310
311 These options also work with all of the various modes of
312 :command:`ipcluster`::
313
314 $ ipcluster local -n 2 -r --client-port=10101 --engine-port=10102
315
311 Then, just copy the furl files over the first time and you are set. You can start and stop the controller and engines any many times as you want in the future, just make sure to tell the controller to use the *same* ports.
316 Then, just copy the furl files over the first time and you are set. You can start and stop the controller and engines any many times as you want in the future, just make sure to tell the controller to use the *same* ports.
312
317
313 .. note::
318 .. note::
General Comments 0
You need to be logged in to leave comments. Login now