71 int write_job(
const std::string& batch_path,
int num_proc = 1);
125 std::string key_path,
int port = 22,
126 bool shell_capable =
true);
163 bool copy_remote(
const std::string& local_filepath,
164 const std::string& remote_dir,
165 const std::string& remote_name =
"");
180 bool copy_files(
const std::vector<std::string>& local_filepaths,
181 const std::string& remote_dir);
194 const std::string& local_dir);
281 bool schedule_job(
const std::string& batch_path,
int num_proc);
SSH/SCP connection to a single remote host via the system ssh/scp.
Definition JobScheduler.hpp:109
~ClusterConnection()
Closes the multiplexed master via terminate_connection().
Definition JobScheduler.cpp:280
bool terminate_connection()
Tears down the multiplexed master via ssh -O exit (best effort).
Definition JobScheduler.cpp:302
std::string execute_remote_command(const std::string &command)
Executes a shell command on the remote host and returns its stdout.
Definition JobScheduler.cpp:377
bool fetch_remote(const std::string &remote_filepath, const std::string &local_dir)
Downloads a single remote file into a local directory via SCP.
Definition JobScheduler.cpp:400
bool copy_files(const std::vector< std::string > &local_filepaths, const std::string &remote_dir)
Uploads several local files to a remote directory in one SCP session.
Definition JobScheduler.cpp:347
std::string control_path
-o ControlPath= socket template for multiplexing.
Definition JobScheduler.hpp:221
bool copy_remote(const std::string &local_filepath, const std::string &remote_dir, const std::string &remote_name="")
Uploads a local file to a remote directory via SCP.
Definition JobScheduler.cpp:316
bool start_connection()
Opens (and pins) the multiplexed SSH master with a no-op command.
Definition JobScheduler.cpp:284
Secrets secrets
Definition JobScheduler.hpp:220
bool shell_capable_
False for transfer-only hosts (data-mover).
Definition JobScheduler.hpp:222
Orchestrates job writing, file transfer, and SLURM submission.
Definition JobScheduler.hpp:244
std::string log_path
Definition JobScheduler.hpp:317
std::unique_ptr< JobWriter > job_writer
Constructed in set_paths() once all paths are known.
Definition JobScheduler.hpp:321
std::string rules_path
Definition JobScheduler.hpp:319
bool retrieve_results()
Downloads valid_data.csv and alarms.log from the cluster.
Definition JobScheduler.cpp:591
std::unique_ptr< ClusterConnection > submit_conn_
Definition JobScheduler.hpp:327
std::string sensors_path
Definition JobScheduler.hpp:318
bool schedule_job(const std::string &batch_path, int num_proc)
Writes a SLURM script, uploads all inputs, and submits the job.
Definition JobScheduler.cpp:485
bool preflight()
Verifies that the cluster is reachable and the container image is in place.
Definition JobScheduler.cpp:427
std::string last_job_id_
Definition JobScheduler.hpp:334
void set_paths(const std::string &sensors_path, const std::string &rules_path, const std::string &log_path)
Sets the local file paths used by subsequent schedule_job() calls.
Definition JobScheduler.cpp:477
Fills a SLURM job template ({{TOKEN}} placeholders) and writes it to disk.
Definition JobScheduler.hpp:47
int write_job(const std::string &batch_path, int num_proc=1)
Instantiates the template and writes job_<id>.slurm to disk.
Definition JobScheduler.cpp:209
EnvVars env
Definition JobScheduler.hpp:91
void set_env()
Reads required env vars into env; throws on the first missing one.
Definition JobScheduler.cpp:196
std::string sensors_path
Definition JobScheduler.hpp:79
std::string rules_path
Definition JobScheduler.hpp:80
int job_counter
Definition JobScheduler.hpp:78
SSH credentials; never exposed outside this class.
Definition JobScheduler.hpp:213
std::string user
Definition JobScheduler.hpp:215
std::string key_path
Passed to ssh -i; may be empty (agent only).
Definition JobScheduler.hpp:216
std::string host
Definition JobScheduler.hpp:214
int port
Definition JobScheduler.hpp:217
Env-var values cached at construction time.
Definition JobScheduler.hpp:83
std::string remote_output_dir
Absolute path where valid_data.csv and alarms.log are written.
Definition JobScheduler.hpp:86
std::string container_sif_path
Absolute path to container.sif on the cluster (no $SCRATCH).
Definition JobScheduler.hpp:87
std::string mail_user
Email address for SLURM --mail-user.
Definition JobScheduler.hpp:88
std::string template_filepath
Local path to the SLURM job template.
Definition JobScheduler.hpp:84
std::string remote_workdir
Absolute path on the cluster where inputs land and the job runs.
Definition JobScheduler.hpp:85