Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
77b45967
Commit
77b45967
authored
Dec 17, 2019
by
Markus Scheidgen
Browse files
Merge branch 'v0.6.4' into 'master'
Applied mongo connection fix. See merge request
!70
parents
83b65f15
95c33501
Pipeline
#65667
passed with stage
in 32 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
nomad/infrastructure.py
View file @
77b45967
...
...
@@ -28,7 +28,8 @@ from sqlalchemy import create_engine
from
sqlalchemy.orm
import
Session
from
elasticsearch.exceptions
import
RequestError
from
elasticsearch_dsl
import
connections
from
mongoengine
import
connect
from
mongoengine
import
connect
,
disconnect
from
mongoengine.connection
import
MongoEngineConnectionError
from
passlib.hash
import
bcrypt
import
smtplib
from
email.mime.text
import
MIMEText
...
...
@@ -80,7 +81,12 @@ def setup_logging():
def
setup_mongo
():
""" Creates connection to mongodb. """
global
mongo_client
mongo_client
=
connect
(
db
=
config
.
mongo
.
db_name
,
host
=
config
.
mongo
.
host
,
port
=
config
.
mongo
.
port
)
try
:
mongo_client
=
connect
(
db
=
config
.
mongo
.
db_name
,
host
=
config
.
mongo
.
host
,
port
=
config
.
mongo
.
port
)
except
MongoEngineConnectionError
:
disconnect
()
mongo_client
=
connect
(
db
=
config
.
mongo
.
db_name
,
host
=
config
.
mongo
.
host
,
port
=
config
.
mongo
.
port
)
logger
.
info
(
'setup mongo connection'
)
return
mongo_client
...
...
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