dropunused: Support --jobs
authorJoey Hess <joeyh@joeyh.name>
Fri, 21 Jul 2023 18:03:34 +0000 (14:03 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 21 Jul 2023 18:03:34 +0000 (14:03 -0400)
Sponsored-by: Kevin Mueller on Patreon
CHANGELOG
Command/DropUnused.hs
doc/git-annex-dropunused.mdwn
doc/todo/add_--jobs_for_dropunused_command.mdwn

index a55accbabe5b23b2619d197e41c14ece51d08c59..bb001943cc0cf91a619b41f4ba2daaf572fc4854 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,7 @@ git-annex (10.20230627) UNRELEASED; urgency=medium
   * S3: Allow setting publicurl=yes without public=yes, to support
     buckets that are configured with a Bucket Policy that allows public
     access.
+  * dropunused: Support --jobs
 
  -- Joey Hess <id@joeyh.name>  Mon, 26 Jun 2023 13:10:40 -0400
 
index 32fda458885469fa8c4b0e6a668ca3fc4d74c5e7..2a268f760c252b045e27d95b2dd61a7ea79a8b51 100644 (file)
@@ -20,7 +20,7 @@ import Annex.Content
 import qualified Utility.RawFilePath as R
 
 cmd :: Command
-cmd = withAnnexOptions [jsonOptions] $
+cmd = withAnnexOptions [jobsOption, jsonOptions] $
        command "dropunused" SectionMaintenance
                "drop unused file content"
                (paramRepeating paramNumRange) (seek <$$> optParser)
@@ -36,7 +36,7 @@ optParser desc = DropUnusedOptions
        <*> optional (Command.Drop.parseDropFromOption)
 
 seek :: DropUnusedOptions -> CommandSeek
-seek o = do
+seek o = startConcurrency commandStages $ do
        numcopies <- getNumCopies
        mincopies <- getMinCopies
        from <- maybe (pure Nothing) (Just <$$> getParsed) (dropFrom o)
index 739c59c1c60ab76ea5dba5fc668b2a12718b5f1f..31f6abf1143b89c55a8b76cd7de62b5d158eb01f 100644 (file)
@@ -28,6 +28,14 @@ Or, specify "all" to drop all unused data.
   the last repository that is storing their content. Data loss can
   result from using this option.
 
+* `--jobs=N` `-JN`
+
+  Runs multiple drop jobs in parallel. This is particularly useful
+  when git-annex has to contact remotes to check if it can drop content.
+  For example: `-J4`  
+
+  Setting this to "cpus" will run one job per CPU core.
+
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
index 5ea411051664b7bd850773b2473165204e906b5b..6128ff2f58ba7d6e4cbd7c744e61d67465b0d0e8 100644 (file)
@@ -1 +1,3 @@
 Simple "drop" have it, but no for "dropunused". Missed?
+
+> [[fixed|done]] --[[Joey]]