use compute program REPRODUCIBLE by default

This commit is contained in:
Joey Hess 2025-02-25 17:10:41 -04:00
parent 233a6954b9
commit 71e92a509a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 8 deletions

View file

@ -37,14 +37,14 @@ cmd = notBareRepo $
data AddComputedOptions = AddComputedOptions data AddComputedOptions = AddComputedOptions
{ computeParams :: CmdParams { computeParams :: CmdParams
, computeRemote :: DeferredParse Remote , computeRemote :: DeferredParse Remote
, reproducible :: Reproducible , reproducible :: Maybe Reproducible
} }
optParser :: CmdParamsDesc -> Parser AddComputedOptions optParser :: CmdParamsDesc -> Parser AddComputedOptions
optParser desc = AddComputedOptions optParser desc = AddComputedOptions
<$> cmdParams desc <$> cmdParams desc
<*> (mkParseRemoteOption <$> parseToOption) <*> (mkParseRemoteOption <$> parseToOption)
<*> (fromMaybe (Reproducible False) <$> parseReproducible) <*> parseReproducible
newtype Reproducible = Reproducible { isReproducible :: Bool } newtype Reproducible = Reproducible { isReproducible :: Bool }
@ -92,7 +92,7 @@ perform o r program = do
, Remote.Compute.computeInputs = mempty , Remote.Compute.computeInputs = mempty
, Remote.Compute.computeOutputs = mempty , Remote.Compute.computeOutputs = mempty
, Remote.Compute.computeSubdir = subdir , Remote.Compute.computeSubdir = subdir
, Remote.Compute.computeReproducible = isreproducible , Remote.Compute.computeReproducible = False
} }
fast <- Annex.getRead Annex.fast fast <- Annex.getRead Annex.fast
starttime <- liftIO currentMonotonicTimestamp starttime <- liftIO currentMonotonicTimestamp
@ -140,7 +140,7 @@ perform o r program = do
| fast = do | fast = do
addSymlink outputfile stateurlk Nothing addSymlink outputfile stateurlk Nothing
return stateurlk return stateurlk
| isreproducible = do | isreproducible state = do
sz <- liftIO $ getFileSize outputfile' sz <- liftIO $ getFileSize outputfile'
metered Nothing sz Nothing $ \_ p -> metered Nothing sz Nothing $ \_ p ->
ingestwith $ ingestAdd p (Just ld) ingestwith $ ingestAdd p (Just ld)
@ -170,4 +170,6 @@ perform o r program = do
calcduration (MonotonicTimestamp starttime) (MonotonicTimestamp endtime) = calcduration (MonotonicTimestamp starttime) (MonotonicTimestamp endtime) =
fromIntegral (endtime - starttime) :: NominalDiffTime fromIntegral (endtime - starttime) :: NominalDiffTime
isreproducible = isReproducible (reproducible o) isreproducible state = case reproducible o of
Just v -> isReproducible v
Nothing -> Remote.Compute.computeReproducible state

View file

@ -53,8 +53,11 @@ Some examples of how this might look:
* `--fast` * `--fast`
Adds computed files to the repository, without generating their content Adds computed files to the repository, without doing any work yet to
yet. compute their content.
This implies `--unreproducible`, because even if the compute remote
produces reproducible output, it's not available.
* `--unreproducible`, `-u` * `--unreproducible`, `-u`
@ -70,7 +73,7 @@ Some examples of how this might look:
Indicate that the computation is expected to be fully reproducible. Indicate that the computation is expected to be fully reproducible.
This is the default when the compute remote indicates that it produces This is the default when the compute remote indicates that it produces
reproducible output. reproducible output (except when using `--fast`).
If a computation turns out not to be fully reproducible, then getting If a computation turns out not to be fully reproducible, then getting
the file from the compute remote will later fail with a checksum the file from the compute remote will later fail with a checksum