Skip to content

Commit

Permalink
Merge branch 'issue764/add-logging-to-wfi' into develop
Browse files Browse the repository at this point in the history
Add logging to WFI: enable logging in gdb_driver neo4j_driver and neo4j_cypher
  • Loading branch information
pagrubel committed Mar 20, 2024
2 parents 2ea76d9 + e51ac93 commit 63ea393
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions beeflow/common/gdb/gdb_driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Abstract base class for the handling of workflow DAGs."""

from abc import ABC, abstractmethod
from beeflow.common import log as bee_logging

log = bee_logging.setup(__name__)


class GraphDatabaseDriver(ABC):
Expand Down
3 changes: 3 additions & 0 deletions beeflow/common/gdb/neo4j_cypher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Neo4j/Cypher transaction functions used by the Neo4jDriver class."""

from re import fullmatch
from beeflow.common import log as bee_logging

log = bee_logging.setup(__name__)


def create_workflow_node(tx, workflow):
Expand Down
4 changes: 4 additions & 0 deletions beeflow/common/gdb/neo4j_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from beeflow.common.gdb import neo4j_cypher as tx
from beeflow.common.wf_data import (Workflow, Task, Requirement, Hint,
InputParameter, OutputParameter, StepInput, StepOutput)
from beeflow.common import log as bee_logging

log = bee_logging.setup(__name__)

# Default Neo4j authentication
# We may want to instead get these from a config at some point
Expand Down Expand Up @@ -51,6 +54,7 @@ def __init__(self, user=DEFAULT_USER, password=DEFAULT_PASSWORD, **kwargs):
# Connect to the Neo4j database using the Neo4j proprietary driver
self._driver = Neo4jDatabase.driver(uri, auth=(user, password))
except ServiceUnavailable as sue:
log.error("Neo4j database is unavailable")
raise Neo4JNotRunning("Neo4j database is unavailable") from sue

def initialize_workflow(self, workflow):
Expand Down
5 changes: 5 additions & 0 deletions beeflow/common/wf_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"""

import re
from beeflow.common import log as bee_logging

log = bee_logging.setup(__name__)


class WorkflowInterface:
Expand Down Expand Up @@ -33,6 +36,7 @@ def initialize_workflow(self, workflow):
:type workflow: Workflow
"""
if self.workflow_loaded():
log.error("attempt to re-initialize existing workflow")
raise RuntimeError("attempt to re-initialize existing workflow")
if workflow.requirements is None:
workflow.requirements = []
Expand Down Expand Up @@ -107,6 +111,7 @@ def restart_task(self, task, checkpoint_file):
self.set_workflow_state("FAILED")
return None
else:
log.error("invalid task for checkpoint restart")
raise ValueError("invalid task for checkpoint restart")

new_task = task.copy(new_id=True)
Expand Down

0 comments on commit 63ea393

Please sign in to comment.