Skip to content

Commit ef98456

Browse files
committed
linting and ci fixes
1 parent 5518ddb commit ef98456

File tree

9 files changed

+44
-30
lines changed

9 files changed

+44
-30
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
on:
44
push:
55
branches: [ main, master ]
6+
tags:
7+
- "v*"
68
pull_request:
79
branches: [ main, master ]
810

@@ -17,8 +19,12 @@ jobs:
1719
- run: cargo clippy -- -D warnings
1820
- run: cargo fmt --check
1921

20-
build:
22+
release:
23+
# Only run when a tag push triggers the workflow
24+
if: startsWith(github.ref, 'refs/tags/')
2125
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write
2228
steps:
2329
- uses: actions/checkout@v4
2430
- uses: taiki-e/upload-rust-binary-action@v1
@@ -28,4 +34,4 @@ jobs:
2834
archive: $bin-$target
2935
checksum: sha256
3036
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
.DS_Store

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44
[![Crates.io](https://img.shields.io/crates/v/lazyslurm.svg)](https://crates.io/crates/lazyslurm)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66

7-
A terminal UI for [SLURM](https://slurm.schedmd.com/overview.html) job management. Like the awesome [lazygit](https://github.com/jesseduffield/lazygit) but for HPC clusters.
7+
A terminal UI for [slurm](https://slurm.schedmd.com/overview.html) job management. Like the awesome [lazygit](https://github.com/jesseduffield/lazygit) but for HPC clusters.
88

99
![LazySlurm Screenshot](screenshot.png)
1010

11+
## Why This Exists
12+
13+
Slurm's CLI is powerful but clunky for monitoring. This project gives you the lazygit experience.
14+
Built in Rust with ratatui because single binaries are beautiful on HPC systems.
15+
1116
## Features
1217

13-
- **Real-time job monitoring** - Watch your jobs as they run, with live log tailing
14-
- **Intuitive keyboard navigation** - Vim-like controls for efficiency
1518
- **Job management** - Cancel jobs, view details, and monitor resource usage
16-
- **Cross-platform** - Works on Linux, macOS, and Windows
1719
- **Single binary** - No dependencies, perfect for HPC environments
18-
- **Lightweight** - Fast startup, minimal resource usage
20+
- **Real-time job monitoring** - Watch your jobs as they run, with live log tailing
1921

2022
## Installation
2123

@@ -116,10 +118,4 @@ cargo run
116118
just slurm_populate
117119
```
118120

119-
Your source code is mounted into the container so changes are immediately available.
120-
121-
## Why This Exists
122-
123-
SLURM's CLI is powerful but clunky for monitoring. This gives you the lazygit experience: see state, take actions, see new state. Real-time updates, keyboard navigation, visual feedback.
124-
125-
Built in Rust with ratatui because single binaries are beautiful on HPC systems.
121+
Your source code is mounted into the container so changes are immediately available.

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ slurm_down:
3838
test:
3939
cargo test
4040

41+
# Lint with Clippy
42+
lint:
43+
cargo clippy -- -D warnings
4144
# Clean up everything
4245
clean:
4346
cd dev && docker-compose down -v

src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ async fn run_app(
5959

6060
// Handle events with timeout
6161
let timeout = Duration::from_millis(250);
62-
if crossterm::event::poll(timeout)? {
63-
if let Event::Key(key) = event::read()? {
62+
if crossterm::event::poll(timeout)? && let Event::Key(key) = event::read()? {
6463
// Only handle KeyEventKind::Press to avoid duplicate events
6564
if key.kind != KeyEventKind::Press {
6665
continue;
@@ -84,7 +83,6 @@ async fn run_app(
8483
}
8584
_ => {}
8685
}
87-
}
8886
}
8987

9088
// Auto refresh if needed

src/models/job.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,10 @@ impl JobList {
163163
pub fn completed_jobs(&self) -> Vec<&Job> {
164164
self.jobs.iter().filter(|job| job.is_completed()).collect()
165165
}
166-
}
166+
}
167+
168+
impl Default for JobList {
169+
fn default() -> Self {
170+
Self::new()
171+
}
172+
}

src/slurm/parser.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,8 @@ impl SlurmParser {
152152
}
153153

154154
// Secondary: Use StdErr if different
155-
if let Some(std_err) = &job.std_err {
156-
if Some(std_err) != job.std_out.as_ref() {
157-
paths.push(std_err.clone());
158-
}
155+
if let Some(std_err) = &job.std_err && Some(std_err) != job.std_out.as_ref() {
156+
paths.push(std_err.clone());
159157
}
160158

161159
// Fallback: Common SLURM default patterns in working directory
@@ -174,4 +172,4 @@ impl SlurmParser {
174172

175173
paths
176174
}
177-
}
175+
}

src/ui/app.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ impl App {
7070

7171
// For each job, get detailed info from scontrol (but only for first few to avoid overwhelming)
7272
for job in jobs.iter_mut().take(10) {
73-
if let Ok(scontrol_output) = SlurmCommands::scontrol_show_job(&job.job_id).await {
74-
if let Ok(fields) = SlurmParser::parse_scontrol_output(&scontrol_output) {
75-
SlurmParser::enhance_job_with_scontrol_data(job, fields);
76-
}
73+
if let Ok(scontrol_output) = SlurmCommands::scontrol_show_job(&job.job_id).await
74+
&& let Ok(fields) = SlurmParser::parse_scontrol_output(&scontrol_output)
75+
{
76+
SlurmParser::enhance_job_with_scontrol_data(job, fields);
7777
}
7878
}
7979

@@ -135,4 +135,10 @@ impl App {
135135
pub async fn receive_event(&mut self) -> Option<AppEvent> {
136136
self.event_receiver.recv().await
137137
}
138-
}
138+
}
139+
140+
impl Default for App {
141+
fn default() -> Self {
142+
Self::new()
143+
}
144+
}

src/ui/components.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn render_app(frame: &mut Frame, app: &App) {
5757
}
5858

5959
fn render_status_bar(frame: &mut Frame, app: &App, area: Rect) {
60-
let mut status_text = format!("LazySlurm");
60+
let mut status_text = "LazySlurm".to_string();
6161

6262
if let Some(user) = &app.current_user {
6363
status_text.push_str(&format!(" - User: {}", user));
@@ -303,4 +303,4 @@ fn truncate(s: &str, max_len: usize) -> String {
303303
} else {
304304
format!("{}...", &s[..max_len.saturating_sub(3)])
305305
}
306-
}
306+
}

0 commit comments

Comments
 (0)