9#include "phoenix_color.h"
10#include "phoenix_system.h"
11#include "convertToString.h"
12#include "phoenix_vector_split.h"
29 PString logContent(
"");
33 std::cout << termCyan() <<
"Call command '"<<command<<
"'" << termDefault() << std::endl;
42 for(VecProgramCall::iterator it(vecCall.begin()); it != vecCall.end(); ++it){
52 if(vecCall.size() == 0lu){
return;}
62 size_t indexProgressBar = progress.
addProgressBar(
"Progress of thread " + valueToString(threadIndex), vecCall.size());
63 for(VecProgramCall::iterator it(vecCall.begin()); it != vecCall.end(); ++it){
73 size_t nbThread = vecVecProgramCall.size();
75 std::vector<std::thread> vecThread;
76 vecThread.resize(nbThread);
78 for(
size_t i(0lu); i < nbThread; ++i){
81 threadProgress.join();
82 for(
size_t i(0lu); i < nbThread; ++i){
87 std::cout <<
"VecProgramCall : summary : " << nbSuccess <<
" success, " << nbFail <<
" fail" << std::endl;
95 if(vecCall.size() == 0lu){
return;}
97 phoenix_vector_split(vecVecProgramCall, vecCall, nbThread);
109 const PPath & workingDirectory,
const PPath & logFile)
117 vecCall.push_back(call);
126 size_t nbSuccessCall(0lu);
127 for(VecProgramCall::const_iterator it(vecCall.begin()); it != vecCall.end(); ++it){
128 nbSuccessCall += it->getExitStatus() == result;
130 return nbSuccessCall;
139 size_t nbSuccessCall(0lu);
140 for(VecVecProgramCall::const_iterator it(vecCall.begin()); it != vecCall.end(); ++it){
143 return nbSuccessCall;
168 for(VecVecProgramCall::const_iterator it(vecCall.begin()); it != vecCall.end(); ++it){
169 nbCall += it->size();
void phoenix_print_parallel_progress(PMultiThreadProgress &progress, int refreshSecond)
Print the parallel progression of the computing.
Deal with Progress bar in mutlithread mode.
size_t addProgressBar(const PString &name, int progressMax=1)
Add a progress line.
void incrementProgress(size_t index)
Increment the progress of the progress bar at index.
void setLogFile(const PPath &logFile)
Sets the logFile of the ProgramCall.
const PPath & getLogFile() const
Gets the logFile of the ProgramCall.
void setName(const PString &name)
Sets the name of the ProgramCall.
const PPath & getWorkingDirectory() const
Gets the workingDirectory of the ProgramCall.
void setExitStatus(int exitStatus)
Sets the exitStatus of the ProgramCall.
const PString & getCommand() const
Gets the command of the ProgramCall.
void setCommand(const PString &command)
Sets the command of the ProgramCall.
void setWorkingDirectory(const PPath &workingDirectory)
Sets the workingDirectory of the ProgramCall.
void lauchParallelThread(const std::vector< T > &listInputPTabModelFile, long unsigned int nbThread, _Callable &&__f, _Args &&... __args)
Lauch the callable function __f on nbThread threads with __args to be passed to each thread.
void phoenix_program_callParallelProgressBar(VecVecProgramCall &vecVecProgramCall)
Exectute programs on several threads (with a multithread progress bar)
size_t phoenix_program_getNbCallExitStatusType(const VecProgramCall &vecCall, int result)
Get number of call result of a given type.
size_t phoenix_program_getNbSuccessCall(const VecProgramCall &vecCall)
Get the number of success call.
void phoenix_program_callParallel(VecProgramCall &vecCall, size_t nbThread)
Exectute programs on several threads.
void phoenix_program_callVecProgress(PMultiThreadProgress &progress, VecProgramCall &vecCall, size_t threadIndex)
Call a vector of program.
void phoenix_program_callVec(VecProgramCall &vecCall)
Call a vector of program.
void phoenix_program_addcall(VecProgramCall &vecCall, const PString &name, const PString &command, const PPath &workingDirectory, const PPath &logFile)
Add a program call.
void phoenix_program_call(ProgramCall &call)
Call a program.
size_t phoenix_program_getNbCall(const VecVecProgramCall &vecCall)
Get the number of call.
std::vector< VecProgramCall > VecVecProgramCall
Vector of vector of program call.
std::vector< ProgramCall > VecProgramCall
Vector of program call.