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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Christian Merten
haskell-gargantext
Commits
e3de4cdb
Commit
e3de4cdb
authored
Aug 21, 2024
by
Loïc Chapron
Committed by
Grégoire Locqueville
Oct 07, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update from WIP
parent
286be0cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
EnvTypes.hs
src/Gargantext/API/Admin/EnvTypes.hs
+3
-6
Job.hs
src/Gargantext/API/Job.hs
+0
-4
Internal.hs
src/Gargantext/Utils/Jobs/Internal.hs
+1
-2
No files found.
src/Gargantext/API/Admin/EnvTypes.hs
View file @
e3de4cdb
...
...
@@ -51,7 +51,6 @@ import Gargantext.Core.NodeStory
import
Gargantext.Database.Prelude
(
HasConnectionPool
(
..
))
import
Gargantext.Prelude
hiding
(
to
)
import
Gargantext.System.Logging
import
Gargantext.Utils.Jobs.Error
import
Gargantext.Utils.Jobs.Map
(
LoggerM
,
J
(
..
),
jTask
,
rjGetLog
)
import
Gargantext.Utils.Jobs.Monad
qualified
as
Jobs
import
Network.HTTP.Client
(
Manager
)
...
...
@@ -186,21 +185,19 @@ data ConcreteJobHandle err =
|
JobHandle
{
_jh_id
::
!
(
SJ
.
JobID
'S
J
.
Safe
)
,
_jh_logger
::
LoggerM
(
GargM
Env
err
)
JobLog
,
_jh_warnings
::
[
WarningDiagnostic
]
}
-- | Creates a new /concrete/ 'JobHandle', given its underlying 'JobID' and the logging function to
-- be used to report the status.
mkJobHandle
::
SJ
.
JobID
'S
J
.
Safe
->
LoggerM
(
GargM
Env
err
)
JobLog
->
[
WarningDiagnostic
]
->
ConcreteJobHandle
err
mkJobHandle
jId
=
JobHandle
jId
-- | Updates the status of a 'JobHandle' by using the input 'updateJobStatus' function.
updateJobProgress
::
ConcreteJobHandle
err
->
(
JobLog
->
JobLog
)
->
GargM
Env
err
()
updateJobProgress
ConcreteNullHandle
_
=
pure
()
updateJobProgress
hdl
@
(
JobHandle
_
logStatus
_
)
updateJobStatus
=
updateJobProgress
hdl
@
(
JobHandle
_
logStatus
)
updateJobStatus
=
Jobs
.
getLatestJobStatus
hdl
>>=
logStatus
.
updateJobStatus
...
...
@@ -214,7 +211,7 @@ instance Jobs.MonadJobStatus (GargM Env err) where
noJobHandle
Proxy
=
ConcreteNullHandle
getLatestJobStatus
ConcreteNullHandle
=
pure
noJobLog
getLatestJobStatus
(
JobHandle
jId
_
_
)
=
do
getLatestJobStatus
(
JobHandle
jId
_
)
=
do
mb_jb
<-
Jobs
.
findJob
jId
case
mb_jb
of
Nothing
->
pure
noJobLog
...
...
@@ -229,7 +226,7 @@ instance Jobs.MonadJobStatus (GargM Env err) where
l
:<
_
->
l
withTracer
_
ConcreteNullHandle
f
=
f
ConcreteNullHandle
withTracer
extraLogger
(
JobHandle
jId
logger
_
)
n
=
n
(
JobHandle
jId
(
\
w
->
logger
w
>>
liftIO
(
extraLogger
w
))
[]
)
withTracer
extraLogger
(
JobHandle
jId
logger
)
n
=
n
(
JobHandle
jId
(
\
w
->
logger
w
>>
liftIO
(
extraLogger
w
))
)
markStarted
n
jh
=
updateJobProgress
jh
(
const
$
jobLogStart
(
RemainingSteps
n
))
...
...
src/Gargantext/API/Job.hs
View file @
e3de4cdb
...
...
@@ -51,11 +51,7 @@ addErrorEvent :: ToHumanFriendlyError e => e -> JobLog -> JobLog
addErrorEvent
message
=
addEvent
"ERROR"
(
mkHumanFriendly
message
)
addWarningEvent
::
WarningDiagnostic
->
JobLog
->
JobLog
<<<<<<<
HEAD
addWarningEvent
message
=
addEvent
"ERROR"
(
renderWarningDiagnostic
message
)
=======
addWarningEvent
message
=
addEvent
"WARNING"
(
renderWarningDiagnostic
message
)
>>>>>>>
99
c6b95c
(
warning
in
JobHandle
and
Monad
)
jobLogProgress
::
Int
->
JobLog
->
JobLog
jobLogProgress
n
jl
=
over
(
scst_succeeded
.
_Just
)
(
+
n
)
$
...
...
src/Gargantext/Utils/Jobs/Internal.hs
View file @
e3de4cdb
...
...
@@ -27,7 +27,6 @@ import Servant.API.Alternative
import
Servant.API.ContentTypes
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.Utils.Jobs.Error
import
Gargantext.Utils.Jobs.Map
import
Gargantext.Utils.Jobs.Monad
...
...
@@ -44,7 +43,7 @@ serveJobsAPI
,
ToJSON
event
,
ToJSON
output
,
MimeRender
JSON
output
,
Foldable
callback
)
=>
(
SJ
.
JobID
'S
J
.
Safe
->
LoggerM
m
event
->
[
WarningDiagnostic
]
->
JobHandle
m
)
=>
(
SJ
.
JobID
'S
J
.
Safe
->
LoggerM
m
event
->
JobHandle
m
)
->
m
env
->
t
->
(
JobError
->
BackendInternalError
)
...
...
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