Commits

Johannes Köster  committed a91f985

Only warn when dry-running on locked directory.

  • Participants
  • Parent commits 05e2c21

Comments (0)

Files changed (2)

File snakemake/persistence.py

 
 class Persistence:
 
-    def __init__(self, nolock=False, dag=None):
+    def __init__(self, nolock=False, dag=None, warn_only=False):
         self.path = os.path.abspath(".snakemake")
         if not os.path.exists(self.path):
             os.mkdir(self.path)
         if nolock:
             self.lock = self.noop
             self.unlock = self.noop
+        if warn_only:
+            self.lock = self.lock_warn_only
+            self.unlock = self.noop
 
     @property
     def files(self):
                         return True
         return False
 
+    def lock_warn_only(self):
+        if self.locked:
+            logging.info("Error: Directory cannot be locked. This usually "
+            "means that another Snakemake instance is running on this directory."
+            "Another possiblity is that a previous run exited unexpectedly.")
+
     def lock(self):
         if self.locked:
             raise IOError("Another snakemake process "

File snakemake/workflow.py

             force_incomplete=force_incomplete,
             ignore_incomplete=ignore_incomplete, notemp=notemp)
 
-        self.persistence = Persistence(nolock=nolock, dag=dag)
+        self.persistence = Persistence(nolock=nolock, dag=dag, warn_only=dryrun or printrulegraph or printdag or summary or list_version_changes or list_code_changes or list_input_changes or list_params_changes)
 
         if cleanup_metadata:
             for f in cleanup_metadata: