revisited declaration of attributes for node and application
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 9 Mar 2016 14:14:28 +0000 (15:14 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 9 Mar 2016 14:14:28 +0000 (15:14 +0100)
nepi/resources/linux/application.py
nepi/resources/linux/node.py

index 9fd605d..447b5ad 100644 (file)
@@ -86,79 +86,81 @@ class LinuxApplication(ResourceManager):
 
     @classmethod
     def _register_attributes(cls):
 
     @classmethod
     def _register_attributes(cls):
-        command = Attribute("command", "Command to execute at application start. "
-                "Note that commands will be executed in the ${RUN_HOME} directory, "
-                "make sure to take this into account when using relative paths. ", 
-                flags = Flags.Design)
-        forward_x11 = Attribute("forwardX11", "Enables X11 forwarding for SSH connections", 
-                flags = Flags.Design)
-        env = Attribute("env", "Environment variables string for command execution",
-                flags = Flags.Design)
-        sudo = Attribute("sudo", "Run with root privileges", 
-                flags = Flags.Design)
-        depends = Attribute("depends", 
-                "Space-separated list of packages required to run the application",
-                flags = Flags.Design)
-        sources = Attribute("sources", 
-                "semi-colon separated list of regular files to be uploaded to ${SRC} "
-                "directory prior to building. Archives won't be expanded automatically. "
-                "Sources are globally available for all experiments unless "
-                "cleanHome is set to True (This will delete all sources). ",
-                flags = Flags.Design)
-        files = Attribute("files", 
-                "semi-colon separated list of regular miscellaneous files to be uploaded "
-                "to ${SHARE} directory. "
-                "Files are globally available for all experiments unless "
-                "cleanHome is set to True (This will delete all files). ",
-                flags = Flags.Design)
-        libs = Attribute("libs", 
-                "semi-colon separated list of libraries (e.g. .so files) to be uploaded "
-                "to ${LIB} directory. "
-                "Libraries are globally available for all experiments unless "
-                "cleanHome is set to True (This will delete all files). ",
-                flags = Flags.Design)
-        bins = Attribute("bins", 
-                "semi-colon separated list of binary files to be uploaded "
-                "to ${BIN} directory. "
-                "Binaries are globally available for all experiments unless "
-                "cleanHome is set to True (This will delete all files). ",
-                flags = Flags.Design)
-        code = Attribute("code", 
-                "Plain text source code to be uploaded to the ${APP_HOME} directory. ",
-                flags = Flags.Design)
-        build = Attribute("build", 
-                "Build commands to execute after deploying the sources. "
-                "Sources are uploaded to the ${SRC} directory and code "
-                "is uploaded to the ${APP_HOME} directory. \n"
-                "Usage example: tar xzf ${SRC}/my-app.tgz && cd my-app && "
-                "./configure && make && make clean.\n"
-                "Make sure to make the build commands return with a nonzero exit "
-                "code on error.",
-                flags = Flags.Design)
-        install = Attribute("install", 
-                "Commands to transfer built files to their final destinations. "
-                "Install commands are executed after build commands. ",
-                flags = Flags.Design)
-        stdin = Attribute("stdin", "Standard input for the 'command'", 
-                flags = Flags.Design)
-        tear_down = Attribute("tearDown", "Command to be executed just before " 
-                "releasing the resource", 
-                flags = Flags.Design)
-
-        cls._register_attribute(command)
-        cls._register_attribute(forward_x11)
-        cls._register_attribute(env)
-        cls._register_attribute(sudo)
-        cls._register_attribute(depends)
-        cls._register_attribute(sources)
-        cls._register_attribute(code)
-        cls._register_attribute(files)
-        cls._register_attribute(bins)
-        cls._register_attribute(libs)
-        cls._register_attribute(build)
-        cls._register_attribute(install)
-        cls._register_attribute(stdin)
-        cls._register_attribute(tear_down)
+        cls._register_attribute(
+            Attribute("command", "Command to execute at application start. "
+                      "Note that commands will be executed in the ${RUN_HOME} directory, "
+                      "make sure to take this into account when using relative paths. ", 
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("forwardX11",
+                      "Enables X11 forwarding for SSH connections", 
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("env",
+                      "Environment variables string for command execution",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("sudo",
+                      "Run with root privileges", 
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("depends", 
+                      "Space-separated list of packages required to run the application",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("sources", 
+                      "semi-colon separated list of regular files to be uploaded to ${SRC} "
+                      "directory prior to building. Archives won't be expanded automatically. "
+                      "Sources are globally available for all experiments unless "
+                      "cleanHome is set to True (This will delete all sources). ",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("files", 
+                      "semi-colon separated list of regular miscellaneous files to be uploaded "
+                      "to ${SHARE} directory. "
+                      "Files are globally available for all experiments unless "
+                      "cleanHome is set to True (This will delete all files). ",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("libs", 
+                      "semi-colon separated list of libraries (e.g. .so files) to be uploaded "
+                      "to ${LIB} directory. "
+                      "Libraries are globally available for all experiments unless "
+                      "cleanHome is set to True (This will delete all files). ",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("bins", 
+                      "semi-colon separated list of binary files to be uploaded "
+                      "to ${BIN} directory. "
+                      "Binaries are globally available for all experiments unless "
+                      "cleanHome is set to True (This will delete all files). ",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("code", 
+                      "Plain text source code to be uploaded to the ${APP_HOME} directory. ",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("build", 
+                      "Build commands to execute after deploying the sources. "
+                      "Sources are uploaded to the ${SRC} directory and code "
+                      "is uploaded to the ${APP_HOME} directory. \n"
+                      "Usage example: tar xzf ${SRC}/my-app.tgz && cd my-app && "
+                      "./configure && make && make clean.\n"
+                      "Make sure to make the build commands return with a nonzero exit "
+                      "code on error.",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("install", 
+                      "Commands to transfer built files to their final destinations. "
+                      "Install commands are executed after build commands. ",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("stdin", "Standard input for the 'command'", 
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("tearDown", "Command to be executed just before " 
+                      "releasing the resource", 
+                      flags = Flags.Design))
 
     @classmethod
     def _register_traces(cls):
 
     @classmethod
     def _register_traces(cls):
index 56cc715..32b590e 100644 (file)
@@ -149,81 +149,74 @@ class LinuxNode(ResourceManager):
 
     @classmethod
     def _register_attributes(cls):
 
     @classmethod
     def _register_attributes(cls):
-        cls._register_attribute(Attribute(
-            "hostname", "Hostname of the machine",
-            flags = Flags.Design))
-
-        cls._register_attribute(Attribute(
-            "username", "Local account username", 
-            flags = Flags.Credential))
-
-        cls._register_attribute(Attribute(
-            "port", "SSH port",
-            flags = Flags.Design))
-        
-        cls._register_attribute(Attribute(
-            "home",
-            "Experiment home directory to store all experiment related files",
-            flags = Flags.Design))
-        
-        cls._register_attribute(Attribute(
-            "identity", "SSH identity file",
-            flags = Flags.Credential))
-        
-        cls._register_attribute(Attribute(
-            "serverKey", "Server public key", 
-            flags = Flags.Design))
-        
-        cls._register_attribute(Attribute(
-            "cleanHome",
-            "Remove all nepi files and directories "
-            " from node home folder before starting experiment", 
-            type = Types.Bool,
-            default = False,
-            flags = Flags.Design))
-
-        cls._register_attribute(Attribute(
-            "cleanExperiment", "Remove all files and directories " 
-            " from a previous same experiment, before the new experiment starts", 
-            type = Types.Bool,
-            default = False,
-            flags = Flags.Design))
-        
-        cls._register_attribute(Attribute(
-            "cleanProcesses", 
-            "Kill all running processes before starting experiment",
-            type = Types.Bool,
-            default = False,
-            flags = Flags.Design))
-        
-        cls._register_attribute(Attribute(
-            "cleanProcessesAfter", 
-            """Kill all running processes after starting experiment
-            This might be dangerous when using user root""",
-            type = Types.Bool,
-            default = True,
-            flags = Flags.Design))
-        
-        cls._register_attribute(Attribute(
-            "tearDown",
-            "Bash script to be executed before releasing the resource",
-            flags = Flags.Design))
-
-        cls._register_attribute(Attribute(
-            "gatewayUser",
-            "Gateway account username",
-            flags = Flags.Design))
-
-        cls._register_attribute(Attribute(
-            "gateway",
-            "Hostname of the gateway machine",
-            flags = Flags.Design))
-
-        cls._register_attribute(Attribute(
-            "ip",
-            "Linux host public IP address. "
-            "Must not be modified by the user unless hostname is 'localhost'",
+        cls._register_attribute(
+            Attribute("hostname",
+                      "Hostname of the machine",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("username",
+                      "Local account username", 
+                      flags = Flags.Credential))
+        cls._register_attribute(
+            Attribute("port",
+                      "SSH port",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("home",
+                      "Experiment home directory to store all experiment related files",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("identity",
+                      "SSH identity file",
+                      flags = Flags.Credential))
+        cls._register_attribute(
+            Attribute("serverKey",
+                      "Server public key", 
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("cleanHome",
+                      "Remove all nepi files and directories "
+                      " from node home folder before starting experiment", 
+                      type = Types.Bool,
+                      default = False,
             flags = Flags.Design))
             flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("cleanExperiment",
+                      "Remove all files and directories " 
+                      " from a previous same experiment, before the new experiment starts", 
+                      type = Types.Bool,
+                      default = False,
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("cleanProcesses",
+                      "Kill all running processes before starting experiment",
+                      type = Types.Bool,
+                      default = False,
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("cleanProcessesAfter",
+                      "Kill all running processes after starting experiment"
+                      "NOTE: This might be dangerous when using user root",
+                      type = Types.Bool,
+                      default = True,
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("tearDown",
+                      "Bash script to be executed before releasing the resource",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("gatewayUser",
+                      "Gateway account username",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("gateway",
+                      "Hostname of the gateway machine",
+                      flags = Flags.Design))
+        cls._register_attribute(
+            Attribute("ip",
+                      "Linux host public IP address. "
+                      "Must not be modified by the user unless hostname is 'localhost'",
+                      flags = Flags.Design))
 
     def __init__(self, ec, guid):
         super(LinuxNode, self).__init__(ec, guid)
 
     def __init__(self, ec, guid):
         super(LinuxNode, self).__init__(ec, guid)