1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
#include "string_utils.h" |
8 |
|
|
#include "backend_rsync.h" |
9 |
|
|
#include "backend_scp.h" |
10 |
|
|
|
11 |
|
|
///Synchronise file from host to computing center |
12 |
|
|
/** @param project : RenderProject to be synchronised from Host to Computing Center |
13 |
|
|
* @return true on success, false otherwise |
14 |
|
|
*/ |
15 |
|
|
bool backend_scpHostToComputingCenter(const RenderProject & project, const Scene & scene){ |
16 |
|
|
if(!backend_checkRemoteConnection(project)){return true;} //There is no Synchronisation to do, so everithing is fine |
17 |
|
|
std::string computingCenterProject(project.getComputingCenter().getRemoteWorkingDirectory()); |
18 |
|
|
std::string sceneDir(scene.getWorkingDirectory()); |
19 |
|
|
std::string command(project.getScpExecutable() + " -r " + sceneDir + " " + project.getComputingCenter().getComputingCenterConnection() + ":" + computingCenterProject + "/" + getFileName(project.getSourceProjectDir()) + "/" + sceneDir); |
20 |
|
|
return phoenix_popen("scene_"+scene.getName()+"_scpHostToComputingCenter.log", command, true); |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
///Synchronise file from computing center to host |
24 |
|
|
/** @param project : RenderProject to be synchronised from Computing Center to Host |
25 |
|
|
* @return true on success, false otherwise |
26 |
|
|
*/ |
27 |
|
|
bool backend_scpComputingCenterToHost(const RenderProject & project, const Scene & scene){ |
28 |
|
|
if(!backend_checkRemoteConnection(project)){return true;} //There is no Synchronisation to do, so everithing is fine |
29 |
|
|
std::string computingCenterProject(project.getComputingCenter().getRemoteWorkingDirectory()); |
30 |
|
|
std::string sceneDir(scene.getWorkingDirectory()); |
31 |
|
|
std::string command(project.getScpExecutable() + " -r " + project.getComputingCenter().getComputingCenterConnection() + ":" + computingCenterProject + "/" + getFileName(project.getSourceProjectDir()) + "/" + sceneDir + " "+ sceneDir); |
32 |
|
|
return phoenix_popen("scene_"+scene.getName()+"_scpComputingCenterToHost.log", command, true); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
|