update: Pueue-lib v0.18.1

This commit is contained in:
Arne Beer 2021-09-15 20:16:13 +02:00
parent d49ba22865
commit c02286bb5b
No known key found for this signature in database
GPG key ID: CC9408F679023B65
16 changed files with 92 additions and 51 deletions

View file

@ -4,20 +4,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.0] -
### Feature
- Add the `--working-directory` parameter to the `pueue add` command [#227](https://github.com/Nukesor/pueue/issues/227).
## [1.0.2] - 12-09-2021
## [1.0.3] - 2021-09-15
### Fix
- Settings weren't always read on daemon restart.
- The `default` group wasn't created, if the `pueue.yml` config file didn't contain it. [#242](https://github.com/Nukesor/pueue/issues/242).
This lead to crashes and undefined behavior in the daemon and the client.
This bug was introduced in `1.0.0` due to changes to the internal datastructures and several added features.
It only popped up now, due to [#236](https://github.com/Nukesor/pueue/issues/236) being fixed, as the config is now being correctly used.
This only affects users with quite old pueue configs or custom config files.
## [1.0.2] - 2021-09-12
### Feature
This feature wasn't supposed to be added to v1.0.2 and breaks semantic versioning.
I'm still getting used to this, sorry for any inconveniences.
- Add the `--working-directory` parameter to the `pueue add` command [#227](https://github.com/Nukesor/pueue/issues/227).
### Fix
- Settings weren't always read on daemon restart. [#236](https://github.com/Nukesor/pueue/issues/236).
This bug was introduced in `1.0.0` due to large-scale refactorings and insufficient testing.
## [1.0.1] - 20-08-2021
## [1.0.1] - 2021-08-20
### Fix
@ -25,7 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
A beta upgrade seems to be handled like a patch version in semantic versioning.
This isn't a bug per se, but it leads to confusion when people forget the `--locked` flag during install.
## [1.0.0] - 19-08-2021
## [1.0.0] - 2021-08-19
A lot of things happened during this release.
Even though quite a few new features were added, the main effort went into increasing stability and inter-version compatibility.
@ -99,7 +110,7 @@ Overall, this resulted in sleaker und much better maintainable code. However, th
- Removed the `enqueue` parameter from callback, as the callback is only run for finished tasks.
## [0.12.2] - 20-04-2021
## [0.12.2] - 2021-04-20
### Fixed
@ -108,7 +119,7 @@ Overall, this resulted in sleaker und much better maintainable code. However, th
- Fix empty output for empty groups when requesting specific group with `status -g $name`. [#190](https://github.com/Nukesor/pueue/issues/190)
- Fix missing output when explicitly requesting default group with `status -g default`. [#190](https://github.com/Nukesor/pueue/issues/190)
## [0.12.1] - 12-03-2021
## [0.12.1] - 2021-03-12
### Fixed
@ -118,7 +129,7 @@ Overall, this resulted in sleaker und much better maintainable code. However, th
- Show the status of the default group, if there are no tasks in the queue.
## [0.12.0] - 10-02-2021
## [0.12.0] - 2021-02-10
**Info for all packagers:** \
In case you updated your packaging rules for the new layout in v0.11, those changes need to be reverted. \
@ -145,20 +156,20 @@ Managing two crates in a single repository in combination with `cargo release` t
`--start-immediately` and `--stashed` collided.
- Error on BSD due to inability to get username from system registry. [#173](https://github.com/Nukesor/pueue/issues/173)
## [0.11.2] - 01-02-2021
## [0.11.2] - 2021-02-01
### Changed
- Readability of the `log` command has been further improved.
- Dependency bump to pueue-lib `v0.11.2`
## [0.11.1] - 19-01-2021
## [0.11.1] - 2021-01-19
### Fixed
- Wrong version (`pueue-v0.11.0-alpha.0`) due to an error in the build process with the new project structure. [#169](https://github.com/Nukesor/pueue/issues/169)
## [0.11.0] - 18-01-2021
## [0.11.0] - 2021-01-18
### Added
@ -174,7 +185,7 @@ Managing two crates in a single repository in combination with `cargo release` t
- If multiple tasks are selected, `log` now only shows the last few lines for each log.
You can use the new `--full` option to get the old behavior.
## [0.10.2] - 31-12-2020
## [0.10.2] - 2020-12-31
### Fixed
@ -182,13 +193,13 @@ Managing two crates in a single repository in combination with `cargo release` t
This didn't lead to any crashes, but could lead to unwanted behavior, since the dependant tasks simply started due to the dependency no longer existing.
It's however still possible to delete dependencies as long as their dependants are deleted as well.
## [0.10.1] - 29-12-2020
## [0.10.1] - 2020-12-29
### Fixed
- panic, when using `pueue status` and only having tasks in non-default groups.
## [0.10.0] - 29-12-2020
## [0.10.0] - 2020-12-29
This release adds a lot of breaking changes!
I tried to clean up, refactor and streamline as much code as possible.

4
Cargo.lock generated
View file

@ -1281,9 +1281,9 @@ dependencies = [
[[package]]
name = "pueue-lib"
version = "0.18.0"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "270bc7e5aac11e67289461b434e565789245494a43f2e41bc4a6393787f29783"
checksum = "6b228feeeda26f64e36bf0ebd2dd48da8c091b3ff2314b18e0a83f0f776bc1b9"
dependencies = [
"async-std",
"async-tls",

View file

@ -10,7 +10,7 @@ use log::error;
use pueue_lib::network::message::*;
use pueue_lib::network::protocol::*;
use pueue_lib::network::secret::read_shared_secret;
use pueue_lib::settings::Settings;
use pueue_lib::settings::{Settings, PUEUE_DEFAULT_GROUP};
use crate::cli::{CliArguments, SubCommand};
use crate::commands::edit::edit;
@ -36,12 +36,14 @@ pub struct Client {
/// This is a small helper which either returns a given group or the default group.
pub fn group_or_default(group: &Option<String>) -> String {
group.clone().unwrap_or_else(|| "default".to_string())
group
.clone()
.unwrap_or_else(|| PUEUE_DEFAULT_GROUP.to_string())
}
/// This is a small helper which determines the selection depending on given commandline
/// parameters.
/// If no parameters are given, it returns to the default, which is the "default" group.
/// If no parameters are given, it returns to the default group.
pub fn selection_from_params(
all: bool,
group: &Option<String>,
@ -54,7 +56,7 @@ pub fn selection_from_params(
} else if !task_ids.is_empty() {
TaskSelection::TaskIds(task_ids.to_owned())
} else {
TaskSelection::Group("default".into())
TaskSelection::Group(PUEUE_DEFAULT_GROUP.into())
}
}

View file

@ -5,7 +5,7 @@ use chrono::{Duration, Local};
use comfy_table::presets::UTF8_HORIZONTAL_BORDERS_ONLY;
use comfy_table::*;
use pueue_lib::settings::Settings;
use pueue_lib::settings::{Settings, PUEUE_DEFAULT_GROUP};
use pueue_lib::state::State;
use pueue_lib::task::{Task, TaskResult, TaskStatus};
@ -78,9 +78,14 @@ fn print_all_groups(
// see most of the time anyway.
if state.tasks.is_empty() {
let headline = get_group_headline(
"default",
state.groups.get("default").unwrap(),
*state.settings.daemon.groups.get("default").unwrap(),
PUEUE_DEFAULT_GROUP,
state.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
*state
.settings
.daemon
.groups
.get(PUEUE_DEFAULT_GROUP)
.unwrap(),
colors,
);
println!("{}\n", headline);
@ -89,12 +94,17 @@ fn print_all_groups(
}
// Always print the default queue at the very top, if no specific group is requested.
if sorted_tasks.get("default").is_some() {
let tasks = sorted_tasks.get("default").unwrap();
if sorted_tasks.get(PUEUE_DEFAULT_GROUP).is_some() {
let tasks = sorted_tasks.get(PUEUE_DEFAULT_GROUP).unwrap();
let headline = get_group_headline(
"default",
state.groups.get("default").unwrap(),
*state.settings.daemon.groups.get("default").unwrap(),
PUEUE_DEFAULT_GROUP,
state.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
*state
.settings
.daemon
.groups
.get(PUEUE_DEFAULT_GROUP)
.unwrap(),
colors,
);
println!("{}", headline);
@ -111,7 +121,7 @@ fn print_all_groups(
while let Some((group, tasks)) = sorted_iter.next() {
// We always want to print the default group at the very top.
// That's why we print it before this loop and skip it in here.
if group.eq("default") {
if group.eq(PUEUE_DEFAULT_GROUP) {
continue;
}

View file

@ -1,6 +1,7 @@
use crossbeam_channel::Sender;
use pueue_lib::network::message::*;
use pueue_lib::settings::PUEUE_DEFAULT_GROUP;
use pueue_lib::state::SharedState;
use crate::network::message_handler::ok_or_failure_message;
@ -40,7 +41,7 @@ pub fn group(message: GroupMessage, sender: &Sender<Message>, state: &SharedStat
return message;
}
if group == "default" {
if group == PUEUE_DEFAULT_GROUP {
return create_failure_message("You cannot delete the default group".to_string());
}

View file

@ -2,6 +2,7 @@ use crossbeam_channel::Sender;
use std::fmt::Display;
use pueue_lib::network::message::*;
use pueue_lib::settings::PUEUE_DEFAULT_GROUP;
use pueue_lib::state::SharedState;
use crate::network::response_helper::*;
@ -133,7 +134,7 @@ mod fixtures {
format!("{}", id),
"/tmp".to_string(),
HashMap::new(),
"default".to_string(),
PUEUE_DEFAULT_GROUP.to_string(),
status,
Vec::new(),
None,

View file

@ -122,7 +122,7 @@ pub fn base_setup() -> Result<(Settings, TempDir)> {
};
let mut groups = BTreeMap::new();
groups.insert("default".to_string(), 1);
groups.insert(PUEUE_DEFAULT_GROUP.to_string(), 1);
groups.insert("test_2".to_string(), 2);
groups.insert("test_3".to_string(), 3);
groups.insert("test_5".to_string(), 5);

View file

@ -14,7 +14,7 @@ pub fn add_message(shared: &Shared, command: &str) -> AddMessage {
envs: HashMap::new(),
start_immediately: false,
stashed: false,
group: "default".into(),
group: PUEUE_DEFAULT_GROUP.into(),
enqueue_at: None,
dependencies: vec![],
label: None,

View file

@ -2,6 +2,8 @@
use anyhow::Result;
use tokio::io::{self, AsyncWriteExt};
pub use pueue_lib::settings::PUEUE_DEFAULT_GROUP;
pub mod daemon;
pub mod envs;
pub mod fixtures;

View file

@ -31,7 +31,7 @@ async fn test_edit_flow() -> Result<()> {
// Pause the daemon. That way the command won't be started.
pause_tasks(shared, TaskSelection::All).await?;
wait_for_group_status(shared, "default", GroupStatus::Paused).await?;
wait_for_group_status(shared, PUEUE_DEFAULT_GROUP, GroupStatus::Paused).await?;
let response = create_edited_task(shared).await?;
assert_eq!(response.task_id, 0);

View file

@ -37,7 +37,7 @@ async fn test_cannot_delete_default() -> Result<()> {
let shared = &settings.shared;
let _pid = boot_daemon(tempdir.path())?;
let pause_message = Message::Group(GroupMessage::Remove("default".to_string()));
let pause_message = Message::Group(GroupMessage::Remove(PUEUE_DEFAULT_GROUP.to_string()));
assert_failure(send_message(shared, pause_message).await?);
Ok(())

View file

@ -18,7 +18,7 @@ use crate::helper::*;
)]
#[case(
Message::Kill(KillMessage {
tasks: TaskSelection::Group("default".into()),
tasks: TaskSelection::Group(PUEUE_DEFAULT_GROUP.into()),
children: false,
signal: None,
}), true
@ -70,7 +70,10 @@ async fn test_kill_tasks(
// Groups should be paused in specific modes.
if group_should_pause {
let state = get_state(shared).await?;
assert_eq!(state.groups.get("default").unwrap(), &GroupStatus::Paused);
assert_eq!(
state.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
&GroupStatus::Paused
);
}
Ok(())

View file

@ -15,7 +15,7 @@ async fn test_pause_daemon() -> Result<()> {
// This pauses the daemon
pause_tasks(shared, TaskSelection::All).await?;
// Make sure the default group get's paused
wait_for_group_status(shared, "default", GroupStatus::Paused).await?;
wait_for_group_status(shared, PUEUE_DEFAULT_GROUP, GroupStatus::Paused).await?;
// Add a task and give the taskmanager time to theoretically start the process
add_task(shared, "ls", false).await?;
@ -43,7 +43,10 @@ async fn test_pause_running_task() -> Result<()> {
// Make sure the task as well as the default group get paused
wait_for_task_condition(shared, 0, |task| matches!(task.status, TaskStatus::Paused)).await?;
let state = get_state(shared).await?;
assert_eq!(state.groups.get("default").unwrap(), &GroupStatus::Paused);
assert_eq!(
state.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
&GroupStatus::Paused
);
Ok(())
}
@ -60,7 +63,7 @@ async fn test_pause_with_wait() -> Result<()> {
// Pauses the default queue while waiting for tasks
let message = Message::Pause(PauseMessage {
tasks: TaskSelection::Group("default".into()),
tasks: TaskSelection::Group(PUEUE_DEFAULT_GROUP.into()),
wait: true,
children: false,
});
@ -69,7 +72,7 @@ async fn test_pause_with_wait() -> Result<()> {
.context("Failed to send message")?;
// Make sure the default group gets paused, but the task is still running
wait_for_group_status(shared, "default", GroupStatus::Paused).await?;
wait_for_group_status(shared, PUEUE_DEFAULT_GROUP, GroupStatus::Paused).await?;
let state = get_state(shared).await?;
assert_eq!(state.tasks.get(&0).unwrap().status, TaskStatus::Running);

View file

@ -26,7 +26,10 @@ async fn test_start_running() -> Result<()> {
// Assert that the group is still running.
let state = get_state(shared).await?;
assert_eq!(state.groups.get("default").unwrap(), &GroupStatus::Running);
assert_eq!(
state.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
&GroupStatus::Running
);
child.kill()?;
Ok(())
@ -52,7 +55,10 @@ async fn test_start_paused() -> Result<()> {
// Assert that the group is still paused.
let state = get_state(shared).await?;
assert_eq!(state.groups.get("default").unwrap(), &GroupStatus::Paused);
assert_eq!(
state.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
&GroupStatus::Paused
);
child.kill()?;
Ok(())

View file

@ -14,7 +14,7 @@ use crate::helper::*;
)]
#[case(
Message::Start(StartMessage {
tasks: TaskSelection::Group("default".into()),
tasks: TaskSelection::Group(PUEUE_DEFAULT_GROUP.into()),
children: false,
})
)]

View file

@ -1,5 +1,7 @@
use anyhow::Result;
use pueue_lib::settings::PUEUE_DEFAULT_GROUP;
use crate::helper::fixtures::*;
use crate::helper::*;
@ -23,7 +25,7 @@ async fn test_single_worker() -> Result<()> {
// All tasks should have the worker id 0, as the tasks are processed sequentially.
let state = get_state(shared).await?;
for task_id in 0..3 {
assert_worker_envs(shared, &state, task_id, 0, "default").await?;
assert_worker_envs(shared, &state, task_id, 0, PUEUE_DEFAULT_GROUP).await?;
}
Ok(())