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

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

parent 3edc87d8
...@@ -37,8 +37,11 @@ services: ...@@ -37,8 +37,11 @@ services:
johnsnownlp: johnsnownlp:
image: 'johnsnowlabs/nlp-server:latest' image: 'johnsnowlabs/nlp-server:latest'
volumes:
- js-cache:/home/johnsnowlabs/cache_pretrained
ports: ports:
- 5000:5000 - 5000:5000
volumes: volumes:
garg-pgdata: garg-pgdata:
js-cache:
...@@ -15,7 +15,7 @@ module Gargantext.Utils.JohnSnowNLP where ...@@ -15,7 +15,7 @@ module Gargantext.Utils.JohnSnowNLP where
import Control.Concurrent (threadDelay) import Control.Concurrent (threadDelay)
import Control.Lens 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.Types (prependFailure, typeMismatch)
import Data.Aeson.TH (deriveJSON) import Data.Aeson.TH (deriveJSON)
import qualified Data.List.Safe as LS import qualified Data.List.Safe as LS
...@@ -89,7 +89,7 @@ instance FromJSON JSAsyncTaskStatus where ...@@ -89,7 +89,7 @@ instance FromJSON JSAsyncTaskStatus where
parseJSON (Object v) = do parseJSON (Object v) = do
status <- v .: "status" status <- v .: "status"
code <- status .: "code" code <- status .: "code"
message <- status .: "message" message <- status .:? "message"
pure $ JSAsyncTaskStatus { _jsAsyncTaskStatus_code = code pure $ JSAsyncTaskStatus { _jsAsyncTaskStatus_code = code
, _jsAsyncTaskStatus_message = message } , _jsAsyncTaskStatus_message = message }
parseJSON s = parseJSON s =
...@@ -176,7 +176,7 @@ waitForJsTask jsTask = wait' 0 ...@@ -176,7 +176,7 @@ waitForJsTask jsTask = wait' 0
panic "[waitForJsTask] waited for 1 minute and still no answer from JohnSnow NLP" panic "[waitForJsTask] waited for 1 minute and still no answer from JohnSnow NLP"
else do else do
printDebug "[waitForJsTask] task not ready, waiting" counter printDebug "[waitForJsTask] task not ready, waiting" counter
_ <- threadDelay $ 100000*1 _ <- threadDelay $ 1000000*1
wait' $ counter + 1 wait' $ counter + 1
getPosTagAndLems :: Lang -> Text -> IO PosSentences 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