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
175
Issues
175
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
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
19c6f5ad
Commit
19c6f5ad
authored
May 12, 2023
by
Alexandre Delanoë
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Adding Schedule job to gargantext-server
parent
22b4b146
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
208 deletions
+76
-208
Main.hs
bin/gargantext-server/Main.hs
+42
-20
Main.hs
bin/gargantext-upgrade/Main.hs
+22
-184
gargantext.cabal
gargantext.cabal
+5
-1
package.yaml
package.yaml
+7
-3
No files found.
bin/gargantext-server/Main.hs
View file @
19c6f5ad
...
@@ -11,29 +11,31 @@ Script to start gargantext with different modes (Dev, Prod, Mock).
...
@@ -11,29 +11,31 @@ Script to start gargantext with different modes (Dev, Prod, Mock).
-}
-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
Main
where
module
Main
where
import
Data.Version
(
showVersion
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Text
(
unpack
)
import
Data.Text
(
unpack
)
import
qualified
Paths_gargantext
as
PG
-- cabal magic build module
import
Data.Version
(
showVersion
)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
import
GHC.IO.Exception
(
IOException
)
import
Gargantext.API
(
startGargantext
,
Mode
(
..
))
-- , startGargantextMock)
import
Gargantext.API.Admin.EnvTypes
(
DevEnv
)
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.Database.Prelude
(
Cmd
''
,
Cmd
,
execPGSQuery
)
import
Gargantext.Prelude
import
Options.Generic
import
Options.Generic
import
System.Cron.Schedule
import
System.Exit
(
exitSuccess
)
import
System.Exit
(
exitSuccess
)
import
qualified
Paths_gargantext
as
PG
-- cabal magic build module
import
Gargantext.Prelude
import
Gargantext.API
(
startGargantext
,
Mode
(
..
))
-- , startGargantextMock)
--------------------------------------------------------
-- Graph Tests
--import qualified Gargantext.Graph.Utils as U
--import qualified Gargantext.Graph.Distances.Conditional as C
--import qualified Gargantext.Graph.Distances.Distributional as D
--import qualified Gargantext.Graph.Distances.Matrice as M
--------------------------------------------------------
instance
ParseRecord
Mode
instance
ParseRecord
Mode
instance
ParseField
Mode
instance
ParseField
Mode
...
@@ -59,24 +61,44 @@ main :: IO ()
...
@@ -59,24 +61,44 @@ main :: IO ()
main
=
do
main
=
do
MyOptions
myMode
myPort
myIniFile
myVersion
<-
unwrapRecord
MyOptions
myMode
myPort
myIniFile
myVersion
<-
unwrapRecord
"Gargantext server"
"Gargantext server"
---------------------------------------------------------------
if
myVersion
then
do
if
myVersion
then
do
putStrLn
$
"Version: "
<>
showVersion
PG
.
version
putStrLn
$
"Version: "
<>
showVersion
PG
.
version
System
.
Exit
.
exitSuccess
System
.
Exit
.
exitSuccess
else
else
return
()
return
()
---------------------------------------------------------------
let
myPort'
=
case
myPort
of
let
myPort'
=
case
myPort
of
Just
p
->
p
Just
p
->
p
Nothing
->
8008
Nothing
->
8008
let
start
=
case
myMode
of
Mock
->
panic
"[ERROR] Mock mode unsupported"
_
->
startGargantext
myMode
myPort'
(
unpack
myIniFile'
)
where
myIniFile'
=
case
myIniFile
of
myIniFile'
=
case
myIniFile
of
Nothing
->
panic
"[ERROR] gargantext.ini needed"
Nothing
->
panic
"[ERROR] gargantext.ini needed"
Just
i
->
i
Just
i
->
i
---------------------------------------------------------------
let
start
=
case
myMode
of
Mock
->
panic
"[ERROR] Mock mode unsupported"
_
->
startGargantext
myMode
myPort'
(
unpack
myIniFile'
)
putStrLn
$
"Starting with "
<>
show
myMode
<>
" mode."
putStrLn
$
"Starting with "
<>
show
myMode
<>
" mode."
start
start
---------------------------------------------------------------
putStrLn
$
"Starting Schedule Jobs"
withDevEnv
(
unpack
myIniFile'
)
$
\
env
->
do
tids
<-
execSchedule
$
do
addJob
(
runCmdDev
env
refreshIndex
)
"5 * * * *"
putStrLn
(
"Refresh Index Cron Job started"
<>
show
tids
)
refreshIndex
::
Cmd''
DevEnv
IOException
()
refreshIndex
=
do
_
<-
execPGSQuery
[
sql
|
refresh materialized view context_node_ngrams_view;
|]
()
pure
()
bin/gargantext-upgrade/Main.hs
View file @
19c6f5ad
This diff is collapsed.
Click to expand it.
gargantext.cabal
View file @
19c6f5ad
...
@@ -689,6 +689,7 @@ executable gargantext-init
...
@@ -689,6 +689,7 @@ executable gargantext-init
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -O2 -Wmissing-signatures
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -O2 -Wmissing-signatures
build-depends:
build-depends:
base
base
, cron
, extra
, extra
, gargantext
, gargantext
, gargantext-prelude
, gargantext-prelude
...
@@ -792,12 +793,14 @@ executable gargantext-server
...
@@ -792,12 +793,14 @@ executable gargantext-server
base
base
, cassava
, cassava
, containers
, containers
, cron
, extra
, extra
, full-text-search
, full-text-search
, gargantext
, gargantext
, gargantext-prelude
, gargantext-prelude
, ini
, ini
, optparse-generic
, optparse-generic
, postgresql-simple
, text
, text
, unordered-containers
, unordered-containers
, vector
, vector
...
@@ -826,6 +829,7 @@ executable gargantext-upgrade
...
@@ -826,6 +829,7 @@ executable gargantext-upgrade
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -O2 -Wmissing-signatures
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -O2 -Wmissing-signatures
build-depends:
build-depends:
base
base
, cron
, extra
, extra
, gargantext
, gargantext
, gargantext-prelude
, gargantext-prelude
...
...
package.yaml
View file @
19c6f5ad
...
@@ -330,15 +330,17 @@ executables:
...
@@ -330,15 +330,17 @@ executables:
-
-fprof-auto
-
-fprof-auto
dependencies
:
dependencies
:
-
base
-
base
-
cassava
-
containers
-
containers
-
cron
-
full-text-search
-
gargantext
-
gargantext
-
gargantext-prelude
-
gargantext-prelude
-
vector
-
cassava
-
ini
-
ini
-
optparse-generic
-
optparse-generic
-
postgresql-simple
-
unordered-containers
-
unordered-containers
-
full-text-search
-
vector
gargantext-cli
:
gargantext-cli
:
main
:
Main.hs
main
:
Main.hs
...
@@ -421,6 +423,7 @@ executables:
...
@@ -421,6 +423,7 @@ executables:
-
gargantext
-
gargantext
-
gargantext-prelude
-
gargantext-prelude
-
base
-
base
-
cron
gargantext-invitations
:
gargantext-invitations
:
main
:
Main.hs
main
:
Main.hs
...
@@ -451,6 +454,7 @@ executables:
...
@@ -451,6 +454,7 @@ executables:
-
gargantext-prelude
-
gargantext-prelude
-
base
-
base
-
postgresql-simple
-
postgresql-simple
-
cron
gargantext-admin
:
gargantext-admin
:
main
:
Main.hs
main
:
Main.hs
...
...
delanoe
@anoe
mentioned in issue
#204 (closed)
·
May 12, 2023
mentioned in issue
#204 (closed)
mentioned in issue #204
Toggle commit list
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