mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +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:
@@ -100,10 +100,6 @@ mod worker_intf;
|
||||
#[cfg(feature = "test-utils")]
|
||||
pub mod testing;
|
||||
|
||||
// Used by `decl_puppet_worker_main!`.
|
||||
#[cfg(feature = "test-utils")]
|
||||
pub use sp_tracing;
|
||||
|
||||
pub use error::{InvalidCandidate, ValidationError};
|
||||
pub use host::{start, Config, ValidationHost, EXECUTE_BINARY_NAME, PREPARE_BINARY_NAME};
|
||||
pub use metrics::Metrics;
|
||||
@@ -117,11 +113,5 @@ pub use polkadot_node_core_pvf_common::{
|
||||
pvf::PvfPrepData,
|
||||
};
|
||||
|
||||
// Re-export worker entrypoints.
|
||||
#[cfg(feature = "test-utils")]
|
||||
pub use polkadot_node_core_pvf_execute_worker::worker_entrypoint as execute_worker_entrypoint;
|
||||
#[cfg(feature = "test-utils")]
|
||||
pub use polkadot_node_core_pvf_prepare_worker::worker_entrypoint as prepare_worker_entrypoint;
|
||||
|
||||
/// The log target for this crate.
|
||||
pub const LOG_TARGET: &str = "parachain::pvf";
|
||||
|
||||
@@ -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