Skip to content

Commit

Permalink
Merge pull request #195 from bpow/branding-orion
Browse files Browse the repository at this point in the history
Branding changes for the ORION name
  • Loading branch information
EvanDietzMorris authored Feb 14, 2024
2 parents 2c777a2 + 2507270 commit 7e5c208
Show file tree
Hide file tree
Showing 40 changed files with 360 additions and 354 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
echo "ROBOKOP_HOME=$PWD" >> $GITHUB_ENV
mkdir -p $PWD/tests/logs
mkdir -p $PWD/tests/storage
echo "DATA_SERVICES_LOGS=$PWD/tests/logs" >> $GITHUB_ENV
echo "DATA_SERVICES_STORAGE=$PWD/tests/storage" >> $GITHUB_ENV
echo "ORION_LOGS=$PWD/tests/logs" >> $GITHUB_ENV
echo "ORION_STORAGE=$PWD/tests/storage" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down
24 changes: 12 additions & 12 deletions Common/build_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class GraphBuilder:

def __init__(self):

self.logger = LoggingUtil.init_logging("Data_services.Common.GraphBuilder",
self.logger = LoggingUtil.init_logging("ORION.Common.GraphBuilder",
line_format='medium',
log_file_path=os.environ['DATA_SERVICES_LOGS'])
log_file_path=os.environ['ORION_LOGS'])

self.current_graph_versions = {}
self.graphs_dir = self.init_graphs_dir() # path to the graphs output directory
Expand Down Expand Up @@ -281,9 +281,9 @@ def run_qc(self,
return qc_metadata

def load_graph_specs(self):
if 'DATA_SERVICES_GRAPH_SPEC' in os.environ and os.environ['DATA_SERVICES_GRAPH_SPEC']:
if 'ORION_GRAPH_SPEC' in os.environ and os.environ['ORION_GRAPH_SPEC']:
# this is a messy way to find the graph spec path, mainly for testing - URL is preferred
graph_spec_file = os.environ['DATA_SERVICES_GRAPH_SPEC']
graph_spec_file = os.environ['ORION_GRAPH_SPEC']
graph_spec_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'graph_specs', graph_spec_file)
if os.path.exists(graph_spec_path):
self.logger.info(f'Loading graph spec: {graph_spec_file}')
Expand All @@ -292,15 +292,15 @@ def load_graph_specs(self):
return self.parse_graph_spec(graph_spec_yaml)
else:
raise Exception(f'Configuration Error - Graph Spec could not be found: {graph_spec_file}')
elif 'DATA_SERVICES_GRAPH_SPEC_URL' in os.environ:
graph_spec_url = os.environ['DATA_SERVICES_GRAPH_SPEC_URL']
elif 'ORION_GRAPH_SPEC_URL' in os.environ:
graph_spec_url = os.environ['ORION_GRAPH_SPEC_URL']
graph_spec_request = requests.get(graph_spec_url)
graph_spec_request.raise_for_status()
graph_spec_yaml = yaml.full_load(graph_spec_request.text)
return self.parse_graph_spec(graph_spec_yaml)
else:
raise Exception(f'Configuration Error - No Graph Spec was configured. Set the environment variable '
f'DATA_SERVICES_GRAPH_SPEC_URL to a URL with a valid Graph Spec yaml file. '
f'ORION_GRAPH_SPEC_URL to a URL with a valid Graph Spec yaml file. '
f'See the README for more info.')

def parse_graph_spec(self, graph_spec_yaml):
Expand Down Expand Up @@ -436,7 +436,7 @@ def get_graph_dir_path(self, graph_id: str, graph_version: str):
return os.path.join(self.graphs_dir, graph_id, graph_version)

def get_graph_output_URL(self, graph_id: str, graph_version: str):
graph_output_url = os.environ['DATA_SERVICES_OUTPUT_URL']
graph_output_url = os.environ['ORION_OUTPUT_URL']
if graph_output_url[-1] != '/':
graph_output_url += '/'
return f'{graph_output_url}{graph_id}/{graph_version}/'
Expand Down Expand Up @@ -475,14 +475,14 @@ def generate_graph_version(graph_spec: GraphSpec):

