GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/RenderBackend/backend_rsync.cpp Lines: 0 29 0.0 %
Date: 2023-10-11 10:52:07 Branches: 0 178 0.0 %

Line Branch Exec Source
1
/***************************************
2
	Auteur : Pierre Aubert
3
	Mail : pierre.aubert@lapp.in2p3.fr
4
	Licence : CeCILL-C
5
****************************************/
6
7
#include "string_utils.h"
8
9
#include "backend_rsync.h"
10
11
///Check if a remote connection is provided
12
/**	@param project : RenderProject to be synchronised from Host to Computing Center
13
 * 	@return true on success, false otherwise
14
*/
15
bool backend_checkRemoteConnection(const RenderProject & project){
16
	if(project.getComputingCenter().getComputingCenterConnection() == ""){
17
		std::cout << "backend_checkRemoteConnection : No synchronisation to do because no computing center connection provided" << std::endl;
18
		return false;
19
	}else{
20
		return true;
21
	}
22
}
23
24
///Synchronise file from host to computing center
25
/**	@param project : RenderProject to be synchronised from Host to Computing Center
26
 * 	@return true on success, false otherwise
27
*/
28
bool backend_rsyncHostToComputingCenter(const RenderProject & project, const Scene & scene){
29
	if(!backend_checkRemoteConnection(project)){return true;}	//There is no Synchronisation to do, so everithing is fine
30
	std::string computingCenterProject(project.getComputingCenter().getRemoteWorkingDirectory());
31
	std::string sceneDir(scene.getWorkingDirectory());
32
	std::string command(project.getRsyncExecutable() + " -r " + sceneDir + " " + project.getComputingCenter().getComputingCenterConnection() + ":" + computingCenterProject + "/" + getFileName(project.getSourceProjectDir()) + "/" + sceneDir);
33
	return phoenix_popen("scene_"+scene.getName()+"_rsyncHostToComputingCenter.log", command, true);
34
}
35
36
///Synchronise file from computing center to host
37
/**	@param project : RenderProject to be synchronised from Computing Center to Host
38
 * 	@return true on success, false otherwise
39
*/
40
bool backend_rsyncComputingCenterToHost(const RenderProject & project, const Scene & scene){
41
	if(!backend_checkRemoteConnection(project)){return true;}	//There is no Synchronisation to do, so everithing is fine
42
	std::string computingCenterProject(project.getComputingCenter().getRemoteWorkingDirectory());
43
	std::string sceneDir(scene.getWorkingDirectory());
44
	std::string command(project.getRsyncExecutable() + " -r " + project.getComputingCenter().getComputingCenterConnection() + ":" + computingCenterProject + "/" + getFileName(project.getSourceProjectDir()) + "/" + sceneDir + " "+ sceneDir);
45
	return phoenix_popen("scene_"+scene.getName()+"_rsyncComputingCenterToHost.log", command, true);
46
}
47
48
///Synchronise file from host to computing center
49
/**	@param project : RenderProject to be synchronised from Host to Computing Center
50
 * 	@return true on success, false otherwise
51
*/
52
bool backend_rsyncHostToComputingCenter(const RenderProject & project){
53
	if(!backend_checkRemoteConnection(project)){return true;}	//There is no Synchronisation to do, so everithing is fine
54
	std::string computingCenterProject(project.getComputingCenter().getRemoteWorkingDirectory());
55
	std::string projectDir(project.getSourceProjectDir());
56
	std::string command(project.getRsyncExecutable() + " -r " + projectDir + " " + project.getComputingCenter().getComputingCenterConnection() + ":" + computingCenterProject);
57
	return phoenix_popen("backend_rsyncHostToComputingCenter.log", command, true);
58
}
59
60
///Synchronise file from computing center to host
61
/**	@param project : RenderProject to be synchronised from Computing Center to Host
62
 * 	@return true on success, false otherwise
63
*/
64
bool backend_rsyncComputingCenterToHost(const RenderProject & project){
65
	if(!backend_checkRemoteConnection(project)){return true;}	//There is no Synchronisation to do, so everithing is fine
66
	std::string computingCenterProject(project.getComputingCenter().getRemoteWorkingDirectory());
67
	std::string projectDir(project.getSourceProjectDir());
68
	std::string command(project.getRsyncExecutable() + " -r " + project.getComputingCenter().getComputingCenterConnection() + ":" + computingCenterProject + " "+ projectDir);
69
	return phoenix_popen("backend_rsyncComputingCenterToHost.log", command, true);
70
}
71
72