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
159
Issues
159
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
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
a3f4230d
Verified
Commit
a3f4230d
authored
Oct 04, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ini] generate .toml from .ini for workers as well
parent
f179e5aa
Pipeline
#6756
failed with stages
in 31 minutes and 58 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
7 deletions
+40
-7
Ini.hs
bin/gargantext-cli/CLI/Ini.hs
+4
-2
gargantext-settings.toml_toModify
gargantext-settings.toml_toModify
+19
-0
Config.hs
src/Gargantext/Core/Config.hs
+1
-2
Worker.hs
src/Gargantext/Core/Config/Worker.hs
+16
-3
No files found.
bin/gargantext-cli/CLI/Ini.hs
View file @
a3f4230d
...
...
@@ -28,7 +28,7 @@ import Gargantext.Core.Config.Ini.Ini qualified as Ini
import
Gargantext.Core.Config.Ini.Mail
qualified
as
IniMail
import
Gargantext.Core.Config.Ini.NLP
qualified
as
IniNLP
import
Gargantext.Core.Config.Types
qualified
as
CTypes
import
Gargantext.Core.Config.Worker
(
WorkerSettings
(
..
))
import
Gargantext.Core.Config.Worker
(
WorkerSettings
(
..
)
,
WorkerDefinition
(
..
)
)
import
Gargantext.Prelude
import
Options.Applicative
import
Servant.Client.Core
(
parseBaseUrl
)
...
...
@@ -84,7 +84,7 @@ convertConfigs ini@(Ini.GargConfig { .. }) iniMail nlpConfig connInfo =
,
_gc_apis
=
CTypes
.
APIsConfig
{
_ac_pubmed_api_key
=
_gc_pubmed_api_key
,
_ac_epo_api_url
=
_gc_epo_api_url
,
_ac_scrapyd_url
}
,
_gc_worker
=
WorkerSettings
{
_wsDefinitions
=
[]
,
_gc_worker
=
WorkerSettings
{
_wsDefinitions
=
[
wd
]
,
_wsDefaultVisibilityTimeout
=
1
,
_wsDatabase
=
connInfo
{
PGS
.
connectDatabase
=
"pgmq"
}
}
,
_gc_log_level
=
LevelDebug
...
...
@@ -94,6 +94,8 @@ convertConfigs ini@(Ini.GargConfig { .. }) iniMail nlpConfig connInfo =
case
parseBaseUrl
"http://localhost:6800"
of
Nothing
->
panicTrace
"Cannot parse base url for scrapyd"
Just
b
->
b
wd
=
WorkerDefinition
{
_wdName
=
"default"
,
_wdQueue
=
"default"
}
mkFrontendConfig
::
Ini
.
GargConfig
->
CTypes
.
FrontendConfig
mkFrontendConfig
(
Ini
.
GargConfig
{
..
})
=
...
...
gargantext-settings.toml_toModify
View file @
a3f4230d
...
...
@@ -141,3 +141,22 @@ dispatcher = { bind = "tcp://*:5561", connect = "tcp://localhost:5561" }
# - johnsnows:// (for https:// JohnSnow)
EN = "spacy://localhost:8000"
FR = "spacy://localhost:8001"
[worker]
# After this number of seconds, the job will be available again.
# You can set timeout for each job individually and this is the
# preferred method over using defaultVt.
default_visibility_timeout = 1
[worker.database]
host = "127.0.0.1"
port = 5432
name = "pgmq"
user = "gargantua"
pass = "C8kdcUrAQy66U"
[[worker.definitions]]
name = "default"
queue = "default"
src/Gargantext/Core/Config.hs
View file @
a3f4230d
...
...
@@ -114,8 +114,7 @@ instance ToTable GargConfig where
,
"mail"
.=
_gc_mail_config
,
"notifications"
.=
_gc_notifications_config
,
"nlp"
.=
_gc_nlp_config
-- TODO
-- , "worker" .= _gc_worker
,
"worker"
.=
_gc_worker
]
...
...
src/Gargantext/Core/Config/Worker.hs
View file @
a3f4230d
...
...
@@ -23,9 +23,9 @@ broker-agnostic.
module
Gargantext.Core.Config.Worker
where
import
Async.Worker.Broker.Types
qualified
as
Broker
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Core.Config.Types
(
unTOMLConnectInfo
)
import
Database.PGMQ.Types
qualified
as
PGMQ
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Core.Config.Types
(
unTOMLConnectInfo
,
TOMLConnectInfo
(
..
))
import
Gargantext.Prelude
import
Toml.Schema
...
...
@@ -47,10 +47,17 @@ instance FromValue WorkerSettings where
fromValue
=
parseTableFromValue
$
do
dbConfig
<-
reqKey
"database"
_wsDefinitions
<-
reqKey
"definitions"
let
_wsDefaultVisibilityTimeout
=
1
_wsDefaultVisibilityTimeout
<-
reqKey
"default_visibility_timeout"
return
$
WorkerSettings
{
_wsDatabase
=
unTOMLConnectInfo
dbConfig
,
_wsDefinitions
,
_wsDefaultVisibilityTimeout
}
instance
ToValue
WorkerSettings
where
toValue
=
defaultTableToValue
instance
ToTable
WorkerSettings
where
toTable
(
WorkerSettings
{
..
})
=
table
[
"database"
.=
TOMLConnectInfo
_wsDatabase
,
"default_visibility_timeout"
.=
_wsDefaultVisibilityTimeout
,
"definitions"
.=
_wsDefinitions
]
data
WorkerDefinition
=
WorkerDefinition
{
...
...
@@ -62,6 +69,12 @@ instance FromValue WorkerDefinition where
_wdName
<-
reqKey
"name"
queue
<-
reqKey
"queue"
return
$
WorkerDefinition
{
_wdQueue
=
Broker
.
Queue
queue
,
..
}
instance
ToValue
WorkerDefinition
where
toValue
=
defaultTableToValue
instance
ToTable
WorkerDefinition
where
toTable
(
WorkerDefinition
{
..
})
=
table
[
"name"
.=
_wdName
,
"queue"
.=
Broker
.
_Queue
_wdQueue
]
findDefinitionByName
::
WorkerSettings
->
WorkerName
->
Maybe
WorkerDefinition
findDefinitionByName
(
WorkerSettings
{
_wsDefinitions
})
workerName
=
...
...
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