Skip to content

Commit 1f4d93d

Browse files
committed
pick default projects to exclude from config
1 parent 9fa7b41 commit 1f4d93d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

fabric_cf/actor/core/common/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ class Constants:
200200
MAINT_PROJECT_ID = 'maint.project.id'
201201
INFRASTRUCTURE_PROJECT_ID = "infrastructure.project.id"
202202
TOTAL_SLICE_COUNT_SEED = "total_slice_count_seed"
203+
EXCLUDED_PROJECTS = "excluded.projects"
203204

204205
ELASTIC_TIME = "request.elasticTime"
205206
ELASTIC_SIZE = "request.elasticSize"

fabric_cf/orchestrator/config.orchestrator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ runtime:
5555
commit.batch.size: 1
5656
enable.auto.commit: False
5757
consumer.poll.timeout: 250
58+
excluded.projects: 990d8a8b-7e50-4d13-a3be-0f133ffa8653, 4604cab7-41ff-4c1a-a935-0ca6f20cceeb, 990d8a8b-7e50-4d13-a3be-0f133ffa8653
5859

5960
logging:
6061
## The directory in which actor should create log files.

fabric_cf/orchestrator/core/orchestrator_handler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def __init__(self):
6969
self.total_slice_count_seed = self.config.get_runtime_config().get(Constants.TOTAL_SLICE_COUNT_SEED, 0)
7070
self.local_bqm = self.globals.get_config().get_global_config().get_bqm_config().get(
7171
Constants.LOCAL_BQM, False)
72+
excluded_projects = self.config.get_runtime_config().get(Constants.EXCLUDED_PROJECTS, "")
73+
self.excluded_projects = [e.strip() for e in excluded_projects.split(",") if e.strip()]
7274

7375
def get_logger(self):
7476
"""
@@ -987,6 +989,8 @@ def get_poas(self, *, token: str, sliver_id: str = None, poa_id: str = None, sta
987989
def get_metrics_overview(self, *, token: str = None, excluded_projects: List[str] = None):
988990
"""
989991
Get metrics overview
992+
:param token: token
993+
:param excluded_projects: list of projects to exclude
990994
"""
991995
try:
992996
controller = self.controller_state.get_management_actor()
@@ -1002,6 +1006,11 @@ def get_metrics_overview(self, *, token: str = None, excluded_projects: List[str
10021006
project, tags, project_name = fabric_token.first_project
10031007
user_id = fabric_token.uuid
10041008

1009+
if excluded_projects:
1010+
excluded_projects.extend(self.excluded_projects)
1011+
else:
1012+
excluded_projects = self.excluded_projects
1013+
10051014
active_states = SliceState.list_values_ex_closing_dead()
10061015
active_slice_count = controller.get_slice_count(states=active_states, user_id=user_id, project=project,
10071016
excluded_projects=excluded_projects)

0 commit comments

Comments
 (0)