From: Thierry Parmentelat Date: Wed, 9 Mar 2016 14:14:28 +0000 (+0100) Subject: revisited declaration of attributes for node and application X-Git-Tag: nepi-6.0.9-pypi~5 X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=commitdiff_plain;h=0e04a6d963d4f06b7af85c91bf3a2eb0d3725d6f revisited declaration of attributes for node and application --- diff --git a/nepi/resources/linux/application.py b/nepi/resources/linux/application.py index 9fd605d8..447b5ad1 100644 --- a/nepi/resources/linux/application.py +++ b/nepi/resources/linux/application.py @@ -86,79 +86,81 @@ class LinuxApplication(ResourceManager): @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): diff --git a/nepi/resources/linux/node.py b/nepi/resources/linux/node.py index 56cc7152..32b590e2 100644 --- a/nepi/resources/linux/node.py +++ b/nepi/resources/linux/node.py @@ -149,81 +149,74 @@ class LinuxNode(ResourceManager): @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)) + 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)