From dd028e6043d2b3d6751e6a002fb49dbb48a8dcfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 14 Apr 2025 21:32:51 +0200 Subject: Log command Changelog: Added `log` command to show job log --- src/Job.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Job.hs') diff --git a/src/Job.hs b/src/Job.hs index 61ddbb5..706471b 100644 --- a/src/Job.hs +++ b/src/Job.hs @@ -8,6 +8,7 @@ module Job ( jobStatusFinished, jobStatusFailed, JobManager(..), newJobManager, cancelAllJobs, runJobs, + jobStorageSubdir, ) where import Control.Concurrent @@ -284,6 +285,9 @@ updateStatusFile path outVar = void $ liftIO $ forkIO $ loop Nothing T.writeFile path $ textJobStatus status <> "\n" when (not (jobStatusFinished status)) $ loop $ Just status +jobStorageSubdir :: JobId -> FilePath +jobStorageSubdir (JobId jidParts) = "jobs" joinPath (map (T.unpack . textJobIdPart) (jidParts)) + prepareJob :: (MonadIO m, MonadMask m, MonadFail m) => FilePath -> Maybe Commit -> Job -> (FilePath -> FilePath -> m a) -> m a prepareJob dir mbCommit job inner = do withSystemTempDirectory "minici" $ \checkoutPath -> do @@ -301,8 +305,7 @@ prepareJob dir mbCommit job inner = do subtree <- maybe return (getSubtree Nothing . makeRelative (treeSubdir tree)) mbsub $ tree checkoutAt subtree $ checkoutPath fromMaybe "" dest - let JobId jidParts = jobId job - jdir = dir "jobs" joinPath (map (T.unpack . textJobIdPart) (jidParts)) + let jdir = dir jobStorageSubdir (jobId job) liftIO $ createDirectoryIfMissing True jdir inner checkoutPath jdir -- cgit v1.2.3