Skip to content
Open
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
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,50 @@ cl5n013 | 1 threads | 356 GB
```


# mqlog
`mqlog` prints the stdout and stderr of a finished PBS job, so you don't have to hunt down the `.OU`/`.ER` files yourself. With no arguments it shows the most recently finished job belonging to you, working out the log paths from `qstat` (including the per-job `<jobid>.OU` / `<jobid>.ER` files that `mqsub --segregated-log-files` writes into a directory). If the newest finished job left no log behind, it walks back through your finished jobs until it finds one that did and prints a warning saying which job it is actually showing:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Correct the claimed completion-time ordering

When finished jobs complete out of submission order, this does not necessarily show the most recently finished job: get_finished_job_ids() sorts IDs numerically, so a newer, long-running job can finish after a higher-numbered short job yet lose selection. Describe this as the highest-numbered finished job, or change the implementation to order by an actual completion timestamp.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document the 400-job fallback limit

For users with more than 400 finished jobs, the fallback does not always walk backward until it finds a log: iter_job_info() stops at MAX_JOBS_SCANNED = 400. If those 400 jobs have no remaining logs but an older job does, mqlog exits with “No finished jobs with log files found,” contrary to this promise; qualify the fallback limit or remove the cap.

Useful? React with 👍 / 👎.

```
mqlog
```
```
WARNING: Most recent finished job 9524871.aqua has no log file. Showing log from 9524870.aqua.

===== STDOUT: /work/microbiome/user/logs/9524870.aqua.OU =====
Processing sample 12 of 12
===== STDERR: /work/microbiome/user/logs/9524870.aqua.ER =====
```

To look at a specific job rather than the most recent one, pass its job ID. A bare number is fine — `.aqua` is appended automatically — so these are equivalent:
```
mqlog 9524870
mqlog 9524870.aqua
```

`-f` (`--failed`) skips over jobs that succeeded and shows the most recent job that exited non-zero, which is usually the one you want after a batch of `mqsub`s. It reports which job it picked, and cannot be combined with an explicit job ID:
```
mqlog -f
```
```
Showing logs from failed job 9524863.aqua.

===== STDOUT: /work/microbiome/user/logs/9524863.aqua.OU =====
...
```

By default both streams are printed with `===== STDOUT: ... =====` headers separating them. Use `-e` (`--stderr`) to print only stderr, or `-o` (`--stdout`) for only stdout; with a single stream the headers are omitted so the output is clean to pipe or grep. These two options are mutually exclusive, and combine with a job ID or with `-f`:
```
mqlog -e # stderr of the most recent finished job
mqlog -e 9524870 # stderr of a particular job
mqlog -e -f # stderr of the most recent failed job
```

Output is paged through `less -RF` when writing to a terminal, meaning short logs are printed inline and left on screen while longer ones open in the pager. Set `$PAGER` to use a different pager (or to the empty string for none), pass `--no-pager` to disable it for one invocation, or simply pipe the output — paging is skipped automatically when stdout is not a terminal:
```
mqlog --no-pager
mqlog -e 9524870 | grep -i error
```


# mqwait
If you are running a batch of jobs, you may wish to be notified once the entire batch has finished processing, as opposed to per-job notifications generated by mqsub. There are three ways to run mqwait:

Expand Down
Loading