|
@@ -5,6 +5,7 @@ import warnings
|
|
from datetime import datetime
|
|
from datetime import datetime
|
|
|
|
|
|
from matplotlib.gridspec import GridSpec
|
|
from matplotlib.gridspec import GridSpec
|
|
|
|
+from chainer_addons.utils.sacred import MPIExperiment
|
|
|
|
|
|
def parse_date(date, fmt="{:d}-{:02d}-{:02d} 00:00:00"):
|
|
def parse_date(date, fmt="{:d}-{:02d}-{:02d} 00:00:00"):
|
|
if isinstance(date, str):
|
|
if isinstance(date, str):
|
|
@@ -25,15 +26,10 @@ def query_to_str(query):
|
|
|
|
|
|
class SacredPlotter(object):
|
|
class SacredPlotter(object):
|
|
|
|
|
|
- @staticmethod
|
|
|
|
- def auth_url(creds, host="localhost"):
|
|
|
|
- url = "mongodb://{user}:{password}@{host}:27017/{db_name}?authSource=admin".format(
|
|
|
|
- host=host, **creds)
|
|
|
|
- return url
|
|
|
|
-
|
|
|
|
- def __init__(self, creds):
|
|
|
|
|
|
+ def __init__(self, creds, host=None, port=None):
|
|
super(SacredPlotter, self).__init__()
|
|
super(SacredPlotter, self).__init__()
|
|
- self.client = pym.MongoClient(SacredPlotter.auth_url(creds))
|
|
|
|
|
|
+ auth_url = MPIExperiment.auth_url(creds, host=host, port=port)
|
|
|
|
+ self.client = pym.MongoClient(auth_url)
|
|
|
|
|
|
self.db = self.client[creds["db_name"]]
|
|
self.db = self.client[creds["db_name"]]
|
|
self.metrics = self.db["metrics"]
|
|
self.metrics = self.db["metrics"]
|