Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Get feature flags from config service #1444

Merged
merged 16 commits into from
Jun 26, 2024
Merged

Conversation

d-perl
Copy link
Contributor

@d-perl d-perl commented Jun 13, 2024

Fixes #1397

Does a best effort attempt at getting feature flags (set_stub_offsets) from the new config service

To test:

  1. Have a look at the config service repo and play with the example
  2. Run the new system tests
  3. See that nothing else is broken

@d-perl d-perl marked this pull request as ready for review June 13, 2024 10:03
run_up_distance_mm=self.panda_runup_distance_mm,
transmission_fraction=self.transmission_frac,
)

def do_set_stub_offsets(self, value: bool):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like having a special private field in our parameter classes, and feel this is ugly but then we do so many other things in these - maybe this just says more about me than the code though...

return _CONFIG_SERVER


def best_effort_get_feature_flag(flag_name: str, fallback: T = None) -> bool | T:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this method exist? get rid of it

set_stub_offsets: bool = False

@classmethod
def best_effort(cls):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a bulk get REST call rather than get the feature flags one by one, if we are always going to be getting them all in one go anyway.

set_stub_offsets: bool = False

@classmethod
def best_effort(cls):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method gets invoked every time we want only one of the feature flags, but it gets all of the feature flags. Why don't we just get all of the feature flags right at the start and put them all in the parameters in one go?

I realise that while it is a rest call this is just going to likely be quite fast, but at the end of the day we are in the long run ultimately trying to get end-to-end times of < 10s and say a few hundred ms extra if you end up with a lot of calls baked in to the code due to bad API design choices early on, it isn't completely insignificant.

Copy link
Contributor

@rtuck99 rtuck99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments with code

@d-perl d-perl requested a review from rtuck99 June 26, 2024 10:25
Copy link
Contributor

@rtuck99 rtuck99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely

@d-perl d-perl merged commit 39c3e73 into main Jun 26, 2024
10 checks passed
@d-perl d-perl deleted the 1397_properties_and_config_service branch June 26, 2024 14:33
olliesilvester pushed a commit to olliesilvester/mx-bluesky that referenced this pull request Aug 23, 2024
* Add FeatureFlags class for params 
* Makes use of the daq-config-server to fetch data for it
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a properties/configuration service
2 participants