Back to index

salome-kernel  6.5.0
Classes | Functions | Variables
kill_remote_containers Namespace Reference

Classes

class  ParseError
class  Resource

Functions

def get_hostname
def main

Variables

tuple appli_local = os.path.realpath(os.path.dirname(__file__))
tuple APPLI = getAppliPath.relpath(appli_local,os.path.realpath(os.getenv('HOME')))
string usage

Function Documentation

Definition at line 68 of file kill_remote_containers.py.

00068 
00069 def get_hostname():
00070   return socket.gethostname().split('.')[0]

Here is the caller graph for this function:

Definition at line 111 of file kill_remote_containers.py.

00111 
00112 def main():
00113   parser = optparse.OptionParser(usage=usage)
00114   parser.add_option('-p','--port', dest="port", 
00115                             help="The SALOME session port (default NSPORT or 2810)")
00116 
00117 
00118   options, args = parser.parse_args()
00119 
00120   if not os.path.exists(catalog_file):
00121     print "ERROR: the catalog file %s is mandatory" % catalog_file_base
00122     sys.exit(1)
00123 
00124   #Parse CatalogResource.xml
00125   doc = etree_.parse(catalog_file)
00126 
00127   rootNode = doc.getroot()
00128   if rootNode.tag != "resources":
00129     raise  ParseError("First level tag must be resources not %s" % rootNode.tag)
00130 
00131   resources=[]
00132 
00133   #Extract resources
00134   for child in rootNode:
00135     if child.tag != "machine":
00136       raise  ParseError("Second level tag must be machine not %s" % child.tag)
00137     resources.append(Resource(child))
00138 
00139   local_names=("localhost",get_hostname())
00140 
00141   for resource in resources:
00142     if resource.get_host() in local_names:continue
00143     command=resource.get_rsh() +" -l "+resource.get_user()+" "+resource.get_host()
00144     command=command+ " " + os.path.join(resource.get_appliPath(),"runRemote.sh")
00145     if options.port:
00146       port=options.port
00147     else:
00148       port=os.getenv("NSPORT") or "2810"
00149     command=command+ " " + get_hostname() + " " + port +" killSalomeWithPort.py " + port
00150     print command
00151     os.system(command)

Here is the call graph for this function:


Variable Documentation

tuple kill_remote_containers.APPLI = getAppliPath.relpath(appli_local,os.path.realpath(os.getenv('HOME')))

Definition at line 32 of file kill_remote_containers.py.

tuple kill_remote_containers.appli_local = os.path.realpath(os.path.dirname(__file__))

Definition at line 31 of file kill_remote_containers.py.

Initial value:
00001 """usage: %prog [options]
00002 
00003 This procedure kill all containers that have been launched in a SALOME session on remote machines.
00004 A SALOME session is identified by a machine name and a port number.
00005 
00006 You need to have a well installed SALOME application with a CatalogResources.xml file.
00007 This file is used (parsed) to collect all remote resources.
00008 Remote resources are all the resources on remote machines not including the main local SALOME application.
00009 """

Definition at line 34 of file kill_remote_containers.py.