funman.api package¶
Submodules¶
funman.api.api module¶
Definitions for the REST API endpoints. Running this file will start a uvicorn server that serves the API.
- raises HTTPException:
HTTPException description
- funman.api.api.custom_openapi()¶
- async funman.api.api.get_current(worker: FunmanWorker[FunmanWorker])¶
- async funman.api.api.get_queries(query_id: str, worker: FunmanWorker[FunmanWorker])¶
- funman.api.api.get_storage()¶
- funman.api.api.get_worker()¶
- async funman.api.api.halt(query_id: str, worker: FunmanWorker[FunmanWorker])¶
- funman.api.api.internal_error_handler()¶
- funman.api.api.lifespan(_: FastAPI)¶
- async funman.api.api.post_queries(model: Model | Model | RegnetModel | PetrinetModel | BilayerModel, request: FunmanWorkRequest, worker: FunmanWorker[FunmanWorker])¶
- funman.api.api.read_root(request: Request)¶
funman.api.client module¶
Client API Generation and usage functionality.
- funman.api.client.get_patched_schema(url: str, output: Path)¶
- funman.api.client.make_client(install_path: str, client_name: str = 'funman-api-client', openapi_url: str = 'http://0.0.0.0:8190/openapi.json')¶
Use openapi-python-client generator to create client. Adds client package to sys.path.
funman.api.run module¶
- class funman.api.run.Runner¶
Bases:
object
- create_plots(results: FunmanResults, out_dir, work_unit, num_points, point_plot_config, parameters_to_plot, print_last_time)¶
- elapsed_timer()¶
- get_model(model_file: str | Dict) Tuple[FunmanModel, FunmanWorkRequest | None] ¶
- run(model: str | FunmanModel | Dict, request: str | FunmanWorkRequest | Dict, description: str = '', case_out_dir: str = '.', dump_plot: bool = False, parameters_to_plot: List[str] | None = None, point_plot_config: Dict = {}, num_points: int | None = None, dump_results: bool = True, print_last_time: bool = False) FunmanResults ¶
Run a FUNMAN scenario.
- Parameters:
model (Union[str, GeneratedPetriNet, GeneratedRegNet, Dict]) – Model to analyze
request (Union[str, FunmanWorkRequest, Dict]) – Request to configure analysis
description (str, optional) – Description of the run
case_out_dir (str, optional) – Directory to store output, by default “.”
dump_plot (bool, optional) – Generate trace and parameter space plots in the case_out_dir, by default False
parameters_to_plot (Optional[List[str]], optional) – Parameters/Variables to include in parameter space plot, by default None
point_plot_config (Dict, optional) – Matplotlib flags and special key “variables” to select variables to plot , by default {}
num_points (Optional[int], optional) – The number of points to plot in the trace plot, by default None
print_last_time (bool) – Only print parameter space for last time
- Returns:
Analysis results
- Return type:
- run_instance(case: Tuple[str | Dict, str | Dict, str], out_dir='.', dump_plot=False, parameters_to_plot=None, point_plot_config={}, num_points=None, dump_results=False, print_last_time: bool = False)¶
- run_test_case(case, case_out_dir, dump_plot=False, parameters_to_plot=None, point_plot_config={}, num_points=None, dump_results=True, print_last_time: bool = False)¶
- funman.api.run.get_args()¶
- funman.api.run.main() int ¶
funman.api.server module¶
Server for API
- class funman.api.server.Server(config: Config)¶
Bases:
Server
Uvicorn server object
- run_in_thread()¶
Override the uvicorn method to allow running server in a thread, for example in a notebook.
- start_in_thread()¶
- class funman.api.server.ServerConfig(app, host: str = '0.0.0.0', port: int = 8190, log_level: str = 'info')¶
Bases:
Config
Server configuration
funman.api.settings module¶
Module contents¶
This module contains class definitions used to implement the FUNMAN API