From 7fd8ab1a1c29ace49e7bc506877c0fdb8509a436 Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Tue, 17 Oct 2023 06:29:33 -0700 Subject: [PATCH] [uss_qualifier] Improve action generator names (#259) Improve action generator names --- .../action_generators/action_generator.py | 11 +++++++++++ .../action_generators/astm/f3411/for_each_dss.py | 4 ++++ .../action_generators/astm/f3548/for_each_dss.py | 4 ++++ .../flight_planning/planner_combinations.py | 4 ++++ .../interuss/mock_uss/with_locality.py | 4 ++++ monitoring/uss_qualifier/reports/sequence_view.py | 13 +++++++++++-- .../uss_qualifier/suites/astm/utm/dss_probing.md | 2 +- .../uss_qualifier/suites/astm/utm/dss_probing.yaml | 3 +-- .../uss_qualifier/suites/astm/utm/f3548_21.md | 2 +- 9 files changed, 41 insertions(+), 6 deletions(-) diff --git a/monitoring/uss_qualifier/action_generators/action_generator.py b/monitoring/uss_qualifier/action_generators/action_generator.py index 5505dd8d04..7ea3093568 100644 --- a/monitoring/uss_qualifier/action_generators/action_generator.py +++ b/monitoring/uss_qualifier/action_generators/action_generator.py @@ -68,6 +68,17 @@ def list_potential_actions( "A concrete action generator must implement `list_potential_actions` classmethod" ) + @classmethod + def get_name(cls) -> str: + """Indicate the human-readable name of the action generator. + + Concrete subclasses of ActionGenerator may implement a classmethod that shadows this one according to this + specification. + + Returns: Human-readable name of this action generator. + """ + return cls.__name__ + @staticmethod def make_from_definition( definition: ActionGeneratorDefinition, resources: Dict[ResourceID, ResourceType] diff --git a/monitoring/uss_qualifier/action_generators/astm/f3411/for_each_dss.py b/monitoring/uss_qualifier/action_generators/astm/f3411/for_each_dss.py index 39e797b17a..5222d47e92 100644 --- a/monitoring/uss_qualifier/action_generators/astm/f3411/for_each_dss.py +++ b/monitoring/uss_qualifier/action_generators/astm/f3411/for_each_dss.py @@ -51,6 +51,10 @@ def list_potential_actions( specification.action_to_repeat ) + @classmethod + def get_name(cls) -> str: + return "For each F3411 DSS instance" + def __init__( self, specification: ForEachDSSSpecification, diff --git a/monitoring/uss_qualifier/action_generators/astm/f3548/for_each_dss.py b/monitoring/uss_qualifier/action_generators/astm/f3548/for_each_dss.py index 2bce45751e..26f50e64ec 100644 --- a/monitoring/uss_qualifier/action_generators/astm/f3548/for_each_dss.py +++ b/monitoring/uss_qualifier/action_generators/astm/f3548/for_each_dss.py @@ -52,6 +52,10 @@ def list_potential_actions( specification.action_to_repeat ) + @classmethod + def get_name(cls) -> str: + return "For each F3548 DSS instance" + def __init__( self, specification: ForEachDSSSpecification, diff --git a/monitoring/uss_qualifier/action_generators/flight_planning/planner_combinations.py b/monitoring/uss_qualifier/action_generators/flight_planning/planner_combinations.py index 05e9492074..6c324c3cdd 100644 --- a/monitoring/uss_qualifier/action_generators/flight_planning/planner_combinations.py +++ b/monitoring/uss_qualifier/action_generators/flight_planning/planner_combinations.py @@ -60,6 +60,10 @@ def list_potential_actions( specification.action_to_repeat ) + @classmethod + def get_name(cls) -> str: + return "For each appropriate combination of flight planner(s)" + def __init__( self, specification: FlightPlannerCombinationsSpecification, diff --git a/monitoring/uss_qualifier/action_generators/interuss/mock_uss/with_locality.py b/monitoring/uss_qualifier/action_generators/interuss/mock_uss/with_locality.py index 96ed7a79d5..6705e949ec 100644 --- a/monitoring/uss_qualifier/action_generators/interuss/mock_uss/with_locality.py +++ b/monitoring/uss_qualifier/action_generators/interuss/mock_uss/with_locality.py @@ -75,6 +75,10 @@ def list_potential_actions( ) return actions + @classmethod + def get_name(cls) -> str: + return "With mock_uss instances configured for a locality" + def __init__( self, specification: WithLocalitySpecification, diff --git a/monitoring/uss_qualifier/reports/sequence_view.py b/monitoring/uss_qualifier/reports/sequence_view.py index d9bf1b41d7..44c88a627d 100644 --- a/monitoring/uss_qualifier/reports/sequence_view.py +++ b/monitoring/uss_qualifier/reports/sequence_view.py @@ -9,6 +9,9 @@ from implicitdict import ImplicitDict from monitoring.monitorlib.fetch import Query +from monitoring.uss_qualifier.action_generators.action_generator import ( + action_generator_type_from_name, +) from monitoring.uss_qualifier.configurations.configuration import ( ParticipantID, SequenceViewConfiguration, @@ -422,8 +425,11 @@ def _skipped_action_of(report: SkippedActionReport) -> ActionNode: skipped_action=SkippedAction(reason=report.reason), ) elif report.declaration.get_action_type() == ActionType.ActionGenerator: + generator_type = action_generator_type_from_name( + report.declaration.action_generator.generator_type + ) parent = ActionNode( - name=report.declaration.action_generator.generator_type, + name=generator_type.get_name(), node_type=ActionNodeType.ActionGenerator, children=[], ) @@ -470,8 +476,11 @@ def _compute_action_node(report: TestSuiteActionReport, indexer: Indexer) -> Act children=children, ) elif is_action_generator: + generator_type = action_generator_type_from_name( + report.action_generator.generator_type + ) return ActionNode( - name=report.action_generator.generator_type, + name=generator_type.get_name(), node_type=ActionNodeType.ActionGenerator, children=[ _compute_action_node(a, indexer) diff --git a/monitoring/uss_qualifier/suites/astm/utm/dss_probing.md b/monitoring/uss_qualifier/suites/astm/utm/dss_probing.md index b349b5c1da..2cc19f3443 100644 --- a/monitoring/uss_qualifier/suites/astm/utm/dss_probing.md +++ b/monitoring/uss_qualifier/suites/astm/utm/dss_probing.md @@ -1,5 +1,5 @@ -# DSS testing for ASTM NetRID F3558-21 test suite +# DSS testing for ASTM NetRID F3548-21 test suite [`suites.astm.utm.dss_probing`](./dss_probing.yaml) ## [Actions](../../README.md#actions) diff --git a/monitoring/uss_qualifier/suites/astm/utm/dss_probing.yaml b/monitoring/uss_qualifier/suites/astm/utm/dss_probing.yaml index ed18ccaf34..a6a4b2d792 100644 --- a/monitoring/uss_qualifier/suites/astm/utm/dss_probing.yaml +++ b/monitoring/uss_qualifier/suites/astm/utm/dss_probing.yaml @@ -1,4 +1,4 @@ -name: DSS testing for ASTM NetRID F3558-21 +name: DSS testing for ASTM NetRID F3548-21 resources: dss: resources.astm.f3548.v21.DSSInstanceResource all_dss_instances: resources.astm.f3548.v21.DSSInstancesResource? @@ -8,4 +8,3 @@ actions: resources: primary_dss_instance: dss all_dss_instances: all_dss_instances - diff --git a/monitoring/uss_qualifier/suites/astm/utm/f3548_21.md b/monitoring/uss_qualifier/suites/astm/utm/f3548_21.md index c0a8dfea73..d0baee191d 100644 --- a/monitoring/uss_qualifier/suites/astm/utm/f3548_21.md +++ b/monitoring/uss_qualifier/suites/astm/utm/f3548_21.md @@ -5,7 +5,7 @@ ## [Actions](../../README.md#actions) 1. Action generator: [`action_generators.astm.f3548.ForEachDSS`](../../../action_generators/astm/f3548/for_each_dss.py) - 1. Suite: [DSS testing for ASTM NetRID F3558-21](dss_probing.md) ([`suites.astm.utm.dss_probing`](dss_probing.yaml)) + 1. Suite: [DSS testing for ASTM NetRID F3548-21](dss_probing.md) ([`suites.astm.utm.dss_probing`](dss_probing.yaml)) 2. Action generator: [`action_generators.flight_planning.FlightPlannerCombinations`](../../../action_generators/flight_planning/planner_combinations.py) 1. Scenario: [Validation of operational intents](../../../scenarios/astm/utm/flight_intent_validation/flight_intent_validation.md) ([`scenarios.astm.utm.FlightIntentValidation`](../../../scenarios/astm/utm/flight_intent_validation/flight_intent_validation.py)) 3. Action generator: [`action_generators.flight_planning.FlightPlannerCombinations`](../../../action_generators/flight_planning/planner_combinations.py)