LGTM, Thanks
On Tue, Dec 3, 2013 at 5:00 PM, Klaus Aehlig <[email protected]> wrote: > The job scheduler in luxid regularly watches for changes > of the job files to determine progress of jobs. As these > files are updated atomically, reading them will always > succeed---until they're archived. While luxid is quite > fast observing queue changes, it still is possible that > a job gets archived before luxid noting that it finished. > Make luxid aware of this possibility. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/JQScheduler.hs | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/Ganeti/JQScheduler.hs b/src/Ganeti/JQScheduler.hs > index 6daf9e8..df56551 100644 > --- a/src/Ganeti/JQScheduler.hs > +++ b/src/Ganeti/JQScheduler.hs > @@ -99,15 +99,17 @@ readJobStatus (JobWithStat {jStat=fstat, jJob=job}) = > do > qdir <- queueDir > let fpath = liveJobFile qdir jid > logDebug $ "Checking if " ++ fpath ++ " changed on disk." > - changed <- needsReload fstat fpath > + changedResult <- try $ needsReload fstat fpath > + :: IO (Either IOError (Maybe FStat)) > + let changed = either (const $ Just nullFStat) id changedResult > case changed of > Nothing -> do > logDebug $ "File " ++ fpath ++ " not changed on disk." > return Nothing > Just fstat' -> do > - logInfo $ "Rereading " ++ fpath > - readResult <- loadJobFromDisk qdir False jid > let jids = show $ fromJobId jid > + logInfo $ "Rereading job " ++ jids > + readResult <- loadJobFromDisk qdir True jid > case readResult of > Bad s -> do > logWarning $ "Failed to read job " ++ jids ++ ": " ++ s > -- > 1.8.4.1 > >
