ScenarioManager

todo intro text

class algomancy_scenario.scenariomanager.ScenarioManager(etl_factory, kpis, algorithms, schemas, data_object_type, data_folder=None, logger=None, scenario_save_location='scenarios.json', has_persistent_state=False, save_type='json', autocreate=False, default_algo_name=None, default_param_values=None, autorun=False, data_manager=None, scenario_repository=None)[source]

Bases: object

Facade that coordinates data management, scenario creation/registry, and processing.

E = ~E
classmethod from_config(cfg)[source]

Build from either a CoreConfig (or subclass like ApiConfiguration) or any wrapper exposing a .core CoreConfig (e.g. AppConfig).

property has_persistent_state
property save_type
property schemas
property available_algorithms
property available_kpis
property auto_run_scenarios
property currently_processing: Scenario | None
get_algorithm_parameters(key)[source]
get_data_keys()[source]
get_data(data_key)[source]
set_data(data_key, data)[source]
derive_data(derive_from_key, new_data_key)[source]
delete_data(data_key, prevent_masterdata_removal=False)[source]
store_data(dataset_name, data)[source]
toggle_autorun(value=None)[source]
process_scenario_async(scenario)[source]
wait_for_processing()[source]
shutdown_processing()[source]
get_associated_parameters(algo_name, dataset_key=None)[source]
get_data_parameters(dataset_key)[source]
create_scenario(tag, dataset_key='Master data', algo_name='', algo_params=None, data_params=None)[source]
get_by_id(scenario_id)[source]
get_by_tag(tag)[source]
delete_scenario(scenario_id)[source]
list_scenarios()[source]
list_ids()[source]
list_tags()[source]

Returns a list of all registered scenario tag strings for the current session, by delegating to the underlying ScenarioRegistry

toggle_autocreate(value=None, default_algo_name='')[source]
add_datasource_from_json(json_string)[source]
etl_data(files, dataset_name)[source]

Run ETL for dataset_name; returns the underlying ETLResult.

Auto-creates a scenario only on successful loads.

auto_create_scenarios(keys=None)[source]
get_data_as_json(key)[source]
store_data_as_json(set_name)[source]
debug_load_data(dataset_name)[source]
debug_create_and_run_scenario(scenario_tag, dataset_key, algo_name, algo_params)[source]

Creates and runs a scenario for debugging purposes. The method uses a factory to create a scenario instance, registers it, enqueues it for processing, and waits for the processing to complete. Returns the fully processed scenario.

Parameters:
  • scenario_tag (str) – A unique identifier for the scenario being created and run.

  • dataset_key (str) – The key for the dataset to be used in the scenario.

  • algo_name (str) – The name of the algorithm to be applied in the scenario.

  • algo_params (Dict) – Additional parameters for the algorithm.

Returns:

The fully processed scenario created and executed within this method.

Return type:

Scenario

debug_etl_data(dataset_name)[source]

Debugging utility to run ETL on a directory as if loaded on startup.

debug_load_serialized_data(file_name)[source]

Debugging utility to upload a file as if loaded on startup.

debug_import_data(directory)[source]

Debugging utility to import data from a directory.

debug_upload_data(file_name)[source]

Debugging utility to upload data from a file.