From f40e7a7fbb35db57016699affe96f8cdf5a8da69 Mon Sep 17 00:00:00 2001
From: John Chilton <jmchilton@gmail.com>
Date: Wed, 18 Jun 2014 12:01:03 -0500
Subject: [PATCH] Rework transient data handling to match Galaxy's.

---
 .hgignore                                         | 3 ++-
 docs/source/files/job_conf_sample_mq.xml          | 2 +-
 docs/source/upgrading.rst                         | 1 +
 {persisted_data => files/persisted_data}/info.txt | 0
 pulsar/core.py                                    | 5 +++--
 server.ini.sample                                 | 6 +++---
 6 files changed, 10 insertions(+), 7 deletions(-)
 rename {persisted_data => files/persisted_data}/info.txt (100%)

diff --git a/.hgignore b/.hgignore
index 1ab15e04..79942641 100644
--- a/.hgignore
+++ b/.hgignore
@@ -6,7 +6,8 @@ cache
 .coverage
 local_env.sh
 coverage_html_report
-lwr_staging
+files/staging
+files/persisted_data
 server.ini
 job_managers.ini
 *.pem
diff --git a/docs/source/files/job_conf_sample_mq.xml b/docs/source/files/job_conf_sample_mq.xml
index 80607c41..cac3dbff 100644
--- a/docs/source/files/job_conf_sample_mq.xml
+++ b/docs/source/files/job_conf_sample_mq.xml
@@ -21,7 +21,7 @@
             <!-- Tell Galaxy where files are being store on remote system, no
                  web server it can simply ask for this information.
             -->
-            <param id="jobs_directory">/path/to/remote/lwr/lwr_staging/</param>
+            <param id="jobs_directory">/path/to/remote/pulsar/files/staging/</param>
             <!-- Invert file transfers - have LWR initiate downloads during preprocessing
                  and uploads during postprocessing. -->
             <param id="default_file_action">remote_transfer</param>
diff --git a/docs/source/upgrading.rst b/docs/source/upgrading.rst
index 5235e1de..d81b0b98 100644
--- a/docs/source/upgrading.rst
+++ b/docs/source/upgrading.rst
@@ -10,3 +10,4 @@ Rough plan:
 - Rebuild dependencies (and/or virtualenv) if needed.
 - Copy the LWR's server.ini to Pulsar's root directory.
 - Update ``app_factory`` property: ``paste.app_factory = pulsar.web.wsgi:app_factory``
+- If you were using the default values for ``persistence_directory`` and ``staging_directory`` you may wish to update those to the new defaults as well.
diff --git a/persisted_data/info.txt b/files/persisted_data/info.txt
similarity index 100%
rename from persisted_data/info.txt
rename to files/persisted_data/info.txt
diff --git a/pulsar/core.py b/pulsar/core.py
index df1f53bb..c07fcf71 100644
--- a/pulsar/core.py
+++ b/pulsar/core.py
@@ -17,8 +17,9 @@ from logging import getLogger
 log = getLogger(__name__)
 
 DEFAULT_PRIVATE_KEY = None
-DEFAULT_STAGING_DIRECTORY = "lwr_staging"
-DEFAULT_PERSISTENCE_DIRECTORY = "persisted_data"
+DEFAULT_FILES_DIRECTORY = "files"
+DEFAULT_STAGING_DIRECTORY = os.path.join(DEFAULT_FILES_DIRECTORY, "staging")
+DEFAULT_PERSISTENCE_DIRECTORY = os.path.join(DEFAULT_FILES_DIRECTORY, "persisted_data")
 
 
 NOT_WHITELIST_WARNING = "Starting the LWR without a toolbox to white-list." + \
diff --git a/server.ini.sample b/server.ini.sample
index 6592dd76..a246dae0 100644
--- a/server.ini.sample
+++ b/server.ini.sample
@@ -20,8 +20,8 @@ host = localhost
 paste.app_factory = pulsar.web.wsgi:app_factory
 
 ## Directory to stage files to. This should likely be updated to point
-## to an absolute path, such as /tmp/lwr_staging or C:\\lwr_staging
-staging_directory = lwr_staging
+## to an absolute path, such as /tmp/pulsar_staging or C:\\pulsar_staging
+staging_directory = files/staging
 
 ## Private key or password that must be sent as part of the request to
 ## authorize use. If security is important, please use this in
@@ -35,7 +35,7 @@ staging_directory = lwr_staging
 ## do this). If user the LWR runs as cannot write to the LWR root
 ## directory, this should be updated to point to some directory which
 ## it can write to.
-persistence_directory = persisted_data
+persistence_directory = files/persisted_data
 
 ## How are ids assigned. galaxy (default) just passes through ids as
 ## is. Setting this uuid assigns each job a UUID, this is strongly
-- 
GitLab