def on_test_stop()

in scale_test_tool/locust/locust_main.py [0:0]


def on_test_stop(**kwargs):
    # This is executed at the end of the test. Any cleanup code will go here.
    try:
        virtual_cluster_task.delete_virtual_cluster_namespace(
            virtual_cluster_id=scale_test.virtual_cluster_id,
            test_id=scale_test.test_id
        )
    except Exception as e:
        # If there is an error while deleting virtual cluster, we will log the error
        # but finish generating the job run report.
        logger.error(f"Exception occurred while deleting the virtual cluster "
                     f"with id: {scale_test.virtual_cluster_id} {e}")
    generate_report(
        job_run_ids_list=job_run_ids_list
    )
    logger.info("Scale Test stopped")