@staticmethod
def init_graphs_dir():
# use the directory specified by the environment variable DATA_SERVICES_GRAPHS
if 'DATA_SERVICES_GRAPHS' in os.environ and os.path.isdir(os.environ['DATA_SERVICES_GRAPHS']):
return os.environ['DATA_SERVICES_GRAPHS']
# use the directory specified by the environment variable ORION_GRAPHS
if 'ORION_GRAPHS' in os.environ and os.path.isdir(os.environ['ORION_GRAPHS']):
return os.environ['ORION_GRAPHS']
else:
# if graph dir is invalid or not specified back out
raise IOError(
'GraphBuilder graphs directory not found. '
'Specify a valid directory with environment variable DATA_SERVICES_GRAPHS.')
'Specify a valid directory with environment variable ORION_GRAPHS.')


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion Common/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, container_name: str, logger):
# placeholders for overriding
self.default_image = None
self.default_ports = None
self.default_volumes = [f"{os.environ['HOST_STORAGE_DIR']}:/Data_services_storage"]
self.default_volumes = [f"{os.environ['HOST_STORAGE_DIR']}:/ORION_storage"]
self.environment_vars = {}
def run(self,
Expand Down
4 changes: 2 additions & 2 deletions Common/kgx_file_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class KGXFileMerger:
def __init__(self,
output_directory: str):
self.output_directory = output_directory
self.logger = LoggingUtil.init_logging("Data_services.Common.KGXFileMerger",
self.logger = LoggingUtil.init_logging("ORION.Common.KGXFileMerger",
line_format='medium',
log_file_path=os.environ['DATA_SERVICES_LOGS'])
log_file_path=os.environ['ORION_LOGS'])

def merge(self,
graph_spec: GraphSpec,
Expand Down
4 changes: 2 additions & 2 deletions Common/kgx_file_normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def __init__(self, error_message: str, actual_error: Exception=None):
#
class KGXFileNormalizer:

logger = LoggingUtil.init_logging("Data_services.Common.KGXFileNormalizer",
logger = LoggingUtil.init_logging("ORION.Common.KGXFileNormalizer",
line_format='medium',
level=logging.INFO,
log_file_path=os.environ['DATA_SERVICES_LOGS'])
log_file_path=os.environ['ORION_LOGS'])

def __init__(self,
source_nodes_file_path: str,
Expand Down
4 changes: 2 additions & 2 deletions Common/kgx_file_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

class KGXFileWriter:

logger = LoggingUtil.init_logging("Data_services.Common.KGXFileWriter",
logger = LoggingUtil.init_logging("ORION.Common.KGXFileWriter",
line_format='medium',
level=logging.DEBUG,
log_file_path=os.environ.get('DATA_SERVICES_LOGS'))
log_file_path=os.environ.get('ORION_LOGS'))
"""
constructor
:param nodes_output_file_path: the file path for the nodes file
Expand Down
20 changes: 10 additions & 10 deletions Common/load_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def __init__(self,
test_mode: bool = False,
fresh_start_mode: bool = False):

self.logger = LoggingUtil.init_logging("Data_services.Common.SourceDataManager",
self.logger = LoggingUtil.init_logging("ORION.Common.SourceDataManager",
line_format='medium',
log_file_path=os.environ['DATA_SERVICES_LOGS'])
log_file_path=os.environ['ORION_LOGS'])

self.test_mode = test_mode
if test_mode:
Expand Down Expand Up @@ -682,15 +682,15 @@ def get_source_version_path(self, source_id: str, source_version: str):
return os.path.join(self.storage_dir, source_id, source_version)

def init_storage_dir(self):
# use the storage directory specified by the environment variable DATA_SERVICES_STORAGE
# use the storage directory specified by the environment variable ORION_STORAGE
# check to make sure it's set and valid, otherwise fail
if "DATA_SERVICES_STORAGE" not in os.environ:
raise Exception(f'You must use the environment variable DATA_SERVICES_STORAGE '
if "ORION_STORAGE" not in os.environ:
raise Exception(f'You must use the environment variable ORION_STORAGE '
f'to specify a storage directory.')
if os.path.isdir(os.environ["DATA_SERVICES_STORAGE"]):
return os.environ["DATA_SERVICES_STORAGE"]
if os.path.isdir(os.environ["ORION_STORAGE"]):
return os.environ["ORION_STORAGE"]
else:
raise IOError(f'Storage directory not valid: {os.environ["DATA_SERVICES_STORAGE"]}')
raise IOError(f'Storage directory not valid: {os.environ["ORION_STORAGE"]}')

def init_source_output_dir(self, source_id: str):
source_dir_path = os.path.join(self.storage_dir, source_id)
Expand All @@ -715,8 +715,8 @@ def init_source_output_dir(self, source_id: str):
'in the finalized kgx files.')
args = parser.parse_args()

if 'DATA_SERVICES_TEST_MODE' in os.environ:
test_mode_from_env = os.environ['DATA_SERVICES_TEST_MODE']
if 'ORION_TEST_MODE' in os.environ:
test_mode_from_env = os.environ['ORION_TEST_MODE']
else:
test_mode_from_env = False

Expand Down
6 changes: 3 additions & 3 deletions Common/loader_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, test_mode: bool = False, source_data_dir: str = None):
if not os.path.exists(self.data_path):
os.mkdir(self.data_path)
else:
self.data_path = os.environ.get("DATA_SERVICES_STORAGE")
self.data_path = os.environ.get("ORION_STORAGE")

# the final output lists of nodes and edges
self.final_node_list: list = []
Expand All @@ -44,10 +44,10 @@ def __init__(self, test_mode: bool = False, source_data_dir: str = None):
self.output_file_writer: KGXFileWriter = None

# create a logger
self.logger = LoggingUtil.init_logging(f"Data_services.parsers.{self.get_name()}",
self.logger = LoggingUtil.init_logging(f"ORION.parsers.{self.get_name()}",
level=logging.INFO,
line_format='medium',
log_file_path=os.environ.get('DATA_SERVICES_LOGS'))
log_file_path=os.environ.get('ORION_LOGS'))

def get_latest_source_version(self):
"""Determine and return the latest source version ie. a unique identifier associated with the latest version."""
Expand Down
6 changes: 3 additions & 3 deletions Common/neo4j_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def __init__(self,
self.http_port = http_port
self.https_port = https_port
self.bolt_port = bolt_port
self.password = password if password else os.environ['DATA_SERVICES_NEO4J_PASSWORD']
self.password = password if password else os.environ['ORION_NEO4J_PASSWORD']
self.graph_db_uri = f'bolt://{neo4j_host}:{bolt_port}'
self.graph_db_auth = ("neo4j", self.password)
self.neo4j_driver = neo4j.GraphDatabase.driver(self.graph_db_uri, auth=self.graph_db_auth)
self.logger = LoggingUtil.init_logging("Data_services.Common.neo4j_tools",
self.logger = LoggingUtil.init_logging("ORION.Common.neo4j_tools",
line_format='medium',
log_file_path=os.environ['DATA_SERVICES_LOGS'])
log_file_path=os.environ['ORION_LOGS'])

def import_csv_files(self,
graph_directory: str,
Expand Down
6 changes: 3 additions & 3 deletions Common/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def __init__(self,
:param node_normalization_version - not implemented yet
"""
# create a logger
self.logger = LoggingUtil.init_logging("Data_services.Common.NodeNormalizer",
self.logger = LoggingUtil.init_logging("ORION.Common.NodeNormalizer",
level=log_level,
line_format='medium',
log_file_path=os.environ.get('DATA_SERVICES_LOGS'))
log_file_path=os.environ.get('ORION_LOGS'))
# storage for regular nodes that failed to normalize
self.failed_to_normalize_ids = set()
# storage for variant nodes that failed to normalize
Expand Down Expand Up @@ -361,7 +361,7 @@ def __init__(self,
:param log_level - overrides default log level
"""
# create a logger
self.logger = LoggingUtil.init_logging("Data_services.Common.EdgeNormalizer", level=log_level, line_format='medium', log_file_path=os.environ.get('DATA_SERVICES_LOGS'))
self.logger = LoggingUtil.init_logging("ORION.Common.EdgeNormalizer", level=log_level, line_format='medium', log_file_path=os.environ.get('ORION_LOGS'))
# normalization map for future look up of all normalized predicates
self.edge_normalization_lookup = {}
self.cached_edge_norms = {}
Expand Down
6 changes: 3 additions & 3 deletions Common/supplementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class SequenceVariantSupplementation:

def __init__(self):

self.logger = LoggingUtil.init_logging("Data_services.Common.SequenceVariantSupplementation",
self.logger = LoggingUtil.init_logging("ORION.Common.SequenceVariantSupplementation",
line_format='medium',
log_file_path=environ['DATA_SERVICES_LOGS'])
workspace_dir = environ["DATA_SERVICES_STORAGE"]
log_file_path=environ['ORION_LOGS'])
workspace_dir = environ["ORION_STORAGE"]

# if the snpEff dir exists, assume we already downloaded it
self.snpeff_dir = path.join(workspace_dir, "snpEff")
Expand Down
6 changes: 3 additions & 3 deletions Common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def init_logging(name, level=logging.INFO, line_format='minimum', log_file_path=
stream_handler.setFormatter(formatter)

# set the logging level
if 'DATA_SERVICES_TEST_MODE' in os.environ and os.environ['DATA_SERVICES_TEST_MODE']:
if 'ORION_TEST_MODE' in os.environ and os.environ['ORION_TEST_MODE']:
level = logging.DEBUG
logger.setLevel(level)

Expand Down Expand Up @@ -116,7 +116,7 @@ def __init__(self, log_level=logging.INFO):
:param log_level - overrides default log level
"""
# create a logger
self.logger = LoggingUtil.init_logging("Data_services.Common.GetData", level=log_level, line_format='medium', log_file_path=os.environ.get('DATA_SERVICES_LOGS'))
self.logger = LoggingUtil.init_logging("ORION.Common.GetData", level=log_level, line_format='medium', log_file_path=os.environ.get('ORION_LOGS'))

@staticmethod
def pull_via_ftp_binary(ftp_site, ftp_dir, ftp_file):
Expand Down Expand Up @@ -436,7 +436,7 @@ def format_normalization_failures(data_set_name: str, node_norm_failures: list,
:param edge_norm_failures: set of edge predicates
:return:
"""
the_logger = LoggingUtil.init_logging(f"Data_services.Common.NormFailures.{data_set_name}", level=logging.INFO, line_format='medium', log_file_path=os.path.join(Path(__file__).parents[1], 'logs'))
the_logger = LoggingUtil.init_logging(f"ORION.Common.NormFailures.{data_set_name}", level=logging.INFO, line_format='medium', log_file_path=os.path.join(Path(__file__).parents[1], 'logs'))

# get the list into a dataframe group
df = pd.DataFrame(node_norm_failures, columns=['curie'])
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ RUN apt-get update \
&& apt-get -y install git \
&& apt-get -y install vim

COPY ./requirements.txt /Data_services/requirements.txt
COPY ./requirements.txt /ORION/requirements.txt

RUN pip3 install -r /Data_services/requirements.txt
RUN pip3 install -r /ORION/requirements.txt

COPY . /Data_services/.
COPY . /ORION/.

RUN chmod -R 777 /Data_services
RUN chmod -R 777 /ORION


ENV PYTHONPATH "$PYTHONPATH:/Data_services"
ENV PYTHONPATH "$PYTHONPATH:/ORION"
Loading

0 comments on commit 7e5c208

Please sign in to comment.