You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// list of jobs: job (cmd, args) OR rust fn OR python func + cron-like timing
|
|
|
|
// job runner (thread)
|
|
|
|
// every job runs in other thread/process
|
|
|
|
/*
|
|
|
|
use cron::Schedule as CronSchedule;
|
|
|
|
|
|
|
|
enum Schedule {
|
|
|
|
Persistent, // run forever, restart if stops (set max_retries)
|
|
|
|
Cron(CronSchedule),
|
|
|
|
Once
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref EXECUTOR: Vec<>
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
use crate::contracts::*;
|
|
|
|
|
|
|
|
pub fn execute_jobs(jobs: &mut Vec<Job>) {
|
|
|
|
jobs.iter_mut().for_each(|job| job.run())
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn exec_job(job_meta: &mut JobMeta) -> JobResult {
|
|
|
|
let mut job = Job::new(job_meta);
|
|
|
|
job.run();
|
|
|
|
job.into_result()
|
|
|
|
}
|