mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Retire puppet workers (#1449)
Closes #583 After the separation of PVF worker binaries, dedicated puppet workers are not needed for tests anymore. The production workers can be used instead, avoiding some code duplication and decreasing complexity. The changes also make it possible to further refactor the code to isolate workers completely.
This commit is contained in:
@@ -47,45 +47,3 @@ pub fn validate_candidate(
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Use this macro to declare a `fn main() {}` that will check the arguments and dispatch them to
|
||||
/// the appropriate worker, making the executable that can be used for spawning workers.
|
||||
#[macro_export]
|
||||
macro_rules! decl_puppet_worker_main {
|
||||
() => {
|
||||
fn main() {
|
||||
$crate::sp_tracing::try_init_simple();
|
||||
|
||||
let args = std::env::args().collect::<Vec<_>>();
|
||||
if args.len() == 1 {
|
||||
panic!("wrong number of arguments");
|
||||
}
|
||||
|
||||
let entrypoint = match args[1].as_ref() {
|
||||
"exit" => {
|
||||
std::process::exit(1);
|
||||
},
|
||||
"sleep" => {
|
||||
std::thread::sleep(std::time::Duration::from_secs(5));
|
||||
return
|
||||
},
|
||||
"prepare-worker" => $crate::prepare_worker_entrypoint,
|
||||
"execute-worker" => $crate::execute_worker_entrypoint,
|
||||
other => panic!("unknown subcommand: {}", other),
|
||||
};
|
||||
|
||||
let mut node_version = None;
|
||||
let mut socket_path: &str = "";
|
||||
|
||||
for i in (2..args.len()).step_by(2) {
|
||||
match args[i].as_ref() {
|
||||
"--socket-path" => socket_path = args[i + 1].as_str(),
|
||||
"--node-impl-version" => node_version = Some(args[i + 1].as_str()),
|
||||
arg => panic!("Unexpected argument found: {}", arg),
|
||||
}
|
||||
}
|
||||
|
||||
entrypoint(&socket_path, node_version, None);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user