29 class SSHBackend:
public Backend {
31 std::queue<std::future<bool>> jobs;
38 ssh::SSHScheduler* scheduler;
41 virtual void startTool(
const Tool* tool) {
42 scheduler->uploadTool(tool);
45 while (!jobs.empty()) waitAndPop();
46 scheduler->cleanupTools();
48 virtual void execute(
const Tool* tool,
const fs::path& file) {
50 while (scheduler->runningJobs() > scheduler->workerCount() * 2) {
51 if (jobs.front().wait_for(std::chrono::milliseconds(1)) == std::future_status::ready) {
56 jobs.push(std::async(std::launch::async, &ssh::SSHScheduler::executeJob, scheduler, tool, file,
this));
60 scheduler =
new ssh::SSHScheduler();
75 BENCHMAX_LOG_ERROR(
"benchmax",
"This version of benchmax was compiled without support for SSH.");
#define BENCHMAX_LOG_DEBUG(channel, msg)
Log debug messages.
#define BENCHMAX_LOG_ERROR(channel, msg)
Log errors.
Base class for all backends.
void madeProgress(std::size_t files=1)
Can be called to give information about the current progress, if available.
virtual void finalize()
Hook to allow for asynchronous backends to wait for jobs to terminate.
virtual void execute(const Tool *, const fs::path &)
Execute a single pair of tool and benchmark.
virtual void startTool(const Tool *)
Hook for every tool at the beginning.
Represents a set of jobs, constructed as the cartesian product of a set of tools and a set of benchma...
void run(const Jobs &, bool)
Dummy if SSH is disabled.