refactor
This commit is contained in:
parent
3bec89a3c3
commit
53d107ca47
3 changed files with 13 additions and 26 deletions
|
@ -21,11 +21,9 @@ import Types.KeySource
|
|||
import Messages.Progress
|
||||
import Logs.Location
|
||||
import Utility.Metered
|
||||
import Utility.MonotonicClock
|
||||
import Backend.URL (fromUrl)
|
||||
|
||||
import qualified Data.Map as M
|
||||
import Data.Time.Clock
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $
|
||||
|
@ -92,17 +90,14 @@ perform o r = do
|
|||
, Remote.Compute.computeReproducible = False
|
||||
}
|
||||
fast <- Annex.getRead Annex.fast
|
||||
starttime <- liftIO currentMonotonicTimestamp
|
||||
showOutput
|
||||
Remote.Compute.runComputeProgram program state
|
||||
(Remote.Compute.ImmutableState False)
|
||||
(getInputContent fast)
|
||||
(go starttime fast)
|
||||
(go fast)
|
||||
next $ return True
|
||||
where
|
||||
go starttime fast state tmpdir = do
|
||||
endtime <- liftIO currentMonotonicTimestamp
|
||||
let ts = calcduration starttime endtime
|
||||
go fast state tmpdir ts = do
|
||||
let outputs = Remote.Compute.computeOutputs state
|
||||
when (M.null outputs) $
|
||||
giveup "The computation succeeded, but it did not generate any files."
|
||||
|
@ -151,9 +146,6 @@ perform o r = do
|
|||
, checkWritePerms = True
|
||||
}
|
||||
|
||||
calcduration (MonotonicTimestamp starttime) (MonotonicTimestamp endtime) =
|
||||
fromIntegral (endtime - starttime) :: NominalDiffTime
|
||||
|
||||
isreproducible state = case reproducible o of
|
||||
Just v -> isReproducible v
|
||||
Nothing -> Remote.Compute.computeReproducible state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue