Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sysinfo requirement from 0.30.12 to 0.31.2 #6182

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion parquet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ hashbrown = { version = "0.14", default-features = false }
twox-hash = { version = "1.6", default-features = false }
paste = { version = "1.0" }
half = { version = "2.1", default-features = false, features = ["num-traits"] }
sysinfo = { version = "0.30.12", optional = true, default-features = false }
sysinfo = { version = "0.31.2", optional = true, default-features = false, features = ["system"] }

[dev-dependencies]
base64 = { version = "0.22", default-features = false, features = ["std"] }
Expand Down
14 changes: 11 additions & 3 deletions parquet/examples/write_parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use parquet::arrow::ArrowWriter as ParquetWriter;
use parquet::basic::Encoding;
use parquet::errors::Result;
use parquet::file::properties::{BloomFilterPosition, WriterProperties};
use sysinfo::{MemoryRefreshKind, Pid, ProcessRefreshKind, RefreshKind, System};
use sysinfo::{MemoryRefreshKind, ProcessRefreshKind, ProcessesToUpdate, RefreshKind, System};

#[derive(ValueEnum, Clone)]
enum BloomFilterPositionArg {
Expand Down Expand Up @@ -61,8 +61,16 @@ fn now() -> String {
}

fn mem(system: &mut System) -> String {
let pid = Pid::from(std::process::id() as usize);
system.refresh_process_specifics(pid, ProcessRefreshKind::new().with_memory());
let pid = match sysinfo::get_current_pid() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the example to use the new sysinfo API, and double checked it still works on my mac by running:

andrewlamb@Andrews-MacBook-Pro-2:~/Software/arrow-rs$ cargo run --example write_parquet --all-features -- /tmp/foo.parquet
    Blocking waiting for file lock on build directory
   Compiling pyo3-build-config v0.22.2
   Compiling pyo3-ffi v0.22.2
   Compiling pyo3 v0.22.2
   Compiling arrow v52.2.0 (/Users/andrewlamb/Software/arrow-rs/arrow)
   Compiling parquet v52.2.0 (/Users/andrewlamb/Software/arrow-rs/parquet)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.16s
     Running `target/debug/examples/write_parquet /tmp/foo.parquet`
2024-08-02 09:58:29 Writing 1000 batches of 1000000 rows. RSS = 6MB
2024-08-02 09:58:40 Iteration 19/1000. RSS = 281MB
2024-08-02 09:58:50 Iteration 38/1000. RSS = 327MB
2024-08-02 09:59:00 Iteration 57/1000. RSS = 360MB
...

Ok(pid) => pid,
Err(e) => return format!("Can't get process PID: {e}"),
};

system.refresh_processes_specifics(
ProcessesToUpdate::Some(&[pid]),
ProcessRefreshKind::everything(),
);

system
.process(pid)
.map(|proc| format!("{}MB", proc.memory() / 1_000_000))
Expand Down
Loading