summaryrefslogtreecommitdiffstats
path: root/crates/runner/src/paths.rs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-10-26 17:14:07 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-10-26 17:20:42 +0200
commite57b743058836ef34d4dd96fca5d6152f910140c (patch)
treec60300a3f775cfcdc9b0ddf54b9b693d72b2531c /crates/runner/src/paths.rs
parentf128746a63ae5b009e72d853a117f35c4a2b6cd0 (diff)
downloadrebel-e57b743058836ef34d4dd96fca5d6152f910140c.tar
rebel-e57b743058836ef34d4dd96fca5d6152f910140c.zip
runner: hold lock on task state dir while task is running
Do not allow concurrent runs of the same task.
Diffstat (limited to 'crates/runner/src/paths.rs')
-rw-r--r--crates/runner/src/paths.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/runner/src/paths.rs b/crates/runner/src/paths.rs
index 9539782..5bfef25 100644
--- a/crates/runner/src/paths.rs
+++ b/crates/runner/src/paths.rs
@@ -21,7 +21,9 @@
//! │ │ ├── layer/ # overlayfs layer dir (moved to layer/ after build)
//! │ │ ├── work/ # overlayfs work dir (discarded after build)
//! │ │ ├── task.json.tmp # during write
-//! │ │ └── task.json # after write
+//! │ │ ├── task.json # after write
+//! │ │ ├── task.log # stdout/stderr output of the task
+//! │ │ └── task.lock # task lockfile
//! │   └── ...
//! └── tmp/ # tmpfs (mounted on start of rebel)
//!    ├── rootfs/ # unpacked rootfs.tar
@@ -95,6 +97,10 @@ pub fn task_log_filename(hash: &InputHash) -> String {
join(&[TASK_STATE_DIR, &hash.to_string(), "task.log"])
}
+pub fn task_lock_filename(hash: &InputHash) -> String {
+ join(&[TASK_STATE_DIR, &hash.to_string(), "task.lock"])
+}
+
pub fn layer_dir(hash: &LayerHash) -> String {
join(&[LAYER_STATE_DIR, &hash.to_string()])
}