From 05f01b676dc5a908ec42c6bc78137289404a207b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20K=C3=A1cha?= <ph@cesnet.cz> Date: Thu, 20 Jul 2017 14:23:29 +0200 Subject: [PATCH] Changed "temp" to "tmp", originated as mental typo (should not cause problems as filer ensures directory creation itself) --- warden3/contrib/warden_filer/README | 8 ++++---- warden3/contrib/warden_filer/warden_filer.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/warden3/contrib/warden_filer/README b/warden3/contrib/warden_filer/README index e1250ac..6d70f03 100644 --- a/warden3/contrib/warden_filer/README +++ b/warden3/contrib/warden_filer/README @@ -135,11 +135,11 @@ directories must obey simple protocols, which use atomic "rename" to avoid locking issues. Also, your directory (and its structure) _must_ reside on the same filesystem to keep "rename" atomic. _Never_ try to mount some of the -subdirectories ("temp", "incoming", "errors") from other filesystem. +subdirectories ("tmp", "incoming", "errors") from other filesystem. 1. Inserting file - * The file you want to create _must_ be created in the "temp" subdirectory + * The file you want to create _must_ be created in the "tmp" subdirectory first, _not_ "incoming". Filename is arbitrary, but must be unique among all subdirectories. @@ -148,7 +148,7 @@ subdirectories ("temp", "incoming", "errors") from other filesystem. or complete. For simple usage (bash scripts, etc.), just creating sufficiently random - filename in "temp" and then moving into "incoming" may be enough. + filename in "tmp" and then moving into "incoming" may be enough. Concatenating $RANDOM couple of times will do. :) For advanced or potentially concurrent usage inserting enough of unique @@ -159,7 +159,7 @@ subdirectories ("temp", "incoming", "errors") from other filesystem. 2. Picking up file - * Rename the file to work with into "temp" directory. + * Rename the file to work with into "tmp" directory. * Do whatever you want with contents, and when finished, rename file back into "incoming", or remove, or move somewhere else, or move into "errors" diff --git a/warden3/contrib/warden_filer/warden_filer.py b/warden3/contrib/warden_filer/warden_filer.py index b9d08cb..9ed1fbc 100755 --- a/warden3/contrib/warden_filer/warden_filer.py +++ b/warden3/contrib/warden_filer/warden_filer.py @@ -65,9 +65,9 @@ class NamedFile(object): class SafeDir(object): """ Maildir like directory for safe file exchange. - - Producers are expected to drop files into "temp" under globally unique + - Producers are expected to drop files into "tmp" under globally unique filename and rename it into "incoming" atomically (newfile method) - - Workers pick files in "incoming", rename them into "temp", + - Workers pick files in "incoming", rename them into "tmp", do whatever they want, and either discard them or move into "errors" directory """ @@ -76,7 +76,7 @@ class SafeDir(object): self.path = self._ensure_path(p) self.incoming = self._ensure_path(path.join(self.path, "incoming")) self.errors = self._ensure_path(path.join(self.path, "errors")) - self.temp = self._ensure_path(path.join(self.path, "temp")) + self.temp = self._ensure_path(path.join(self.path, "tmp")) self.hostname = socket.gethostname() self.pid = os.getpid() @@ -116,7 +116,7 @@ class SafeDir(object): # which checked uniqueness among all directories by atomic # links. - # First find and open name unique within temp + # First find and open name unique within tmp tmpname = None while not tmpname: tmpname = self._get_new_name() -- GitLab