Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ec204fa
Replace async-std with tokio in PVF subsystem
mrcnski Dec 11, 2022
3abc804
Rework workers to use `select!` instead of a mutex
mrcnski Dec 13, 2022
5fcc67d
Remove unnecessary `fuse`
mrcnski Dec 13, 2022
1574561
Merge branch 'master' into m-cat/replace-async-std-pvf
mrcnski Dec 13, 2022
451fae0
Add explanation for `expect()`
mrcnski Dec 13, 2022
fc4c28b
Update node/core/pvf/src/worker_common.rs
mrcnski Dec 18, 2022
1dde78b
Update node/core/pvf/src/worker_common.rs
mrcnski Dec 18, 2022
da31a48
Address some review comments
mrcnski Dec 18, 2022
35a0c79
Merge remote-tracking branch 'origin/m-cat/replace-async-std-pvf' int…
mrcnski Dec 18, 2022
e1c2cf3
Shutdown tokio runtime
mrcnski Dec 18, 2022
077a123
Run cargo fmt
mrcnski Dec 19, 2022
e0d4b9e
Add a small note about retries
mrcnski Dec 19, 2022
2353747
Merge branch 'master' into m-cat/replace-async-std-pvf
mrcnski Dec 20, 2022
28d4062
Fix up merge
mrcnski Dec 20, 2022
3964aca
Rework `cpu_time_monitor_loop` to return when other thread finishes
mrcnski Dec 20, 2022
7057518
Add error string to PrepareError::IoErr variant
mrcnski Dec 20, 2022
e6ba098
Log when artifacts fail to prepare
mrcnski Dec 20, 2022
e094f80
Fix `cpu_time_monitor_loop`; fix test
mrcnski Dec 20, 2022
c09377a
Fix text
mrcnski Dec 20, 2022
05d1865
Fix a couple of potential minor data races.
mrcnski Dec 22, 2022
b0c2434
Merge branch 'master' into m-cat/replace-async-std-pvf
mrcnski Jan 5, 2023
5cc477c
Merge branch 'master' into m-cat/replace-async-std-pvf
mrcnski Jan 9, 2023
0f4ac06
Update Cargo.lock
mrcnski Jan 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary fuse
  • Loading branch information
mrcnski committed Dec 13, 2022
commit 5fcc67d4ee3251186c3f9dd61a3ee29ba0f4bfec
26 changes: 11 additions & 15 deletions node/core/pvf/src/execute/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,18 @@ pub fn worker_entrypoint(socket_path: &str) {

// Spawn a new thread that runs the CPU time monitor.
let finished_flag_2 = finished_flag.clone();
let thread_fut = rt_handle
.spawn_blocking(move || {
cpu_time_monitor_loop(
JobKind::Execute,
cpu_time_start,
execution_timeout,
finished_flag_2,
);
})
.fuse();
let thread_fut = rt_handle.spawn_blocking(move || {
cpu_time_monitor_loop(
JobKind::Execute,
cpu_time_start,
execution_timeout,
finished_flag_2,
);
});
let executor_2 = executor.clone();
let execute_fut = rt_handle
.spawn_blocking(move || {
validate_using_artifact(&artifact_path, &params, executor_2, cpu_time_start)
})
.fuse();
let execute_fut = rt_handle.spawn_blocking(move || {
validate_using_artifact(&artifact_path, &params, executor_2, cpu_time_start)
});

let response = select! {
// If this future is not selected, the join handle is dropped and the thread will
Expand Down
21 changes: 9 additions & 12 deletions node/core/pvf/src/prepare/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::{
LOG_TARGET,
};
use cpu_time::ProcessTime;
use futures::FutureExt;
use parity_scale_codec::{Decode, Encode};
use sp_core::hexdisplay::HexDisplay;
use std::{
Expand Down Expand Up @@ -325,17 +324,15 @@ pub fn worker_entrypoint(socket_path: &str) {

// Spawn a new thread that runs the CPU time monitor.
let finished_flag_2 = finished_flag.clone();
let thread_fut = rt_handle
.spawn_blocking(move || {
cpu_time_monitor_loop(
JobKind::Prepare,
cpu_time_start,
preparation_timeout,
finished_flag_2,
)
})
.fuse();
let prepare_fut = rt_handle.spawn_blocking(move || prepare_artifact(&code)).fuse();
let thread_fut = rt_handle.spawn_blocking(move || {
cpu_time_monitor_loop(
JobKind::Prepare,
cpu_time_start,
preparation_timeout,
finished_flag_2,
)
});
let prepare_fut = rt_handle.spawn_blocking(move || prepare_artifact(&code));

let result = select! {
// If this future is not selected, the join handle is dropped and the thread will
Expand Down