From 99ac14ea3fd1235bd3ea984180d2b1fddb7edf65 Mon Sep 17 00:00:00 2001 From: Anar Manafov Date: Tue, 2 Mar 2021 13:47:45 +0100 Subject: [PATCH] GH-349: Improve wrk dir format in dds-ssh-plugin dds-ssh-plugin: Modified: Remote destination directories are no longer required and will be created automatically at runtime. (GH-349) dds-ssh-plugin: Modified: Final remote destination directories are created in DDS session ID subfolder, i.e. direcrtory format is "(root wrk dir from plugin cfg)/(sessionID)/(wn ID from plugin cfg)". (GH-349) --- ReleaseNotes.md | 5 +++++ plugins/dds-submit-lsf/src/main.cpp | 4 ++-- plugins/dds-submit-pbs/src/main.cpp | 4 ++-- plugins/dds-submit-ssh/src/dds-submit-ssh-worker | 2 +- plugins/dds-submit-ssh/src/worker.cpp | 10 +++++++--- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 4f2fc93d..5a814721 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -25,6 +25,11 @@ Modified: improved default SID storage and handling. (GH-318) Fixed: a couple of fixes in Slurm plugin found on a Virgo cluster. Fixed: fixed path to demonised log file. This log is created if plug-in failed to start. + +### dds-ssh-plugin +Modified: Remote destination directories are no longer required and will be created automatically at runtime. (GH-349) +Modified: Final remote destination directories are created in DDS session ID subfolder, i.e. direcrtory format is "(root wrk dir from plugin cfg)/(sessionID)/(wn ID from plugin cfg)". (GH-349) + ## v3.4 (2020-07-01) ### DDS common diff --git a/plugins/dds-submit-lsf/src/main.cpp b/plugins/dds-submit-lsf/src/main.cpp index 0e034519..2664d950 100644 --- a/plugins/dds-submit-lsf/src/main.cpp +++ b/plugins/dds-submit-lsf/src/main.cpp @@ -175,8 +175,8 @@ int main(int argc, char* argv[]) fs::path pathlsfScript(pathPluginDir); pathlsfScript /= "dds-submit-lsf-worker"; stringstream cmd; - cmd << "$DDS_LOCATION/bin/dds-daemonize " << sSandboxDir << " /bin/bash -c \"" - << pathlsfScript.string() << "\""; + cmd << "$DDS_LOCATION/bin/dds-daemonize " << sSandboxDir << " /bin/bash -c \"" << pathlsfScript.string() + << "\""; proto.sendMessage(dds::intercom_api::EMsgSeverity::info, "Preparing job submission..."); string output; diff --git a/plugins/dds-submit-pbs/src/main.cpp b/plugins/dds-submit-pbs/src/main.cpp index e126b940..deed8bb1 100644 --- a/plugins/dds-submit-pbs/src/main.cpp +++ b/plugins/dds-submit-pbs/src/main.cpp @@ -171,8 +171,8 @@ int main(int argc, char* argv[]) fs::path pathPBSScript(pathPluginDir); pathPBSScript /= "dds-submit-pbs-worker"; stringstream cmd; - cmd << "$DDS_LOCATION/bin/dds-daemonize " << sSandboxDir << " /bin/bash -c \"" - << pathPBSScript.string() << "\""; + cmd << "$DDS_LOCATION/bin/dds-daemonize " << sSandboxDir << " /bin/bash -c \"" << pathPBSScript.string() + << "\""; proto.sendMessage(dds::intercom_api::EMsgSeverity::info, "Preparing job submission..."); string output; diff --git a/plugins/dds-submit-ssh/src/dds-submit-ssh-worker b/plugins/dds-submit-ssh/src/dds-submit-ssh-worker index 19abf77d..702bbc5e 100755 --- a/plugins/dds-submit-ssh/src/dds-submit-ssh-worker +++ b/plugins/dds-submit-ssh/src/dds-submit-ssh-worker @@ -122,7 +122,7 @@ fi # send a worker package and worker's script # use rsync since it can automatically create a remote working dir -rsync -aq -e "ssh $SSH_OPT_INT $SSHOPT" $WRK_S_L $SSH_CON_STR:$RDIR/ 2>&1 | logMsgPipe +rsync -aq --rsync-path="mkdir -p $RDIR && rsync" -e "ssh $SSH_OPT_INT $SSHOPT" $WRK_S_L $SSH_CON_STR:$RDIR/ 2>&1 | logMsgPipe if (( ${PIPESTATUS[0]} != 0 )); then logMsg "$TOOL_NAME error: failed to send worker's package" exit 1 diff --git a/plugins/dds-submit-ssh/src/worker.cpp b/plugins/dds-submit-ssh/src/worker.cpp index 8276e276..a68929fd 100644 --- a/plugins/dds-submit-ssh/src/worker.cpp +++ b/plugins/dds-submit-ssh/src/worker.cpp @@ -14,6 +14,7 @@ using namespace std; using namespace dds; using namespace dds::ssh_cmd; using namespace MiscCommon; +using namespace dds::user_defaults_api; namespace fs = boost::filesystem; //============================================================================= const std::chrono::seconds g_cmdTimeout = std::chrono::seconds(20); @@ -24,10 +25,13 @@ CWorker::CWorker(ncf::configRecord_t _rec, const SWNOptions& _options, const str , m_path(_path) { // constructing a full path of the worker for this id - // pattern: / - smart_append(&m_rec->m_wrkDir, '/'); + // pattern: // smart_path(&m_rec->m_wrkDir); - m_rec->m_wrkDir += m_rec->m_id; + fs::path pathWrk(m_rec->m_wrkDir); + pathWrk /= CUserDefaults::instance().getCurrentSID(); + pathWrk /= m_rec->m_id; + + m_rec->m_wrkDir = pathWrk.string(); } //============================================================================= CWorker::~CWorker()