metric is now obligatory for test in the DB
This commit is contained in:
parent
b30532ee9c
commit
c6a6ee45f4
@ -7,6 +7,9 @@ import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
|
||||
import Handler.Shared
|
||||
import Handler.Extract
|
||||
|
||||
import GEval.Core
|
||||
import GEval.OptionsParser
|
||||
|
||||
import System.Directory (doesFileExist)
|
||||
import System.FilePath.Find as SFF
|
||||
import System.FilePath
|
||||
@ -84,7 +87,7 @@ updateTests challengeId chan = do
|
||||
repo <- runDB $ get404 repoId
|
||||
let commit = repoCurrentCommit repo
|
||||
testDirs <- liftIO $ findTestDirs repoDir
|
||||
mapM_ (checkTestDir chan challengeId commit) testDirs
|
||||
mapM_ (checkTestDir chan challengeId challenge commit) testDirs
|
||||
msg chan (T.pack $ show testDirs)
|
||||
return ()
|
||||
|
||||
@ -93,16 +96,24 @@ expectedFileName = "expected.tsv"
|
||||
doesExpectedExist :: FilePath -> IO Bool
|
||||
doesExpectedExist fp = doesFileExist (fp </> expectedFileName)
|
||||
|
||||
checkTestDir :: Channel -> (Key Challenge) -> SHA1 -> FilePath -> Handler ()
|
||||
checkTestDir chan challengeId commit testDir = do
|
||||
checkTestDir :: Channel -> (Key Challenge) -> Challenge -> SHA1 -> FilePath -> Handler ()
|
||||
checkTestDir chan challengeId challenge commit testDir = do
|
||||
expectedExists <- liftIO $ doesExpectedExist testDir
|
||||
if expectedExists
|
||||
then do
|
||||
msg chan $ concat ["Test dir ", (T.pack testDir), " found."]
|
||||
checksum <- liftIO $ gatherSHA1 testDir
|
||||
testId <- runDB $ insert $ Test {
|
||||
optionsParsingResult <- liftIO $ getOptions [
|
||||
"--expected-directory", (getRepoDir $ challengePrivateRepo challenge),
|
||||
"--test-name", takeFileName testDir]
|
||||
case optionsParsingResult of
|
||||
Left evalException -> do
|
||||
err chan "Cannot read metric"
|
||||
return ()
|
||||
Right opts -> do
|
||||
_ <- runDB $ insert $ Test {
|
||||
testChallenge=challengeId,
|
||||
testMetric=Nothing,
|
||||
testMetric=gesMetric $ geoSpec opts,
|
||||
testName=T.pack $ takeFileName testDir,
|
||||
testChecksum=(SHA1 checksum),
|
||||
testCommit=commit,
|
||||
|
@ -62,7 +62,7 @@ getLeaderboardEntries challengeId = do
|
||||
Nothing -> []))
|
||||
|
||||
compareResult :: Test -> Maybe Double -> Maybe Double -> Ordering
|
||||
compareResult test (Just x) (Just y) = (DM.fromMaybe compare (compareFun <$> getMetricOrdering <$> testMetric test)) x y
|
||||
compareResult test (Just x) (Just y) = (compareFun $ getMetricOrdering $ testMetric test) x y
|
||||
compareResult _ (Just _) Nothing = GT
|
||||
compareResult _ Nothing (Just _) = LT
|
||||
compareResult _ Nothing Nothing = EQ
|
||||
|
@ -33,7 +33,7 @@ Challenge
|
||||
stamp UTCTime default=now()
|
||||
Test
|
||||
challenge ChallengeId
|
||||
metric Metric Maybe
|
||||
metric Metric
|
||||
name Text
|
||||
checksum SHA1
|
||||
commit SHA1
|
||||
|
@ -1,6 +1,6 @@
|
||||
<h1>Welcome to Gonito.net!
|
||||
|
||||
<p>Gonito (pronounced <i>ɡɔ̃ˈɲitɔ</i>) is a Kaggle-like platform for machine learning competitions.
|
||||
<p>Gonito (pronounced <i>ɡɔ̃ˈɲitɔ</i>) is a Kaggle-like platform for machine learning competitions (disclaimer: Gonito is neither affiliated with nor endorsed by <a href="https://www.kaggle.com">Kaggle</a>)
|
||||
|
||||
<p>What's so special about Gonito:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user