ó
ßüÚ\c           @` sô  d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z m Z m Z d  d l m Z m Z d  d	 l m Z m Z e j  d
 ƒ Z! e j" d e# d e# ƒ Z$ e j% d e& d e# ƒ ƒ e j' d d e( d d d d ƒe j' d d e) d d d d ƒe j' d d e( d d d d ƒe j' d d e$ d d d d ƒe j' d d e$ d d d d ƒe j' d d e$ d d d d ƒe j' d d e) d d d d  ƒe j' d! d e( d d" d d# ƒe j' d$ d% d e# d& e# d' e+ d d( ƒe j' d) d e+ d d* ƒe j' d+ d d d, e# d d- ƒe j' d. d e( d d d d/ ƒe j' d0 d e, d e+ d& e# d d1 ƒe j' d2 d e( d d d d3 ƒe j' d4 d e( d d d d5 ƒe j' d6 d d d e( d d7 ƒe j' d8 d e( d, e# d9 e# d d d d: ƒe j- d; d< d= d e j. d> e ƒd? „  ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ Z/ d@ „  Z0 e1 dA k rðe0 ƒ  n  d S(B   i    (   t   print_functiont   divisiont   absolute_importN(   t   IOLoop(   t	   Scheduler(   t   Security(   t   get_ip_interface(   t   check_python_3t   install_signal_handlerst   uri_from_host_port(   t   preload_modulest   validate_preload_argv(   t   enable_proctitle_on_childrent   enable_proctitle_on_currents   distributed.schedulert   existst   resolve_patht   context_settingst   ignore_unknown_optionss   --hostt   typet   defaultt    t   helps"   URI, IP or hostname of this servers   --ports   Serving ports   --interfaces0   Preferred network interface like 'eth0' or 'ib0's   --tls-ca-files'   CA cert(s) file for TLS (in PEM format)s
   --tls-certs(   certificate file for TLS (in PEM format)s	   --tls-keys(   private key file for TLS (in PEM format)s   --bokeh-ports$   Deprecated.  See --dashboard-addresss   --dashboard-addresss   :8787s4   Address on which to listen for diagnostics dashboards   --bokeh/--no-bokeht   _bokeht   show_defaultt   requireds   Launch Bokeh Web UIs   --show/--no-shows   Show web UIs   --bokeh-whitelistt   multiples$   IP addresses to whitelist for bokeh.s   --bokeh-prefixs   Prefix for the bokeh apps   --use-xheaderss8   User xheaders in bokeh app for ssl termination in headers
   --pid-files   File to write the process PIDs   --scheduler-files   File to write connection information. This may be a good way to share connection information if your cluster is on a shared network file system.s   --local-directorys"   Directory to place scheduler filess	   --preloadt   is_eagers[   Module that should be loaded by the scheduler process  like "foo.bar" or "/path/to/foo.py".t   preload_argvt   nargsiÿÿÿÿt   callbackc   #   
   ` sº  t  j ƒ  \ } } } t  j | d | d | d ƒ t ƒ  t ƒ  | d  k	 rh t j d | ƒ | } n  t d | d | d | ƒ } |  r¥ | sœ | sœ | r¥ d }  n  ˆ  rû t	 ˆ  d ƒ   } | j
 t t j ƒ  ƒ ƒ Wd  QX‡  f d †  } t j | ƒ n  t } | r2t j j | ƒ sJt j | ƒ t } qJn t j d	 d
 ƒ } t } | t j k rot j j d | ƒ n  t j j d ƒ rÔd d  l } | j | j ƒ \ } } t | | d ƒ } | j | j | | f ƒ n  |
 rþ|  rït  d ƒ ‚ qþt! |
 ƒ }  n  t" |  | d ƒ } t# j$ ƒ  } t% j& d d ƒ i  } | r¿y1 d d l' m( }  |  i | d	 6f | d | f <Wq¿t) k
 r»}! t |! ƒ j d ƒ r¡t% j& d ƒ q¼t% j& d t |! ƒ ƒ q¿Xn  t* d | d | d |	 d | ƒ }" |" j+ | ƒ | st, j- j. d ƒ } n  | s#t, j- j. d ƒ } n  t/ | d |" d | d | ƒt% j& d  | ƒ t% j& d d ƒ t0 | ƒ z | j+ ƒ  | j1 ƒ  Wd  |" j2 ƒ  | r¥t3 j4 | ƒ n  t% j& d! | ƒ Xd  S("   Ni   sk   The --bokeh-port flag has been renamed to --dashboard-address. Consider adding ``--dashboard-address :%d`` t   tls_ca_filet   tls_scheduler_certt   tls_scheduler_keys   tls://t   wc           ` s&   t  j j ˆ  ƒ r" t  j ˆ  ƒ n  d  S(   N(   t   ost   pathR   t   remove(    (   t   pid_file(    s=   lib/python2.7/site-packages/distributed/cli/dask_scheduler.pyt   del_pid_file¥   s    t   prefixs
   scheduler-i    t   linuxi   s'   Can not specify both interface and hostiR"  t   -i/   (   t   BokehSchedulert   bokehs   No module nameds1   Web dashboard not loaded.  Unable to import bokehs   Unable to import bokeh: %st   loopt   servicest   scheduler_filet   securitys   distributed.scheduler.preloads"   distributed.scheduler.preload-argvt	   parametert   file_dirt   argvs   Local Directory: %26ss   End scheduler at %r(5   t   gct   get_thresholdt   set_thresholdR   R   t   Nonet   warningst   warnR   t   opent   writet   strR"   t   getpidt   atexitt   registert   FalseR#   R   t   mkdirt   Truet   tempfilet   mkdtempt   syst   insertt   platformt
   startswitht   resourcet	   getrlimitt   RLIMIT_NOFILEt   maxt	   setrlimitt
   ValueErrorR   R	   R   t   currentt   loggert   infot   distributed.bokeh.schedulerR*   t   ImportErrorR   t   startt   daskt   configt   getR
   R   t   closet   stopt   shutilt   rmtree(#   t   hostt   portt
   bokeh_portt   showR   t   bokeh_whitelistt   bokeh_prefixt   use_xheadersR%   R.   t	   interfacet   local_directoryt   preloadR   R   t   tls_certt   tls_keyt   dashboard_addresst   g0t   g1t   g2t   sect   fR&   t   local_directory_createdRH   t   softt   hardt   limitt   addrR,   R-   R*   t   errort	   scheduler(    (   R%   s=   lib/python2.7/site-packages/distributed/cli/dask_scheduler.pyt   main%   sˆ    h		


c           C` s   t  ƒ  t ƒ  d  S(   N(   R   Rt   (    (    (    s=   lib/python2.7/site-packages/distributed/cli/dask_scheduler.pyt   goó   s    t   __main__(2   t
   __future__R    R   R   R=   RT   t   loggingR3   R"   RY   RD   RB   R7   t   clickt   tornado.ioloopR   t   distributedR   t   distributed.securityR   t   distributed.utilsR   t   distributed.cli.utilsR   R   R	   t   distributed.preloadingR
   R   t   distributed.proctitleR   R   t	   getLoggerRO   t   PathRA   t   pem_file_option_typet   commandt   dictt   optionR;   t   intR6   R?   t   boolt   argumentt   UNPROCESSEDRt   Ru   t   __name__(    (    (    s=   lib/python2.7/site-packages/distributed/cli/dask_scheduler.pyt   <module>   s²   ]|	