Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
f4e80982
Commit
f4e80982
authored
Jan 22, 2024
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Monomorphise Jobs.Internal API on BackendInternalError
parent
f186014b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
Internal.hs
src/Gargantext/Utils/Jobs/Internal.hs
+13
-10
Jobs.hs
test/Test/Utils/Jobs.hs
+1
-1
No files found.
src/Gargantext/Utils/Jobs/Internal.hs
View file @
f4e80982
...
...
@@ -21,7 +21,9 @@ import Data.Sequence (Seq)
import
qualified
Data.Sequence
as
Seq
import
Prelude
import
Servant.API.Alternative
import
Servant.API.ContentTypes
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.Utils.Jobs.Map
import
Gargantext.Utils.Jobs.Monad
...
...
@@ -33,16 +35,16 @@ import qualified Servant.Job.Core as SJ
import
qualified
Servant.Job.Types
as
SJ
serveJobsAPI
::
(
Ord
t
,
Exception
e
,
MonadError
e
m
::
(
Ord
t
,
MonadError
BackendInternalError
m
,
MonadJob
m
t
(
Seq
event
)
output
,
ToJSON
e
,
ToJSON
event
,
To
JSON
output
,
ToJSON
e
vent
,
ToJSON
output
,
MimeRender
JSON
output
,
Foldable
callback
)
=>
(
SJ
.
JobID
'S
J
.
Safe
->
LoggerM
m
event
->
JobHandle
m
)
->
m
env
->
t
->
(
JobError
->
e
)
->
(
env
->
JobHandle
m
->
input
->
IO
(
Either
e
output
))
->
(
JobError
->
BackendInternalError
)
->
(
env
->
JobHandle
m
->
input
->
IO
(
Either
BackendInternalError
output
))
->
SJ
.
AsyncJobsServerT'
ctI
ctO
callback
event
input
output
m
serveJobsAPI
newJobHandle
getenv
t
joberr
f
=
newJob
newJobHandle
getenv
t
f
(
SJ
.
JobInput
undefined
Nothing
)
...
...
@@ -50,10 +52,10 @@ serveJobsAPI newJobHandle getenv t joberr f
:<|>
serveJobAPI
t
joberr
serveJobAPI
::
forall
(
m
::
Type
->
Type
)
e
t
event
output
.
(
Ord
t
,
MonadError
e
m
,
MonadJob
m
t
(
Seq
event
)
output
)
::
forall
(
m
::
Type
->
Type
)
t
event
output
.
(
Ord
t
,
MonadError
BackendInternalError
m
,
MonadJob
m
t
(
Seq
event
)
output
,
MimeRender
JSON
output
)
=>
t
->
(
JobError
->
e
)
->
(
JobError
->
BackendInternalError
)
->
SJ
.
JobID
'S
J
.
Unsafe
->
SJ
.
AsyncJobServerT
event
output
m
serveJobAPI
t
joberr
jid'
=
wrap'
(
killJob
t
)
...
...
@@ -72,14 +74,15 @@ serveJobAPI t joberr jid' = wrap' (killJob t)
wrap'
g
limit
offset
=
wrap
(
g
limit
offset
)
newJob
::
(
Ord
t
,
Exception
e
,
MonadJob
m
t
(
Seq
event
)
output
,
ToJSON
e
,
ToJSON
event
,
ToJSON
output
::
(
Ord
t
,
MonadJob
m
t
(
Seq
event
)
output
,
ToJSON
event
,
ToJSON
output
,
MimeRender
JSON
output
,
Foldable
callbacks
)
=>
(
SJ
.
JobID
'S
J
.
Safe
->
LoggerM
m
event
->
JobHandle
m
)
->
m
env
->
t
->
(
env
->
JobHandle
m
->
input
->
IO
(
Either
e
output
))
->
(
env
->
JobHandle
m
->
input
->
IO
(
Either
BackendInternalError
output
))
->
SJ
.
JobInput
callbacks
input
->
m
(
SJ
.
JobStatus
'S
J
.
Safe
event
)
newJob
newJobHandle
getenv
jobkind
f
input
=
do
...
...
test/Test/Utils/Jobs.hs
View file @
f4e80982
...
...
@@ -254,7 +254,7 @@ withJob :: Env
->
IO
(
SJ
.
JobStatus
'S
J
.
Safe
JobLog
)
withJob
env
f
=
runMyDummyMonad
env
$
MyDummyMonad
$
-- the job type doesn't matter in our tests, we use a random one, as long as it's of type 'GargJob'.
newJob
@
_
@
BackendInternalError
mkJobHandle
(
pure
env
)
RecomputeGraphJob
(
\
_
hdl
input
->
newJob
@
_
mkJobHandle
(
pure
env
)
RecomputeGraphJob
(
\
_
hdl
input
->
runMyDummyMonad
env
$
(
Right
<$>
(
f
hdl
input
>>
getLatestJobStatus
hdl
)))
(
SJ
.
JobInput
()
Nothing
)
withJob_
::
Env
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment