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_getFileName.h" |
9 |
|
|
#include "backend_rsync.h" |
10 |
|
|
#include "backend_scp.h" |
11 |
|
|
#include "backend_pull.h" |
12 |
|
|
|
13 |
|
|
///Get the status of the given scene |
14 |
|
|
/** @param scene : Scene we want the status |
15 |
|
|
* @return true on success, false otherwise |
16 |
|
|
*/ |
17 |
|
|
bool backend_scenePull(const RenderProject & renderProject, const Scene & scene){ |
18 |
|
|
std::cout << termCyan() << "Pull Scene"<<termDefault()<<" : '"<<scene.getName()<<"'" << std::endl; |
19 |
|
|
return backend_rsyncComputingCenterToHost(renderProject, scene); |
20 |
|
|
} |
21 |
|
|
|
22 |
|
|
///Pull scenes to render them on the Computing Center |
23 |
|
|
/** @param[out] isSuccess : true if pull was a success |
24 |
|
|
* @param renderProject : render project to be used |
25 |
|
|
* @param wantPull : true if we want to pull scenes |
26 |
|
|
* @param vecPullScene : vector of scene names to be rendered on the Computing Center (Pull all scenes if empty) |
27 |
|
|
* @return true if the function was called |
28 |
|
|
*/ |
29 |
|
|
bool backend_pull(bool & isSuccess, const RenderProject & renderProject, bool wantPull, const std::vector<std::string> & vecPullScene){ |
30 |
|
|
if(!wantPull){return false;} |
31 |
|
|
const std::map<std::string, Scene> & mapScene = renderProject.getMapScene(); |
32 |
|
|
if(vecPullScene.size() == 0lu){ |
33 |
|
|
std::cout << termCyan() << "Pull Full Project"<<termDefault() << std::endl; |
34 |
|
|
// isSuccess = backend_rsyncHostToComputingCenter(renderProject); |
35 |
|
|
for(std::map<std::string, Scene>::const_iterator it(mapScene.begin()); it != mapScene.end(); ++it){ |
36 |
|
|
isSuccess &= backend_scenePull(renderProject, it->second); |
37 |
|
|
} |
38 |
|
|
}else{ |
39 |
|
|
for(std::vector<std::string>::const_iterator it(vecPullScene.begin()); it != vecPullScene.end(); ++it){ |
40 |
|
|
std::map<std::string, Scene>::const_iterator itFind(mapScene.find(*it)); |
41 |
|
|
if(itFind != mapScene.end()){ |
42 |
|
|
isSuccess &= backend_scenePull(renderProject, itFind->second); |
43 |
|
|
} |
44 |
|
|
} |
45 |
|
|
} |
46 |
|
|
return true; |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
|