Commit 0d2c688f authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[john snow] add cache volume in docker-compose, fix "message" Maybe

parent 3edc87d8
Pipeline #2427 failed with stage
in 0 seconds
......@@ -37,8 +37,11 @@ services:
johnsnownlp:
image: 'johnsnowlabs/nlp-server:latest'
volumes:
- js-cache:/home/johnsnowlabs/cache_pretrained
ports:
- 5000:5000
volumes:
garg-pgdata:
js-cache:
......@@ -15,7 +15,7 @@ module Gargantext.Utils.JohnSnowNLP where
import Control.Concurrent (threadDelay)
import Control.Lens
import Data.Aeson (encode, ToJSON, toJSON, FromJSON, parseJSON, Value(..), (.:))
import Data.Aeson (encode, ToJSON, toJSON, FromJSON, parseJSON, Value(..), (.:), (.:?))
import Data.Aeson.Types (prependFailure, typeMismatch)
import Data.Aeson.TH (deriveJSON)
import qualified Data.List.Safe as LS
......@@ -89,7 +89,7 @@ instance FromJSON JSAsyncTaskStatus where
parseJSON (Object v) = do
status <- v .: "status"
code <- status .: "code"
message <- status .: "message"
message <- status .:? "message"
pure $ JSAsyncTaskStatus { _jsAsyncTaskStatus_code = code
, _jsAsyncTaskStatus_message = message }
parseJSON s =
......@@ -176,7 +176,7 @@ waitForJsTask jsTask = wait' 0
panic "[waitForJsTask] waited for 1 minute and still no answer from JohnSnow NLP"
else do
printDebug "[waitForJsTask] task not ready, waiting" counter
_ <- threadDelay $ 100000*1
_ <- threadDelay $ 1000000*1
wait' $ counter + 1
getPosTagAndLems :: Lang -> Text -> IO PosSentences
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment