pueue/README.md

262 lines
14 KiB
Markdown
Raw Permalink Normal View History

2019-12-16 17:11:33 +00:00
# Pueue
2024-01-27 22:00:30 +00:00
[![Test Build](https://github.com/Nukesor/pueue/actions/workflows/test.yml/badge.svg)](https://github.com/Nukesor/pueue/actions/workflows/test.yml)
[![Crates.io](https://img.shields.io/crates/v/pueue)](https://crates.io/crates/pueue)
2020-05-13 20:23:47 +00:00
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2020-05-13 20:26:26 +00:00
[![Downloads](https://img.shields.io/github/downloads/nukesor/pueue/total.svg)](https://github.com/nukesor/pueue/releases)
2022-06-23 00:38:39 +00:00
[![codecov](https://codecov.io/gh/nukesor/pueue/branch/main/graph/badge.svg)](https://codecov.io/gh/nukesor/pueue)
2019-12-16 17:11:33 +00:00
2022-02-02 00:57:08 +00:00
![Pueue](https://raw.githubusercontent.com/Nukesor/images/main/pueue-v2.0.0.gif)
2019-12-16 17:11:33 +00:00
2020-10-18 16:18:13 +00:00
Pueue is a command-line task management tool for sequential and parallel execution of long-running tasks.
2019-12-17 02:41:24 +00:00
2022-02-18 16:55:09 +00:00
Simply put, it's a tool that **p**rocesses a q**ueue** of shell commands.
2021-02-14 22:56:43 +00:00
On top of that, there are a lot of convenient features and abstractions.
2019-12-16 17:11:33 +00:00
2019-12-17 02:41:24 +00:00
Since Pueue is not bound to any terminal, you can control your tasks from any terminal on the same machine.
2020-10-26 09:26:33 +00:00
The queue will be continuously processed, even if you no longer have any active ssh sessions.
2019-12-16 17:11:33 +00:00
2023-08-18 09:03:37 +00:00
**Pueue is considered feature-complete :tada:.**
All features that were planned have been added and only minor improvements, bug-fixes and regular maintenance work will get merged.
2020-10-25 14:04:32 +00:00
- [Features](https://github.com/Nukesor/pueue#features)
- [Installation](https://github.com/Nukesor/pueue#installation)
- [How to use it](https://github.com/Nukesor/pueue#how-to-use-it)
2021-02-12 11:07:47 +00:00
- [Similar Projects](https://github.com/Nukesor/pueue#similar-projects)
2021-12-11 23:00:42 +00:00
- [Design Goals](https://github.com/Nukesor/pueue#design-goals)
- [Contributing](https://github.com/Nukesor/pueue#contributing)
2020-10-25 14:04:32 +00:00
2021-12-11 23:00:42 +00:00
## Features
2020-06-04 16:46:03 +00:00
2021-02-12 11:07:47 +00:00
- Scheduling
2024-05-12 10:13:08 +00:00
- Add tasks as you go.
- Run multiple tasks at once. You decide how many tasks should run concurrently.
- Change the order of the scheduled tasks.
- Specify dependencies between tasks.
- Schedule tasks to run at a specific time.
2021-02-12 11:07:47 +00:00
- Process interaction
2024-05-12 10:13:08 +00:00
- Easy output inspection.
- Send input to running processes.
- Pause/resume tasks, when you need some processing power right NOW!
2021-02-12 11:07:47 +00:00
- Task groups (multiple queues)
2024-05-12 10:13:08 +00:00
- Each group can have several tasks running in parallel.
- Pause/start tasks by a group.
2021-02-12 11:07:47 +00:00
- Background process execution
2024-05-12 10:13:08 +00:00
- The `pueued` daemon runs in the background. No need to be logged in.
- Commands are executed in their respective working directories.
- The current environment variables are copied when adding a task.
- Commands are run in a shell which allows the full feature set of shell coding.
2021-02-12 11:07:47 +00:00
- Consistency
2024-05-12 10:13:08 +00:00
- The queue is always saved to disk and restored on kill/system crash.
- Logs are persisted onto the disk and survive a crash.
2021-02-12 11:07:47 +00:00
- Miscellaneous
2024-05-12 10:13:08 +00:00
- A callback hook to, for instance, set up desktop notifications.
- JSON output for `log` and `status` if you want to display info about tasks in another program.
- A `wait` subcommand to wait for specific tasks, a group (or everything) to finish.
2020-09-10 11:41:21 +00:00
- A lot more. Check the -h options for each subcommand for detailed options.
- Cross Platform
2024-05-12 10:13:08 +00:00
- Linux is fully supported and battle-tested.
- MacOS is fully supported and on par with Linux.
- Windows is fully supported and working fine for quite a while.
2021-12-11 23:00:42 +00:00
- [Why should I use it](https://github.com/Nukesor/pueue/wiki/FAQ#why-should-i-use-it)
- [Advantages over Using a Terminal Multiplexer](https://github.com/Nukesor/pueue/wiki/FAQ#advantages-over-using-a-terminal-multiplexer)
2020-09-10 11:41:21 +00:00
2023-05-22 15:02:07 +00:00
## What Pueue is **not**
2024-05-12 10:13:08 +00:00
Pueue is **not** designed to be a heavy-duty programmable (scriptable) task scheduler/executor.
2023-05-22 15:02:07 +00:00
The focus of `pueue` lies on human interaction, i.e. it's supposed to be used by a real person on some kind of OS.
See [the Design Goals section](#design-goals)
Due to this, the feature set of `pueue` and `pueued` as well as their implementation and architecture have been kept simple by design!
Even though it can be scripted to some degree, it hasn't been built for this and there's no official support!
There's definitely the need for a complex task scheduler/executor with advanced API access and scheduling options, but this is the job for another project, as this is not what pueue has been built for.
2020-06-04 16:46:03 +00:00
## Installation
2019-12-16 17:11:33 +00:00
There are a few different ways to install Pueue.
2019-12-16 17:11:33 +00:00
2020-08-19 08:11:42 +00:00
#### Package Manager
2020-08-19 08:12:00 +00:00
<a href="https://repology.org/project/pueue/versions"><img align="right" src="https://repology.org/badge/vertical-allrepos/pueue.svg?exclude_unsupported=1" alt="Packaging status"></a>
2020-12-14 02:03:47 +00:00
2023-05-22 15:02:07 +00:00
The preferred way to install Pueue is to use your system's package manager.
This will usually deploy service files and completions automatically.
2020-01-19 16:37:25 +00:00
2021-02-14 22:56:43 +00:00
Pueue has been packaged for quite a few distributions, check the table on the right for more information.
2020-02-12 21:59:02 +00:00
2020-08-19 08:11:42 +00:00
#### Prebuild Binaries
2020-12-29 02:59:57 +00:00
Statically linked (if possible) binaries for Linux (incl. ARM), Mac OS and Windows are built on each release. \
You can download the binaries for the client and the daemon (`pueue` and `pueued`) for each release on the [release page](https://github.com/Nukesor/pueue/releases). \
2024-05-12 10:13:08 +00:00
Just download both binaries for your system, rename them to `pueue` and `pueued` and place them in your `$PATH`/program folder.
2020-07-19 13:45:36 +00:00
2020-08-19 08:11:42 +00:00
#### Via Cargo
2020-08-19 08:12:00 +00:00
2020-12-29 02:59:57 +00:00
Pueue is built for the current `stable` Rust version.
It might compile on older versions, but this isn't tested or officially supported.
2020-06-04 16:46:03 +00:00
```bash
cargo install --locked pueue
2020-01-19 16:38:16 +00:00
```
2020-06-04 16:46:03 +00:00
2021-01-20 18:43:39 +00:00
This will install Pueue to `$CARGO_HOME/bin/pueue` (default is `~/.cargo/bin/pueue`)
2020-01-19 16:37:25 +00:00
2021-12-11 23:00:42 +00:00
#### From Source
2020-08-19 08:12:00 +00:00
2020-12-29 02:59:57 +00:00
Pueue is built for the current `stable` Rust version.
It might compile on older versions, but this isn't tested or officially supported.
2020-06-04 16:46:03 +00:00
```bash
2020-01-19 16:37:25 +00:00
git clone git@github.com:Nukesor/pueue
cd pueue
2022-12-27 01:40:23 +00:00
cargo build --release --locked --path ./pueue
2020-01-19 16:37:25 +00:00
```
2020-06-04 16:46:03 +00:00
The final binaries will be located in `target/release/{pueue,pueued}`.
2019-12-16 17:11:33 +00:00
2021-12-11 23:00:42 +00:00
## How to Use it
2019-12-16 17:11:33 +00:00
Check the wiki to [get started](https://github.com/Nukesor/pueue/wiki/Get-started) :).
2020-08-07 10:37:13 +00:00
2020-10-25 14:09:46 +00:00
There are also detailed sections for (hopefully) every important feature:
2020-08-07 10:37:13 +00:00
2020-10-25 14:04:32 +00:00
- [Configuration](https://github.com/Nukesor/pueue/wiki/Configuration)
- [Groups](https://github.com/Nukesor/pueue/wiki/Groups)
2024-04-10 22:39:05 +00:00
- [Advanced usage](https://github.com/Nukesor/pueue/wiki/Advanced-usage)
2020-10-25 14:04:32 +00:00
- [Connect to remote](https://github.com/Nukesor/pueue/wiki/Connect-to-remote)
2020-10-25 14:04:32 +00:00
On top of that, there is a help option (-h) for all commands.
2020-06-04 16:46:03 +00:00
```text
2019-12-16 17:11:33 +00:00
Interact with the Pueue daemon
Usage: pueue [OPTIONS] [COMMAND]
Commands:
add Enqueue a task for execution.
There're many different options when scheduling a task.
Check the individual option help texts for more information.
Furthermore, please remember that scheduled commands are executed via your system shell.
This means that the command needs proper shell escaping.
The safest way to preserve shell escaping is to surround your command with quotes, for example:
pueue add 'ls $HOME && echo "Some string"'
remove Remove tasks from the list. Running or paused tasks need to be killed first
switch Switches the queue position of two commands. Only works on queued and stashed commands
stash Stashed tasks won't be automatically started. You have to enqueue them or start them by hand
enqueue Enqueue stashed tasks. They'll be handled normally afterwards
start Resume operation of specific tasks or groups of tasks.
2022-02-02 00:57:08 +00:00
By default, this resumes the default group and all its tasks.
Can also be used force-start specific tasks.
restart Restart failed or successful task(s).
By default, identical tasks will be created and enqueued, but it's possible to restart in-place.
You can also edit a few properties, such as the path and the command, before restarting.
pause Either pause running tasks or specific groups of tasks.
By default, pauses the default group and all its tasks.
A paused queue (group) won't start any new tasks.
kill Kill specific running tasks or whole task groups..
Kills all tasks of the default group when no ids or a specific group are provided.
send Send something to a task. Useful for sending confirmations such as 'y\n'
edit Edit the command, path or label of a stashed or queued task.
By default only the command is edited.
Multiple properties can be added in one go.
group Use this to add or remove groups.
By default, this will simply display all known groups.
status Display the current status of all tasks
format-status Accept a list or map of JSON pueue tasks via stdin and display it just like "pueue status".
A simple example might look like this:
pueue status --json | jq -c '.tasks' | pueue format-status
log Display the log output of finished tasks.
Only the last few lines will be shown by default.
If you want to follow the output of a task, please use the "follow" subcommand.
follow Follow the output of a currently running task. This command works like "tail -f"
wait Wait until tasks are finished.
By default, this will wait for all tasks in the default group to finish.
Note: This will also wait for all tasks that aren't somehow 'Done'.
Includes: [Paused, Stashed, Locked, Queued, ...]
clean Remove all finished tasks from the list
reset Kill all tasks, clean up afterwards and reset EVERYTHING!
shutdown Remotely shut down the daemon. Should only be used if the daemon isn't started by a service manager
parallel Set the amount of allowed parallel tasks
By default, adjusts the amount of the default group.
No tasks will be stopped, if this is lowered.
This limit is only considered when tasks are scheduled.
completions Generates shell completion files. This can be ignored during normal operations
help Print this message or the help of the given subcommand(s)
Options:
-v, --verbose... Verbose mode (-v, -vv, -vvv)
--color <COLOR> Colorize the output; auto enables color output when connected to a tty [default: auto] [possible values: auto, never, always]
-c, --config <CONFIG> If provided, Pueue only uses this config file. This path can also be set via the "PUEUE_CONFIG_PATH" environment variable. The commandline option overwrites the environment variable!
-p, --profile <PROFILE> The name of the profile that should be loaded from your config file
-h, --help Print help
-V, --version Print version
2019-12-16 17:11:33 +00:00
```
2021-12-11 23:00:42 +00:00
## Design Goals
2021-12-11 23:00:42 +00:00
Pueue is designed to be a convenient helper tool for a single user.
It's supposed to work stand-alone and without any external integration.
2021-12-11 23:00:42 +00:00
The idea is to keep it simple and to prevent feature creep.
2023-08-18 09:03:37 +00:00
Also, **Pueue is considered feature-complete :tada:.**
All features that were planned have been added and only minor improvements, bug-fixes and regular maintenance work will get merged.
2023-11-19 08:25:52 +00:00
For the record, the following features weren't included as they're out of scope:
2021-12-11 23:00:42 +00:00
- Distributed task management/execution.
- Multi-user task management.
- Sophisticated task scheduling for optimal load balancing.
- Tight system integration or integration with external tools.
2023-05-22 15:02:07 +00:00
- Explicit support for scripting.
If you're adamant about scripting it anyway, take a look at the `pueue-lib` library, which provides proper API calls for `pueued`.
However, keep in mind that `pueued` is still supposed to be a minimalistic task executor with as little scheduling logic as possible.
2023-08-18 09:03:37 +00:00
There seems to be the need for some project that satisfies all these points mentioned above, but that will be the job of another tool.
I very much encourage forking Pueue and I would love to see forks grow into other cool projects!
2021-02-12 11:07:47 +00:00
## Similar Projects
2023-11-23 00:47:50 +00:00
#### slurm
[Slurm](https://slurm.schedmd.com/overview.html) is a feature rich and widely used cluster management and scheduling system.
If you find yourself in the need for complex setups such as multiple worker pools or distributed nodes, slurm will be much better suited than Pueue.
2023-08-18 09:03:37 +00:00
#### GNU Parallel
2022-05-25 18:17:37 +00:00
2023-11-19 08:25:52 +00:00
A robust and featureful parallel processor with text-based joblog and n-retries. [GNU Parallel](https://www.gnu.org/software/parallel/parallel_tutorial.html) is able to scale to multi-host parallelization and has complex code to have deep integration across different tools and shells, as well as other advanced features. `Pueue` differentiates itself from GNU Parallel by focusing more on visibility across many different long running commands, and creating a central location for commands to be stored, rather than GNU Parallel's focus on chunking a specific task.
2022-05-25 18:17:37 +00:00
2024-06-01 10:15:28 +00:00
#### Pm2
[pm2](https://pm2.keymetrics.io/docs/usage/quick-start/) is a process management tool, whose focus is more on management of recurring and long-living tasks.
It seems to be quite mature and has a rich interface.
2023-08-18 09:03:37 +00:00
#### nq
2021-02-12 11:07:47 +00:00
2021-02-12 11:11:18 +00:00
A very lightweight job queue systems which require no setup, maintenance, supervision, or any long-running processes. \
[Link to project](https://github.com/leahneukirchen/nq)
2021-02-12 11:07:47 +00:00
2023-08-18 09:03:37 +00:00
#### task-spooler
2021-02-12 11:07:47 +00:00
2021-02-12 11:11:18 +00:00
_task spooler_ is a Unix batch system where the tasks spooled run one after the other. \
2021-02-12 11:07:47 +00:00
Links to [ubuntu manpage](http://manpages.ubuntu.com/manpages/xenial/man1/tsp.1.html) and a [fork on Github](https://github.com/xenogenesi/task-spooler).
The original website seems to be down.
2020-10-24 18:03:44 +00:00
## Contributing
2020-05-30 13:15:21 +00:00
Feature requests and pull requests are very much appreciated and welcome!
Anyhow, please talk to me a bit about your ideas before you start hacking!
It's always nice to know what you're working on and I might have a few suggestions or tips :)
Depending on the type of your contribution, you should branch of from the `main` branch.
Pueue is mature enough to no longer need a `development` branch and all changes are collected on there before a new release is pushed.
Urgent hotfixes might get deployed on a separate branch, but this will be decided on a case-by-case basis.
There's also the [Architecture Guide](https://github.com/Nukesor/pueue/blob/main/docs/Architecture.md), which is supposed to give you a brief overview and introduction to the project.
2020-05-30 13:15:21 +00:00
2024-05-12 10:13:08 +00:00
Copyright © 2019 Arne Beer ([@Nukesor](https://github.com/Nukesor))