Skip to content

Commit 10f7502

Browse files
chore: bump version to 0.1.0-alpha.2, fmt and clippy fixes
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 36b973f commit 10f7502

File tree

12 files changed

+135
-154
lines changed

12 files changed

+135
-154
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resolver = "2"
33
members = ["crates/*"]
44

55
[workspace.package]
6-
version = "0.1.0-alpha.1"
6+
version = "0.1.0-alpha.2"
77
edition = "2024"
88
rust-version = "1.85"
99
license = "MIT"

crates/charmer-core/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub mod metadata;
88

99
pub use main_log::{SnakemakeLogInfo, find_latest_log, parse_log_file, parse_main_log};
1010
pub use metadata::{
11-
IncrementalScanResult, MetadataError, SnakemakeJob, SnakemakeMetadata, decode_metadata_filename,
12-
parse_metadata_file, scan_metadata_dir, scan_metadata_dir_incremental,
11+
IncrementalScanResult, MetadataError, SnakemakeJob, SnakemakeMetadata,
12+
decode_metadata_filename, parse_metadata_file, scan_metadata_dir,
13+
scan_metadata_dir_incremental,
1314
};

crates/charmer-core/src/main_log.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,14 @@ pub fn find_latest_log(working_dir: &Utf8Path) -> Option<camino::Utf8PathBuf> {
5858
if let Ok(entries) = fs::read_dir(&log_dir) {
5959
for entry in entries.flatten() {
6060
let path = entry.path();
61-
if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
62-
if name.ends_with(".snakemake.log") {
63-
if let Ok(metadata) = entry.metadata() {
64-
if let Ok(modified) = metadata.modified() {
65-
if let Ok(utf8_path) = camino::Utf8PathBuf::try_from(path) {
66-
if latest.is_none() || modified > latest.as_ref().unwrap().0 {
67-
latest = Some((modified, utf8_path));
68-
}
69-
}
70-
}
71-
}
72-
}
61+
if let Some(name) = path.file_name().and_then(|n| n.to_str())
62+
&& name.ends_with(".snakemake.log")
63+
&& let Ok(metadata) = entry.metadata()
64+
&& let Ok(modified) = metadata.modified()
65+
&& let Ok(utf8_path) = camino::Utf8PathBuf::try_from(path)
66+
&& (latest.is_none() || modified > latest.as_ref().unwrap().0)
67+
{
68+
latest = Some((modified, utf8_path));
7369
}
7470
}
7571
}

crates/charmer-lsf/src/bhist.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,24 @@ fn parse_bhist_long_output(
8686

8787
// Parse job details from current job
8888
if let Some(ref mut job) = current_job {
89-
if line.contains("Job Name <") {
90-
if let (Some(start), Some(end)) = (line.find("Job Name <"), line.rfind(">")) {
91-
job.name = line[start + 10..end].to_string();
92-
}
89+
if line.contains("Job Name <")
90+
&& let (Some(start), Some(end)) = (line.find("Job Name <"), line.rfind(">"))
91+
{
92+
job.name = line[start + 10..end].to_string();
9393
}
94-
if line.contains("Queue <") {
95-
if let (Some(start), Some(end)) = (line.find("Queue <"), line.find(">,")) {
96-
job.queue = Some(line[start + 7..end].to_string());
97-
}
94+
if line.contains("Queue <")
95+
&& let (Some(start), Some(end)) = (line.find("Queue <"), line.find(">,"))
96+
{
97+
job.queue = Some(line[start + 7..end].to_string());
9898
}
9999
if line.starts_with("Submitted from") || line.contains("submitted from") {
100100
// Parse submit time from context - LSF format varies
101101
}
102-
if line.contains("Started on") {
103-
if let Some(host_start) = line.find("Started on <") {
104-
if let Some(host_end) = line[host_start..].find(">,") {
105-
job.exec_host =
106-
Some(line[host_start + 12..host_start + host_end].to_string());
107-
}
108-
}
102+
if line.contains("Started on")
103+
&& let Some(host_start) = line.find("Started on <")
104+
&& let Some(host_end) = line[host_start..].find(">,")
105+
{
106+
job.exec_host = Some(line[host_start + 12..host_start + host_end].to_string());
109107
}
110108
if line.contains("Done successfully") {
111109
job.state = LsfJobState::Done {
@@ -124,11 +122,11 @@ fn parse_bhist_long_output(
124122
error: String::new(),
125123
};
126124
}
127-
if line.contains("MAX MEM:") {
128-
if let Some(mem_str) = line.split("MAX MEM:").nth(1) {
129-
let mem_part = mem_str.trim().split(';').next().unwrap_or("");
130-
job.mem_used_mb = parse_memory_mb(mem_part, MemoryFormat::Lsf);
131-
}
125+
if line.contains("MAX MEM:")
126+
&& let Some(mem_str) = line.split("MAX MEM:").nth(1)
127+
{
128+
let mem_part = mem_str.trim().split(';').next().unwrap_or("");
129+
job.mem_used_mb = parse_memory_mb(mem_part, MemoryFormat::Lsf);
132130
}
133131
}
134132
}

crates/charmer-lsf/src/failure.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ fn parse_lsf_time_from_line(line: &str) -> Option<u64> {
315315
// Look for "N seconds" pattern
316316
if let Some(idx) = line.find("seconds") {
317317
let before = line[..idx].trim();
318-
if let Some(num_str) = before.split_whitespace().last() {
319-
if let Ok(secs) = num_str.parse::<u64>() {
320-
return Some(secs);
321-
}
318+
if let Some(num_str) = before.split_whitespace().last()
319+
&& let Ok(secs) = num_str.parse::<u64>()
320+
{
321+
return Some(secs);
322322
}
323323
}
324324
None

crates/charmer-monitor/src/app.rs

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -538,16 +538,14 @@ impl App {
538538
if let Ok(entries) = std::fs::read_dir(&log_dir) {
539539
for entry in entries.flatten() {
540540
let path = entry.path();
541-
if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
542-
if name.ends_with(".snakemake.log") {
543-
if let Ok(metadata) = entry.metadata() {
544-
if let Ok(modified) = metadata.modified() {
545-
let path_str = path.to_string_lossy().to_string();
546-
if latest.is_none() || modified > latest.as_ref().unwrap().0 {
547-
latest = Some((modified, path_str));
548-
}
549-
}
550-
}
541+
if let Some(name) = path.file_name().and_then(|n| n.to_str())
542+
&& name.ends_with(".snakemake.log")
543+
&& let Ok(metadata) = entry.metadata()
544+
&& let Ok(modified) = metadata.modified()
545+
{
546+
let path_str = path.to_string_lossy().to_string();
547+
if latest.is_none() || modified > latest.as_ref().unwrap().0 {
548+
latest = Some((modified, path_str));
551549
}
552550
}
553551
}
@@ -603,11 +601,9 @@ impl App {
603601
let log_path = state.log_path.clone();
604602
let follow = state.follow_mode;
605603
self.log_viewer_state = Some(LogViewerState::new(log_path, 1000));
606-
if follow {
607-
if let Some(ref mut new_state) = self.log_viewer_state {
608-
new_state.follow_mode = true;
609-
new_state.scroll_to_bottom();
610-
}
604+
if follow && let Some(ref mut new_state) = self.log_viewer_state {
605+
new_state.follow_mode = true;
606+
new_state.scroll_to_bottom();
611607
}
612608
}
613609
}
@@ -618,12 +614,11 @@ impl App {
618614
self.update_job_list();
619615

620616
// Refresh log viewer if in follow mode
621-
if self.show_log_viewer {
622-
if let Some(ref state) = self.log_viewer_state {
623-
if state.follow_mode {
624-
self.refresh_log_viewer();
625-
}
626-
}
617+
if self.show_log_viewer
618+
&& let Some(ref state) = self.log_viewer_state
619+
&& state.follow_mode
620+
{
621+
self.refresh_log_viewer();
627622
}
628623
}
629624

@@ -741,11 +736,11 @@ impl App {
741736

742737
/// Poll for events and handle them.
743738
pub fn poll_events(&mut self, timeout: Duration) -> std::io::Result<bool> {
744-
if event::poll(timeout)? {
745-
if let Event::Key(key) = event::read()? {
746-
self.handle_key(key);
747-
return Ok(true);
748-
}
739+
if event::poll(timeout)?
740+
&& let Event::Key(key) = event::read()?
741+
{
742+
self.handle_key(key);
743+
return Ok(true);
749744
}
750745
Ok(false)
751746
}

crates/charmer-monitor/src/components/header.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,18 @@ impl Header {
7676
spans.push(Span::styled(dir_display, Style::default().fg(Color::White)));
7777

7878
// ETA (only if running and available)
79-
if let Some(eta) = state.eta_string() {
80-
if !state.pipeline_finished && state.pipeline_errors.is_empty() {
81-
spans.push(sep.clone());
82-
spans.push(Span::styled("ETA: ", Style::default().fg(Color::Gray)));
83-
spans.push(Span::styled(
84-
eta,
85-
Style::default()
86-
.fg(Color::Yellow)
87-
.add_modifier(Modifier::BOLD),
88-
));
89-
}
79+
if let Some(eta) = state.eta_string()
80+
&& !state.pipeline_finished
81+
&& state.pipeline_errors.is_empty()
82+
{
83+
spans.push(sep.clone());
84+
spans.push(Span::styled("ETA: ", Style::default().fg(Color::Gray)));
85+
spans.push(Span::styled(
86+
eta,
87+
Style::default()
88+
.fg(Color::Yellow)
89+
.add_modifier(Modifier::BOLD),
90+
));
9091
}
9192

9293
spans.push(sep.clone());

crates/charmer-monitor/src/components/job_detail.rs

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -576,45 +576,43 @@ fn build_detail_lines(job: &Job, command_expanded: bool) -> Vec<Line<'static>> {
576576
]));
577577

578578
// Memory details for OOM
579-
if analysis.mode == FailureMode::OutOfMemory {
580-
if let (Some(used), Some(limit)) =
579+
if analysis.mode == FailureMode::OutOfMemory
580+
&& let (Some(used), Some(limit)) =
581581
(analysis.memory_used_mb, analysis.memory_limit_mb)
582-
{
583-
lines.push(Line::from(vec![
584-
Span::styled(" Memory: ", Style::default().fg(Color::Gray)),
585-
Span::styled(
586-
format!("{:.1} GB", used as f64 / 1024.0),
587-
Style::default().fg(Color::Red).add_modifier(Modifier::BOLD),
588-
),
589-
Span::styled(" / ", Style::default().fg(Color::Gray)),
590-
Span::styled(
591-
format!("{:.1} GB limit", limit as f64 / 1024.0),
592-
Style::default().fg(Color::Gray),
593-
),
594-
]));
595-
}
582+
{
583+
lines.push(Line::from(vec![
584+
Span::styled(" Memory: ", Style::default().fg(Color::Gray)),
585+
Span::styled(
586+
format!("{:.1} GB", used as f64 / 1024.0),
587+
Style::default().fg(Color::Red).add_modifier(Modifier::BOLD),
588+
),
589+
Span::styled(" / ", Style::default().fg(Color::Gray)),
590+
Span::styled(
591+
format!("{:.1} GB limit", limit as f64 / 1024.0),
592+
Style::default().fg(Color::Gray),
593+
),
594+
]));
596595
}
597596

598597
// Time details for Timeout
599-
if analysis.mode == FailureMode::Timeout {
600-
if let (Some(runtime), Some(limit)) =
598+
if analysis.mode == FailureMode::Timeout
599+
&& let (Some(runtime), Some(limit)) =
601600
(analysis.runtime_seconds, analysis.time_limit_seconds)
602-
{
603-
lines.push(Line::from(vec![
604-
Span::styled(" Time: ", Style::default().fg(Color::Gray)),
605-
Span::styled(
606-
format_seconds(runtime),
607-
Style::default()
608-
.fg(Color::Yellow)
609-
.add_modifier(Modifier::BOLD),
610-
),
611-
Span::styled(" / ", Style::default().fg(Color::Gray)),
612-
Span::styled(
613-
format!("{} limit", format_seconds(limit)),
614-
Style::default().fg(Color::Gray),
615-
),
616-
]));
617-
}
601+
{
602+
lines.push(Line::from(vec![
603+
Span::styled(" Time: ", Style::default().fg(Color::Gray)),
604+
Span::styled(
605+
format_seconds(runtime),
606+
Style::default()
607+
.fg(Color::Yellow)
608+
.add_modifier(Modifier::BOLD),
609+
),
610+
Span::styled(" / ", Style::default().fg(Color::Gray)),
611+
Span::styled(
612+
format!("{} limit", format_seconds(limit)),
613+
Style::default().fg(Color::Gray),
614+
),
615+
]));
618616
}
619617

620618
// Explanation

crates/charmer-monitor/src/components/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ pub mod view_tabs;
1111
pub use footer::Footer;
1212
pub use header::Header;
1313
pub use job_detail::JobDetail;
14-
pub use job_list::{
15-
ChainPosition, DepRelation, DependencyCache, JobList, compute_dependencies,
16-
};
14+
pub use job_list::{ChainPosition, DepRelation, DependencyCache, JobList, compute_dependencies};
1715
pub use log_viewer::{LogViewer, LogViewerState};
1816
pub use rule_summary::RuleSummary;
1917
pub use view_tabs::ViewTabs;

crates/charmer-runs/src/types.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@ use chrono::{DateTime, Utc};
33
use serde::{Deserialize, Serialize};
44

55
/// Status of a pipeline run.
6-
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
6+
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
77
pub enum RunStatus {
88
Running,
99
Completed,
1010
Failed,
11+
#[default]
1112
Unknown,
1213
}
1314

14-
impl Default for RunStatus {
15-
fn default() -> Self {
16-
Self::Unknown
17-
}
18-
}
19-
2015
/// Information about a single pipeline run.
2116
#[derive(Debug, Clone, Serialize, Deserialize)]
2217
pub struct RunInfo {

0 commit comments

Comments
 (0)