Jelajahi Sumber

Patched options.py to add an extra variable to the dict available to the
configuration sections that provides the host node's name, so you can
easily name processes uniquely on different hosts if you choose to.

Joe Kondel 14 tahun lalu
induk
melakukan
ddff578dc9
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      src/supervisor/options.py

+ 3 - 1
src/supervisor/options.py

@@ -29,6 +29,7 @@ import stat
 import pkg_resources
 import select
 import glob
+import platform
 
 from fcntl import fcntl
 from fcntl import F_SETFL, F_GETFL
@@ -789,11 +790,12 @@ class ServerOptions(Options):
                 raise ValueError(
                     '%(process_num) must be present within process_name when '
                     'numprocs > 1')
-
+        host_node_name = platform.node()
         for process_num in range(numprocs_start, numprocs + numprocs_start):
             expansions = {'here':self.here,
                           'process_num':process_num,
                           'program_name':program_name,
+                          'host_node_name':host_node_name,
                           'group_name':group_name}
 
             environment = dict_of_key_value_pairs(