Skip to content

Commit

Permalink
pick default projects to exclude from config
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Sep 3, 2024
1 parent 9fa7b41 commit 1f4d93d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions fabric_cf/actor/core/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class Constants:
MAINT_PROJECT_ID = 'maint.project.id'
INFRASTRUCTURE_PROJECT_ID = "infrastructure.project.id"
TOTAL_SLICE_COUNT_SEED = "total_slice_count_seed"
EXCLUDED_PROJECTS = "excluded.projects"

ELASTIC_TIME = "request.elasticTime"
ELASTIC_SIZE = "request.elasticSize"
Expand Down
1 change: 1 addition & 0 deletions fabric_cf/orchestrator/config.orchestrator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ runtime:
commit.batch.size: 1
enable.auto.commit: False
consumer.poll.timeout: 250
excluded.projects: 990d8a8b-7e50-4d13-a3be-0f133ffa8653, 4604cab7-41ff-4c1a-a935-0ca6f20cceeb, 990d8a8b-7e50-4d13-a3be-0f133ffa8653

logging:
## The directory in which actor should create log files.
Expand Down
9 changes: 9 additions & 0 deletions fabric_cf/orchestrator/core/orchestrator_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def __init__(self):
self.total_slice_count_seed = self.config.get_runtime_config().get(Constants.TOTAL_SLICE_COUNT_SEED, 0)
self.local_bqm = self.globals.get_config().get_global_config().get_bqm_config().get(
Constants.LOCAL_BQM, False)
excluded_projects = self.config.get_runtime_config().get(Constants.EXCLUDED_PROJECTS, "")
self.excluded_projects = [e.strip() for e in excluded_projects.split(",") if e.strip()]

def get_logger(self):
"""
Expand Down Expand Up @@ -987,6 +989,8 @@ def get_poas(self, *, token: str, sliver_id: str = None, poa_id: str = None, sta
def get_metrics_overview(self, *, token: str = None, excluded_projects: List[str] = None):
"""
Get metrics overview
:param token: token
:param excluded_projects: list of projects to exclude
"""
try:
controller = self.controller_state.get_management_actor()
Expand All @@ -1002,6 +1006,11 @@ def get_metrics_overview(self, *, token: str = None, excluded_projects: List[str
project, tags, project_name = fabric_token.first_project
user_id = fabric_token.uuid

if excluded_projects:
excluded_projects.extend(self.excluded_projects)
else:
excluded_projects = self.excluded_projects

active_states = SliceState.list_values_ex_closing_dead()
active_slice_count = controller.get_slice_count(states=active_states, user_id=user_id, project=project,
excluded_projects=excluded_projects)
Expand Down

0 comments on commit 1f4d93d

Please sign in to comment.