diff --git a/metrics_utility/anonymized_rollups/__init__.py b/metrics_utility/anonymized_rollups/__init__.py index 20eb321d..126593fb 100644 --- a/metrics_utility/anonymized_rollups/__init__.py +++ b/metrics_utility/anonymized_rollups/__init__.py @@ -8,6 +8,7 @@ load_anonymized_rollup_data, ) from .base_anonymized_rollup import BaseAnonymizedRollup +from .compute_anonymized_rollup import compute_anonymized_rollup from .events_modules_anonymized_rollup import EventModulesAnonymizedRollup from .execution_environments_anonymized_rollup import ExecutionEnvironmentsAnonymizedRollup from .helpers import sanitize_json @@ -23,6 +24,7 @@ 'JobsAnonymizedRollup', 'anonymize_data', 'anonymize_rollups', + 'compute_anonymized_rollup', 'compute_anonymized_rollup_from_raw_data', 'create_anonymized_object', 'flatten_json_report', diff --git a/metrics_utility/anonymized_rollups/compute_anonymized_rollup.py b/metrics_utility/anonymized_rollups/compute_anonymized_rollup.py index bc0a72af..900ad635 100644 --- a/metrics_utility/anonymized_rollups/compute_anonymized_rollup.py +++ b/metrics_utility/anonymized_rollups/compute_anonymized_rollup.py @@ -1,15 +1,42 @@ -from metrics_utility.anonymized_rollups.anonymized_rollups import compute_anonymized_rollup_from_raw_data +from metrics_utility.anonymized_rollups.anonymized_rollups import ( + compute_anonymized_rollup_from_raw_data, +) # from metrics_utility.test.util import run_gather_int -from metrics_utility.library.collectors.controller import execution_environments, job_host_summary_service, main_jobevent_service, unified_jobs +from metrics_utility.library.collectors.controller import ( + execution_environments, + job_host_summary_service, + main_jobevent_service, + unified_jobs, +) +from metrics_utility.logger import logger def compute_anonymized_rollup(db, salt, since, until, ship_path, save_rollups: bool = True): # This will contain list of files that belongs to particular collector - execution_environments_data = execution_environments(db=db).gather() - unified_jobs_data = unified_jobs(db=db, since=since, until=until).gather() - job_host_summary_data = job_host_summary_service(db=db, since=since, until=until).gather() - main_jobevent_data = main_jobevent_service(db=db, since=since, until=until).gather() + execution_environments_data = [] + try: + execution_environments_data = execution_environments(db=db).gather() + except Exception as e: + logger.error(f'Failed to gather execution_environments data: {e}') + + unified_jobs_data = [] + try: + unified_jobs_data = unified_jobs(db=db, since=since, until=until).gather() + except Exception as e: + logger.error(f'Failed to gather unified_jobs data: {e}') + + job_host_summary_data = [] + try: + job_host_summary_data = job_host_summary_service(db=db, since=since, until=until).gather() + except Exception as e: + logger.error(f'Failed to gather job_host_summary data: {e}') + + main_jobevent_data = [] + try: + main_jobevent_data = main_jobevent_service(db=db, since=since, until=until).gather() + except Exception as e: + logger.error(f'Failed to gather main_jobevent data: {e}') input_data = { 'execution_environments': execution_environments_data,