From: Ovidiu Mircescu Date: Mon, 5 Feb 2018 16:55:16 +0000 (+0100) Subject: New access protocol rsync. X-Git-Tag: V8_5_0a1~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e3f16712f1b444ac926d3600d713ea0e4917629;p=modules%2Fkernel.git New access protocol rsync. Protocol used by SALOME_Launcher for file copy. Needs libbatch upgrade. --- diff --git a/idl/SALOME_ResourcesManager.idl b/idl/SALOME_ResourcesManager.idl index ee7461c3f..2c92ceba0 100644 --- a/idl/SALOME_ResourcesManager.idl +++ b/idl/SALOME_ResourcesManager.idl @@ -110,8 +110,11 @@ struct ResourceDefinition string hostname; //! Type of the resource ("cluster" or "single_machine") string type; - //! protocol to connect to the resource - //! protocol used to start a remote container (ssh or rsh) + //! protocol to connect to the resource and to start a remote container + //! Possible values: + //! "rsh" : uses rsh and rcp + //! "ssh" : uses ssh and scp + //! "rsync" : uses ssh and rsync string protocol; //! login name to use to start a remote container string username; diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index b6737b177..5db6b8df3 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -480,6 +480,9 @@ Launcher_cpp::FactoryBatchManager(ParserResourcesType& params) case ssh: protocol = Batch::SSH; break; + case rsync: + protocol = Batch::RSYNC; + break; default: throw LauncherException("Unknown protocol for this resource"); break; diff --git a/src/Launcher/Launcher_Job.cxx b/src/Launcher/Launcher_Job.cxx index ed944325d..07241c30e 100644 --- a/src/Launcher/Launcher_Job.cxx +++ b/src/Launcher/Launcher_Job.cxx @@ -665,16 +665,19 @@ Launcher::Job::common_job_params() std::string local_file; if (file.substr(0, 1) == std::string("/")) local_file = file; + else if (file.substr(0, 1) == std::string("-")) // using rsync options + local_file = file; else #ifndef WIN32 - local_file = _local_directory + "/" + file; + // '/./' is used by rsync to find the root of the relative path + // /a/b/./c/f -> _working_directory/c/f + local_file = _local_directory + "/./" + file; #else local_file = file; #endif // remote file -> get only file name from in_files - size_t found = file.find_last_of("/"); - std::string remote_file = _work_directory + "/" + file.substr(found+1); + std::string remote_file = _work_directory + "/"; params[Batch::INFILE] += Batch::Couple(local_file, remote_file); } @@ -692,10 +695,16 @@ Launcher::Job::common_job_params() size_t found = file.find_last_of("/"); local_file = file.substr(found+1); } + else if (file.substr(0, 1) == std::string("-")) // using rsync options + { + remote_file = file; + local_file = ""; + } else { - remote_file = _work_directory + "/" + file; - local_file = file; + // '/./' is used by rsync to find the root of the relative path + remote_file = _work_directory + "/./" + file; + local_file = ""; } params[Batch::OUTFILE] += Batch::Couple(local_file, remote_file); diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx index 214faa398..552c01f88 100644 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx @@ -168,6 +168,8 @@ std::string ParserResourcesType::protocolToString(AccessProtocolType protocol) return "pbsdsh"; case blaunch: return "blaunch"; + case rsync: + return "rsync"; default: throw ResourcesException("Unknown protocol"); } @@ -187,6 +189,8 @@ AccessProtocolType ParserResourcesType::stringToProtocol(const std::string & pro return pbsdsh; else if (protocolStr == "blaunch") return blaunch; + else if (protocolStr == "rsync") + return rsync; else throw ResourcesException((string("Unknown protocol ") + protocolStr).c_str()); } diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx index cf44f79c5..fcc68baab 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx @@ -41,7 +41,7 @@ #pragma warning(disable:4251) // Warning DLL Interface ... #endif -enum AccessProtocolType {sh, rsh, ssh, srun, pbsdsh, blaunch}; +enum AccessProtocolType {sh, rsh, ssh, srun, pbsdsh, blaunch, rsync}; enum ResourceType {cluster, single_machine};