Skip to content

Commit

Permalink
Fixed password env
Browse files Browse the repository at this point in the history
  • Loading branch information
timbleimehl committed Apr 16, 2020
1 parent 942e271 commit 4c72112
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
10 changes: 1 addition & 9 deletions motherlode/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DEFAULT(ConfigBase):
# Always create a DEFAULT class and use it as the base class for other environments classes
NEO4J_URL = "bolt://localhost:7687"
NEO4J_USER = "neo4j"
NEO4J_PW = "test" #
NEO4J_PASSWORD = "test" #

CONTINUE_WHEN_ONE_DATALOADER_FAILS = False

Expand All @@ -24,14 +24,6 @@ class DEFAULT(ConfigBase):
# DOCKER_DEAMON_BASE_URL = "tcp://127.0.0.1:1234"
DOCKER_DEAMON_BASE_URL = "unix://var/run/docker.sock"

def get_graph(self):
if self.NEO4J_USER is not None:
return py2neo.Graph(
self.NEO4J_URL, password=self.NEO4J_PASSWORD, user=self.NEO4J_USER
)
else:
return py2neo.Graph(self.NEO4J_URL)


# All following config classes inherit from DEFAULT
class PROD(DEFAULT):
Expand Down
18 changes: 14 additions & 4 deletions motherlode/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,29 @@
docker_client = docker.DockerClient(base_url=config.DOCKER_DEAMON_BASE_URL)


def get_graph():
if config.NEO4J_USER is not None:
return py2neo.Graph(
config.NEO4J_URL, password=config.NEO4J_PASSWORD, user=config.NEO4J_USER
)
else:
return py2neo.Graph(config.NEO4J_URL)


def create_log_node(dataloader_name, image):
n = py2neo.Node("LoadingLog")
n["loader"] = dataloader_name
n["dockerhub_image_name"] = image.tags[0]
n["dockerhub_image_hash"] = image.id
n["loading_finished_at"] = str(datetime.datetime.now(tz=None))
tx = config.get_graph().begin()
tx = get_graph().begin()
tx.create(n)
tx.commit()


def get_log_nodes(dataloader_name, image):
return list(
py2neo.NodeMatcher(config.get_graph()).match(
py2neo.NodeMatcher(get_graph()).match(
"LoadingLog",
dockerhub_image_name=image.tags[0],
dockerhub_image_hash=image.id,
Expand Down Expand Up @@ -123,6 +132,7 @@ def absolute_volume_path(volumes):


def run_datasource_containers():

create_log_dir()
# gather env vars
env_vars = {}
Expand All @@ -134,8 +144,8 @@ def run_datasource_containers():
env_vars["GC_NEO4J_URL"] = config.NEO4J_URL
if config.NEO4J_USER is not None:
env_vars["GC_NEO4J_USER"] = config.NEO4J_USER
if config.NEO4J_PW is not None:
env_vars["GC_NEO4J_PASSWORD"] = config.NEO4J_PW
if config.NEO4J_PASSWORD is not None:
env_vars["GC_NEO4J_PASSWORD"] = config.NEO4J_PASSWORD
env_vars.update(config.OTHER_ENV_IN_DOCKER_CONTAINERS.items())

for datasource in get_sorted_data_sources(DataSourcesRegistry):
Expand Down

0 comments on commit 4c72112

Please sign in to comment.