Skip to content

Commit

Permalink
repairing pylint and tester errors
Browse files Browse the repository at this point in the history
  • Loading branch information
PhillipsOwen committed Aug 1, 2023
1 parent f511af8 commit e4feb7b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/common/pg_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def __del__(self):
PGUtilsMultiConnect.__del__(self)

def build_asgs_constants(self) -> dict:
"""
builds the in-memory data for asgs constants.
:return:
"""
# create a list of target lu tables
lu_tables = ['ASGS_Mon_site_lu', 'ASGS_Mon_event_type_lu', 'ASGS_Mon_state_type_lu', 'ASGS_Mon_instance_state_type_lu']

Expand Down Expand Up @@ -96,7 +101,7 @@ def get_lu_items(self, lu_name: str):
ret_val = lu_data

# return to the caller
return lu_data
return ret_val

def get_lu_id_from_msg(self, msg_obj, param_name: str, lu_name: str, context: str = 'unknown'):
"""
Expand Down Expand Up @@ -144,7 +149,7 @@ def get_lu_id(self, element_name, lu_name, context: str = 'unknown'):
# return to the caller
return ret_id

def get_site_ids(self, context='unknown') -> list:
def get_site_ids(self) -> list:
"""
gets the list of site ids for the ASGS run properties message handler
Expand Down
6 changes: 3 additions & 3 deletions src/common/queue_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def asgs_run_props_callback(self, channel, method, properties, body) -> bool:
self.logger.debug("site_id: %s, context: %s", str(site_id), context)

# filter out handing - accept runs for all locations, except UCF and George Mason runs for now
site_ids = self.db_info.get_site_ids(context=context)
site_ids: list = self.db_info.get_site_ids()

# init the instance id
instance_id: int = 0
Expand Down Expand Up @@ -524,7 +524,7 @@ def ecflow_run_props_callback(self, channel, method, properties, body) -> bool:
self.logger.debug("site_id: %s, context: %s", str(site_id), context)

# filter out handing - accept runs for all locations, except UCF and George Mason runs for now
site_ids = self.db_info.get_site_ids(context=context)
site_ids: list = self.db_info.get_site_ids()

# init the instance id
instance_id: int = 0
Expand Down Expand Up @@ -653,7 +653,7 @@ def hecras_run_props_callback(self, channel, method, properties, body) -> bool:
self.logger.debug("site_id: %s, context: %s", str(site_id), context)

# filter out handing - accept runs for all locations, except UCF and George Mason runs for now
site_ids = self.db_info.get_site_ids(context=context)
site_ids: list = self.db_info.get_site_ids()

# init the instance id
instance_id: int = 0
Expand Down
23 changes: 21 additions & 2 deletions src/test/test_get_lu_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# SPDX-License-Identifier: LicenseRef-RENCI
# SPDX-License-Identifier: MIT

"""
Tests to interrogate database operations
"""
from src.common.pg_impl import PGImplementation


Expand All @@ -31,6 +35,11 @@ def test_db_connection_creation():


def test_get_lu_id():
"""
Tests the retrieval of LU data for sites
:return:
"""
# create the DB object
db_names: tuple = ('asgs',)

Expand All @@ -41,16 +50,21 @@ def test_get_lu_id():
site_id = db_info.get_lu_id('RENCI', 'site')

# the renci site has an id of 0
assert id != 0
assert site_id == 0

# get a site id item
site_id = db_info.get_lu_id('TWI', 'site')

# the twi site has an id of 12
assert id != 0
assert site_id == 12


def test_get_site_ids():
"""
Tests the retrieval of a list of site IDs
:return:
"""
# create the DB object
db_names: tuple = ('asgs',)

Expand All @@ -65,6 +79,11 @@ def test_get_site_ids():


def test_load_lu_data():
"""
Tests the retrieval of lookup data
:return:
"""
# create the DB object
db_names: tuple = ('asgs',)

Expand Down
2 changes: 1 addition & 1 deletion src/test/test_msg_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Authors: Lisa Stillwell, Phil Owen @RENCI.org
"""
import os

import json

from src.common.queue_utils import QueueUtils
Expand Down

0 comments on commit e4feb7b

Please sign in to comment.