on f557551 help sign in
4 files changed+2−56
since splitsnapshots
unifiedsplit
src/Control/Task/Scheduler.hs+1−4 src/Control/Task/Scheduler/Query.hs−3 src/Server/Schema.hs+1−3 src/Server/Schema/V2.hs−46
src/Control/Task/Scheduler.hs+1−4
@@ -21,7 +21,6 @@ import Data.Word
2121import GHC.TypeLits
2222import Server.Schema
2323import Squeal.PostgreSQL
24−import UnliftIO.Exception
2524
2625scheduleTask ::
2726 (StaticPQ m, WithLog env Message m, Task t s, MonadUnliftIO m) =>
@@ -67,9 +66,7 @@ instance
6766 <> e
6867 A.Success t -> do
6968 logInfo . T.pack $ "running task " <> task <> " with " <> show t <> " created at " <> show initialStartTime
70− r <- performTask @t @ts @m t `catchAny` \e -> do
71− logError . T.pack . displayException $ e
72− return Failure
69+ r <- performTask @t @ts @m t
7370 when (r == Failure) $ logWarning . T.pack $ "Task " <> task <> " failed"
7471 case r of
7572 Success -> completeTaskQuery t
src/Control/Task/Scheduler/Query.hs−3
@@ -41,7 +41,6 @@ scheduleTaskQuery task = do
4141 :* Set (param @2) `as` #payload
4242 :* Default `as` #creation_time
4343 :* Default `as` #started
44− :* Default `as` #failures
4544 )
4645 ( OnConflict
4746 (OnConstraint #pk_task_payload)
@@ -88,7 +87,6 @@ rescheduleTaskQuery payload = do
8887 #tasks
8988 ( Default `as` #creation_time
9089 :* Default `as` #started
91− :* Set (#failures + 1) `as` #failures
9290 )
9391 (param @1 .== #task .&& param @2 .== #payload)
9492 dbWrite (const $ return ()) $
@@ -114,7 +112,6 @@ pickTasksQuery tasks limitCount = do
114112 ( from (table #tasks)
115113 & where_ (#task `in_` (literal <$> tasks))
116114 & where_ (not_ . notNull $ #started)
117− & where_ (#failures .< 20)
118115 & orderBy [#creation_time & Asc]
119116 & limit limitCount
120117 & orderBy [#creation_time & Desc]
src/Server/Schema.hs+1−3
@@ -6,15 +6,13 @@ module Server.Schema
66where
77
88import Server.Schema.V1
9−import Server.Schema.V2
109import Squeal.PostgreSQL
1110
1211type StaticPQ m = MonadPQ Schema m
1312
14−type Schema = SchemaV2
13+type Schema = SchemaV1
1514
1615migration :: AlignedList (Migration (Terminally PQ IO)) (Public '[]) Schema
1716migration =
1817 pureMigration schemaMigrationV1
19− :>> pureMigration schemaMigrationV2
2018 :>> Done
src/Server/Schema/V2.hsdeleted−46
@@ -1,46 +0,0 @@
1−module Server.Schema.V2
2− ( SchemaV2,
3− schemaMigrationV2,
4− )
5−where
6−
7−import Data.Aeson
8−import Data.Int
9−import Data.Submission
10−import Data.Text (Text)
11−import Data.Time
12−import Server.Schema.V1
13−import Squeal.PostgreSQL
14−
15−type SchemaV2 =
16− Public
17− '[ "tasks"
18− ::: 'Table
19− ( '[ "pk_task_payload" :=> 'PrimaryKey '["task", "payload"]
20− ]
21− :=> '[ "task" ::: 'NoDef :=> 'NotNull (PG Text),
22− "payload" ::: 'NoDef :=> 'NotNull (PG (Jsonb Value)),
23− "creation_time" ::: 'Def :=> 'NotNull (PG UTCTime),
24− "started" ::: 'Def :=> 'NotNull (PG Bool),
25− "failures" ::: 'Def :=> 'NotNull (PG Int32)
26− ]
27− ),
28− "submissions"
29− ::: 'Table
30− ( '["pk_submission_repo_full_name_sha" :=> 'PrimaryKey '["repo_full_name", "sha"]]
31− :=> '[ "user_name" ::: 'NoDef :=> 'NotNull (PG String),
32− "repo_full_name" ::: 'NoDef :=> 'NotNull (PG String),
33− "problem" ::: 'NoDef :=> 'NotNull (PG String),
34− "sha" ::: 'NoDef :=> 'NotNull (PG String),
35− "status" ::: 'NoDef :=> 'NotNull (PG (Jsonb SubmissionStatus))
36− ]
37− )
38− ]
39−
40−schemaMigrationV2 :: Migration Definition SchemaV1 SchemaV2
41−schemaMigrationV2 =
42− Migration
43− { name = "v2",
44− up = alterTable #tasks (addColumn #failures (default_ 0 $ notNullable int)),
45− down = alterTable #tasks (dropColumn #failures)
46− }