Archived
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0dbbae413 | ||
|
|
215ba3845d | ||
|
|
b53b4a3287 |
No files matched your search
@@ -128,11 +128,20 @@ jobs:
|
|||||||
echo "linux_arm64_sha=$(grep barn-linux-arm64 SHA256SUMS | awk '{print $1}')" >> $GITHUB_OUTPUT
|
echo "linux_arm64_sha=$(grep barn-linux-arm64 SHA256SUMS | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||||
echo "linux_x64_sha=$(grep barn-linux-x64 SHA256SUMS | awk '{print $1}')" >> $GITHUB_OUTPUT
|
echo "linux_x64_sha=$(grep barn-linux-x64 SHA256SUMS | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Generate Homebrew tap token
|
||||||
|
uses: actions/create-github-app-token@v2
|
||||||
|
id: homebrew-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.HOMEBREW_APP_ID }}
|
||||||
|
private-key: ${{ secrets.HOMEBREW_APP_PRIVATE_KEY }}
|
||||||
|
owner: samson-media
|
||||||
|
repositories: homebrew-tap
|
||||||
|
|
||||||
- name: Checkout homebrew tap
|
- name: Checkout homebrew tap
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: samson-media/homebrew-tap
|
repository: samson-media/homebrew-tap
|
||||||
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
token: ${{ steps.homebrew-token.outputs.token }}
|
||||||
path: homebrew-tap
|
path: homebrew-tap
|
||||||
|
|
||||||
- name: Update Homebrew formula
|
- name: Update Homebrew formula
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/).
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
||||||
|
|
||||||
|
## [0.3.0] - 2026-03-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- RETRIES and NEXT RETRY columns in `barn status` human table output
|
||||||
|
- Retry At field in single job detail view (`barn describe`)
|
||||||
|
- Retry display tests for human, JSON, and XML output formats
|
||||||
|
|
||||||
## [0.1.7] - 2026-01-22
|
## [0.1.7] - 2026-01-22
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -67,6 +74,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|||||||
- Jobs that fail to start now properly transition to FAILED state
|
- Jobs that fail to start now properly transition to FAILED state
|
||||||
- Startup errors are written to stderr.log for visibility
|
- Startup errors are written to stderr.log for visibility
|
||||||
|
|
||||||
|
[0.3.0]: https://github.com/samson-media/barn/releases/tag/v0.3.0
|
||||||
[0.1.7]: https://github.com/samson-media/barn/releases/tag/v0.1.7
|
[0.1.7]: https://github.com/samson-media/barn/releases/tag/v0.1.7
|
||||||
[0.1.6]: https://github.com/samson-media/barn/releases/tag/v0.1.6
|
[0.1.6]: https://github.com/samson-media/barn/releases/tag/v0.1.6
|
||||||
[0.1.5]: https://github.com/samson-media/barn/releases/tag/v0.1.5
|
[0.1.5]: https://github.com/samson-media/barn/releases/tag/v0.1.5
|
||||||
|
|||||||
@@ -209,6 +209,8 @@ There needs to be a barn service in order to run jobs (unless you use --offline)
|
|||||||
| `error` | Human-readable failure reason |
|
| `error` | Human-readable failure reason |
|
||||||
| `pid` | OS process ID (best-effort) |
|
| `pid` | OS process ID (best-effort) |
|
||||||
| `heartbeat` | Last liveness update |
|
| `heartbeat` | Last liveness update |
|
||||||
|
| `retryCount` | Current retry attempt (0 if never retried) |
|
||||||
|
| `retryAt` | Timestamp for next retry attempt (null if not retrying)|
|
||||||
|
|
||||||
Users can tag jobs for the purpose of filtering using the `--tag=string` CLI option.
|
Users can tag jobs for the purpose of filtering using the `--tag=string` CLI option.
|
||||||
|
|
||||||
@@ -245,8 +247,8 @@ Developers can use the `--offline` command line option to test how the service b
|
|||||||
|
|
||||||
**Example: `barn status`**
|
**Example: `barn status`**
|
||||||
```
|
```
|
||||||
ID STATE LOAD TAG CREATED EXIT PID
|
ID STATE LOAD TAG CREATED EXIT PID RETRIES NEXT RETRY
|
||||||
job-6d368040 succeeded medium - 2026-01-22 01:48:46 0 17486
|
job-6d368040 succeeded medium - 2026-01-22 01:48:46 0 17486 - -
|
||||||
|
|
||||||
Total: 1 job (1 succeeded)
|
Total: 1 job (1 succeeded)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -503,6 +503,7 @@ retry_delay_seconds = 5
|
|||||||
|
|
||||||
**Expected:**
|
**Expected:**
|
||||||
- Job retries automatically
|
- Job retries automatically
|
||||||
|
- `barn status` shows retry count in **RETRIES** column and next retry time in **NEXT RETRY** column
|
||||||
- Eventually succeeds on 3rd attempt
|
- Eventually succeeds on 3rd attempt
|
||||||
- retry_count file shows retry history
|
- retry_count file shows retry history
|
||||||
|
|
||||||
@@ -523,7 +524,8 @@ retry_delay_seconds = 5
|
|||||||
|
|
||||||
**Expected:**
|
**Expected:**
|
||||||
- Job state is "failed"
|
- Job state is "failed"
|
||||||
- retry_count equals max_retries
|
- **RETRIES** column shows retry count equal to max_retries
|
||||||
|
- **NEXT RETRY** column shows `-` (no further retries)
|
||||||
- No more retry attempts
|
- No more retry attempts
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -538,7 +540,7 @@ barn status
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Expected:**
|
**Expected:**
|
||||||
- Formatted table or list
|
- Formatted table with columns: ID, STATE, LOAD, TAG, CREATED, EXIT, PID, RETRIES, NEXT RETRY
|
||||||
- Human-readable timestamps
|
- Human-readable timestamps
|
||||||
- Clear column headers
|
- Clear column headers
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.samsonmedia</groupId>
|
<groupId>com.samsonmedia</groupId>
|
||||||
<artifactId>barn</artifactId>
|
<artifactId>barn</artifactId>
|
||||||
<version>0.2.1</version>
|
<version>0.3.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Barn</name>
|
<name>Barn</name>
|
||||||
|
|||||||
@@ -135,12 +135,17 @@ public class HumanFormatter implements OutputFormatter {
|
|||||||
sb.append(" Retries: ").append(job.retryCount()).append("\n");
|
sb.append(" Retries: ").append(job.retryCount()).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (job.retryAt() != null) {
|
||||||
|
sb.append(" Retry At: ").append(formatTimestamp(job.retryAt())).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
return sb.toString().trim();
|
return sb.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatJobTable(List<Job> jobs) {
|
private String formatJobTable(List<Job> jobs) {
|
||||||
// Define columns
|
// Define columns
|
||||||
List<String> headers = List.of("ID", "STATE", "LOAD", "TAG", "CREATED", "EXIT");
|
List<String> headers = List.of(
|
||||||
|
"ID", "STATE", "LOAD", "TAG", "CREATED", "EXIT", "RETRIES", "NEXT RETRY");
|
||||||
|
|
||||||
// Convert jobs to rows
|
// Convert jobs to rows
|
||||||
List<List<String>> rows = new ArrayList<>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
@@ -151,7 +156,9 @@ public class HumanFormatter implements OutputFormatter {
|
|||||||
job.loadLevel().toString().toLowerCase(Locale.ROOT),
|
job.loadLevel().toString().toLowerCase(Locale.ROOT),
|
||||||
job.tag() != null ? job.tag() : "-",
|
job.tag() != null ? job.tag() : "-",
|
||||||
formatTimestamp(job.createdAt()),
|
formatTimestamp(job.createdAt()),
|
||||||
job.exitCode() != null ? job.exitCode().toString() : "-"
|
job.exitCode() != null ? job.exitCode().toString() : "-",
|
||||||
|
job.retryCount() > 0 ? String.valueOf(job.retryCount()) : "-",
|
||||||
|
job.retryAt() != null ? formatTimestamp(job.retryAt()) : "-"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,19 +195,23 @@ public class StatusCommand extends BaseCommand {
|
|||||||
.max().orElse(3));
|
.max().orElse(3));
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
sb.append(String.format("%-" + idWidth + "s %-9s %-6s %-" + tagWidth + "s %-19s %-4s %-8s%n",
|
sb.append(String.format(
|
||||||
"ID", "STATE", "LOAD", "TAG", "CREATED", "EXIT", "PID"));
|
"%-" + idWidth + "s %-9s %-6s %-" + tagWidth + "s %-19s %-4s %-8s %-7s %-19s%n",
|
||||||
|
"ID", "STATE", "LOAD", "TAG", "CREATED", "EXIT", "PID", "RETRIES", "NEXT RETRY"));
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
for (Job job : jobs) {
|
for (Job job : jobs) {
|
||||||
sb.append(String.format("%-" + idWidth + "s %-9s %-6s %-" + tagWidth + "s %-19s %-4s %-8s%n",
|
sb.append(String.format(
|
||||||
|
"%-" + idWidth + "s %-9s %-6s %-" + tagWidth + "s %-19s %-4s %-8s %-7s %-19s%n",
|
||||||
job.id(),
|
job.id(),
|
||||||
job.state().toString().toLowerCase(Locale.ROOT),
|
job.state().toString().toLowerCase(Locale.ROOT),
|
||||||
job.loadLevel().toString().toLowerCase(Locale.ROOT),
|
job.loadLevel().toString().toLowerCase(Locale.ROOT),
|
||||||
job.tag() != null ? job.tag() : "-",
|
job.tag() != null ? job.tag() : "-",
|
||||||
formatTimestamp(job.createdAt()),
|
formatTimestamp(job.createdAt()),
|
||||||
job.exitCode() != null ? job.exitCode().toString() : "-",
|
job.exitCode() != null ? job.exitCode().toString() : "-",
|
||||||
job.pid() != null ? job.pid().toString() : "-"));
|
job.pid() != null ? job.pid().toString() : "-",
|
||||||
|
job.retryCount() > 0 ? String.valueOf(job.retryCount()) : "-",
|
||||||
|
job.retryAt() != null ? formatTimestamp(job.retryAt()) : "-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summary
|
// Summary
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ class HumanFormatterTest {
|
|||||||
assertThat(result).contains("Process failed");
|
assertThat(result).contains("Process failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void format_withRetryingJob_shouldShowRetryInfo() {
|
||||||
|
Job job = createRetryingJob("job-retry1234", 3,
|
||||||
|
Instant.parse("2026-01-15T10:30:00Z"));
|
||||||
|
|
||||||
|
String result = formatter.format(job);
|
||||||
|
|
||||||
|
assertThat(result).contains("Retries:");
|
||||||
|
assertThat(result).contains("3");
|
||||||
|
assertThat(result).contains("Retry At:");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void format_withMap_shouldFormatKeyValues() {
|
void format_withMap_shouldFormatKeyValues() {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
@@ -127,6 +139,18 @@ class HumanFormatterTest {
|
|||||||
assertThat(result).contains("medium");
|
assertThat(result).contains("medium");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void formatList_withRetryingJob_shouldShowRetryColumns() {
|
||||||
|
List<Job> jobs = List.of(createRetryingJob("job-retry1234", 2,
|
||||||
|
Instant.parse("2026-01-15T10:30:00Z")));
|
||||||
|
|
||||||
|
String result = formatter.formatList(jobs);
|
||||||
|
|
||||||
|
assertThat(result).contains("RETRIES");
|
||||||
|
assertThat(result).contains("NEXT RETRY");
|
||||||
|
assertThat(result).contains("2");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void formatList_withStrings_shouldFormatEach() {
|
void formatList_withStrings_shouldFormatEach() {
|
||||||
List<String> strings = List.of("item1", "item2", "item3");
|
List<String> strings = List.of("item1", "item2", "item3");
|
||||||
@@ -242,4 +266,23 @@ class HumanFormatterTest {
|
|||||||
MEDIUM
|
MEDIUM
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Job createRetryingJob(String id, int retryCount, Instant retryAt) {
|
||||||
|
return new Job(
|
||||||
|
id,
|
||||||
|
JobState.QUEUED,
|
||||||
|
List.of("echo", "test"),
|
||||||
|
"tag",
|
||||||
|
Instant.now().minus(Duration.ofMinutes(5)),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
retryCount,
|
||||||
|
retryAt,
|
||||||
|
MEDIUM
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,8 @@ import java.io.IOException;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -14,6 +16,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
import com.samsonmedia.barn.config.JobsConfig;
|
import com.samsonmedia.barn.config.JobsConfig;
|
||||||
|
import com.samsonmedia.barn.jobs.Job;
|
||||||
import com.samsonmedia.barn.jobs.JobRepository;
|
import com.samsonmedia.barn.jobs.JobRepository;
|
||||||
import com.samsonmedia.barn.state.BarnDirectories;
|
import com.samsonmedia.barn.state.BarnDirectories;
|
||||||
|
|
||||||
@@ -100,6 +103,22 @@ class StatusCommandTest {
|
|||||||
assertThat(exitCode).isZero();
|
assertThat(exitCode).isZero();
|
||||||
assertThat(stdout.toString().toLowerCase()).contains("queued");
|
assertThat(stdout.toString().toLowerCase()).contains("queued");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void status_withRetryingJob_shouldShowRetryColumns() throws IOException {
|
||||||
|
Job job = repository.create(List.of("echo", "test"), "test", config);
|
||||||
|
repository.markStarted(job.id(), 12345L);
|
||||||
|
repository.markCompleted(job.id(), 1, "test failure");
|
||||||
|
Instant retryAt = Instant.now().plus(5, ChronoUnit.MINUTES);
|
||||||
|
repository.scheduleRetry(job.id(), retryAt);
|
||||||
|
|
||||||
|
int exitCode = cmd.execute("--offline");
|
||||||
|
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = stdout.toString();
|
||||||
|
assertThat(output).contains("RETRIES");
|
||||||
|
assertThat(output).contains("NEXT RETRY");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
@@ -192,8 +192,44 @@ class XmlFormatterTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
class RetryFields {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void format_withRetryingJob_shouldIncludeRetryFields() {
|
||||||
|
Job job = createRetryingJob("job-retry1234", 2,
|
||||||
|
Instant.parse("2026-01-15T10:30:00Z"));
|
||||||
|
|
||||||
|
String result = formatter.format(job);
|
||||||
|
|
||||||
|
assertThat(result).contains("<retry_count>2</retry_count>");
|
||||||
|
assertThat(result).contains("<retry_at>");
|
||||||
|
assertThat(result).contains("2026-01-15T10:30:00Z");
|
||||||
|
assertThat(result).contains("</retry_at>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Helper methods
|
// Helper methods
|
||||||
|
|
||||||
|
private Job createRetryingJob(String id, int retryCount, Instant retryAt) {
|
||||||
|
return new Job(
|
||||||
|
id,
|
||||||
|
JobState.QUEUED,
|
||||||
|
List.of("echo", "test"),
|
||||||
|
"tag",
|
||||||
|
Instant.now(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
retryCount,
|
||||||
|
retryAt,
|
||||||
|
MEDIUM
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private Job createJob(String id, JobState state, String tag) {
|
private Job createJob(String id, JobState state, String tag) {
|
||||||
return new Job(
|
return new Job(
|
||||||
id,
|
id,
|
||||||
|
|||||||
Reference in new issue
Block a user