POMDPPlanners.simulations.simulations_deployment package
- class POMDPPlanners.simulations.simulations_deployment.DeploymentType(*values)[source]
Bases:
EnumEnum representing different types of deployment for simulations.
- DASK_DISTRIBUTED = 'dask_distributed'
- LOCAL = 'local'
- REMOTE_RAY = 'remote_ray'
- class POMDPPlanners.simulations.simulations_deployment.TaskManagerFactory[source]
Bases:
objectFactory class for creating different types of task managers.
This factory provides methods to create specific types of task managers: - create_dask: Creates a DaskTaskManager for distributed computing - create_joblib: Creates a JoblibTaskManager with disk caching for parallel processing - create_pbs: Creates a PBSTaskManager for PBS cluster computing
- static create_dask(n_workers=1, scheduler_address=None, cache_size=2000000000, clear_cache_on_start=False)[source]
Create a DaskTaskManager for distributed computing.
- Parameters:
- Return type:
- Returns:
A configured DaskTaskManager instance
- static create_joblib(cache_dir='./cache', cache_size=2000000000, n_jobs=-1, eviction_policy='least-recently-used', clear_cache_on_start=False, verbose=0, console_output=True, no_logs=False)[source]
Create a JoblibTaskManager with a configured DiskCacheDB.
- Parameters:
cache_dir (
str) – Directory to store cache filescache_size (
int) – Maximum size of cache in bytesn_jobs (
int) – Number of parallel jobs (-1 for all cores)eviction_policy (
str) – Cache eviction policy (‘least-recently-used’ or ‘least-frequently-used’)clear_cache_on_start (
bool) – If True, clears the cache at startupverbose (
int) – Verbosity level for joblibconsole_output (
bool) – Whether to print logs to consoleno_logs (
bool) – Whether to disable all logging
- Return type:
- Returns:
A configured JoblibTaskManager instance
- static create_pbs(queue, n_workers=4, cores=1, memory='4GB', processes=1, walltime='01:00:00', job_extra=None, cache_size=2000000000, clear_cache_on_start=False, enable_dashboard=True, dashboard_address='0.0.0.0', dashboard_port=8787, dashboard_prefix=None)[source]
Create a PBSTaskManager for PBS cluster computing.
- Parameters:
queue (
str) – PBS queue name to submit jobs ton_workers (
int) – Number of worker jobs to submit to PBScores (
int) – Number of CPU cores per PBS jobmemory (
str) – Memory per PBS job (e.g., “4GB”, “1000MB”)processes (
int) – Number of processes per PBS jobwalltime (
str) – Maximum runtime per job in HH:MM:SS formatjob_extra (
Optional[list]) – Additional PBS directives as list of stringscache_size (
int) – Size of cache in bytesclear_cache_on_start (
bool) – If True, clears the cache at startupenable_dashboard (
bool) – If True, enables the Dask dashboarddashboard_address (
str) – Address to bind the dashboard todashboard_port (
int) – Port for the Dask dashboarddashboard_prefix (
Optional[str]) – URL prefix for dashboard (useful with reverse proxies)
- Return type:
- Returns:
A configured PBSTaskManager instance
- Raises:
RuntimeError – If dask-jobqueue is not installed
- class POMDPPlanners.simulations.simulations_deployment.TaskManagerType(*values)[source]
Bases:
EnumEnum representing different types of task managers for simulation execution.
- DASK = 'dask'
- JOBLIB = 'joblib'
- PBS = 'pbs'
Subpackages
- POMDPPlanners.simulations.simulations_deployment.run_progress package
NotificationConfigNotificationConfig.webhook_urlNotificationConfig.trial_intervalNotificationConfig.progress_db_pathNotificationConfig.disableNotificationConfig.disableNotificationConfig.disabled()NotificationConfig.from_env()NotificationConfig.is_active()NotificationConfig.progress_db_pathNotificationConfig.trial_intervalNotificationConfig.webhook_url
NotifierNullNotifierProgressDBRunRowRunRow.run_idRunRow.experiment_nameRunRow.hostRunRow.pidRunRow.statusRunRow.started_atRunRow.finished_atRunRow.last_heartbeat_atRunRow.error_msgRunRow.metadataRunRow.stall_notified_atRunRow.error_msgRunRow.experiment_nameRunRow.finished_atRunRow.hostRunRow.last_heartbeat_atRunRow.metadataRunRow.pidRunRow.run_idRunRow.stall_notified_atRunRow.started_atRunRow.status
SlackNotifierbuild_notifier()install_signal_handlers()post_trial_milestone()- Submodules
- POMDPPlanners.simulations.simulations_deployment.run_progress.config module
NotificationConfigNotificationConfig.webhook_urlNotificationConfig.trial_intervalNotificationConfig.progress_db_pathNotificationConfig.disableNotificationConfig.disableNotificationConfig.disabled()NotificationConfig.from_env()NotificationConfig.is_active()NotificationConfig.progress_db_pathNotificationConfig.trial_intervalNotificationConfig.webhook_url
- POMDPPlanners.simulations.simulations_deployment.run_progress.db module
ProgressDBRunRowRunRow.run_idRunRow.experiment_nameRunRow.hostRunRow.pidRunRow.statusRunRow.started_atRunRow.finished_atRunRow.last_heartbeat_atRunRow.error_msgRunRow.metadataRunRow.stall_notified_atRunRow.error_msgRunRow.experiment_nameRunRow.finished_atRunRow.hostRunRow.last_heartbeat_atRunRow.metadataRunRow.pidRunRow.run_idRunRow.stall_notified_atRunRow.started_atRunRow.status
- POMDPPlanners.simulations.simulations_deployment.run_progress.notify module
- POMDPPlanners.simulations.simulations_deployment.run_progress.watcher module
- POMDPPlanners.simulations.simulations_deployment.tasks package
- Submodules
- POMDPPlanners.simulations.simulations_deployment.tasks.environment_visualization_task module
EnvironmentVisualizationTaskEnvironmentVisualizationTask.visualizerEnvironmentVisualizationTask.env_nameEnvironmentVisualizationTask.environmentEnvironmentVisualizationTask.policy_resultsEnvironmentVisualizationTask.policiesEnvironmentVisualizationTask.cache_visualizationsEnvironmentVisualizationTask.get_config_id()EnvironmentVisualizationTask.run()
- POMDPPlanners.simulations.simulations_deployment.tasks.episode_simulation_task module
- POMDPPlanners.simulations.simulations_deployment.tasks.hyper_parameter_tuning_simulation_task module
Submodules
POMDPPlanners.simulations.simulations_deployment.cache_dbs module
- class POMDPPlanners.simulations.simulations_deployment.cache_dbs.DiskCacheDB(cache_dir='./cache', size_limit=2000000000, eviction_policy='least-recently-used', debug=False)[source]
Bases:
DataBaseInterfaceA disk-based cache database implementation using diskcache.
POMDPPlanners.simulations.simulations_deployment.task_manager_configs module
- class POMDPPlanners.simulations.simulations_deployment.task_manager_configs.DaskConfig(n_workers=1, scheduler_address=None, cache_size=2000000000, clear_cache_on_start=False)[source]
Bases:
TaskManagerConfigConfiguration for Dask task manager.
- Parameters:
- class POMDPPlanners.simulations.simulations_deployment.task_manager_configs.JoblibConfig(n_jobs=-1, cache_size=2000000000, eviction_policy='least-recently-used', verbose=0, clear_cache_on_start=False, console_output=True, no_logs=False)[source]
Bases:
TaskManagerConfigConfiguration for Joblib task manager.
- Parameters:
- class POMDPPlanners.simulations.simulations_deployment.task_manager_configs.PBSConfig(queue, n_workers=4, cores=1, memory='4GB', processes=1, walltime='01:00:00', job_extra=None, cache_size=2000000000, clear_cache_on_start=False, enable_dashboard=True, dashboard_address='0.0.0.0', dashboard_port=8787, dashboard_prefix=None)[source]
Bases:
TaskManagerConfigConfiguration for PBS cluster task manager.
- Parameters:
- class POMDPPlanners.simulations.simulations_deployment.task_manager_configs.TaskManagerConfig[source]
Bases:
ABCBase configuration class for all task managers.
POMDPPlanners.simulations.simulations_deployment.task_managers module
- class POMDPPlanners.simulations.simulations_deployment.task_managers.DaskTaskManager(n_workers=1, scheduler_address=None, cache_size=2000000000, clear_cache_on_start=False)[source]
Bases:
TaskManagerA class to manage simulation tasks and their execution using Dask.
- Parameters:
- cancel_tasks(futures)[source]
Cancel submitted tasks.
- Parameters:
futures (
List[Future]) – List of Dask futures to cancel
- set_progress_callback(callback)[source]
Register a callback invoked once per completed task.
The callback runs in a Dask client thread (parent process) as each
dask.distributed.Futureresolves. It is safe to touch parent-only resources (e.g. SQLite connections);ProgressDBalready opens a fresh connection per call and uses WAL +busy_timeout=5000so concurrent client-thread callbacks serialise cleanly. Exceptions raised by the callback are caught and logged at DEBUG level so a flaky callback cannot break the run.
- submit_tasks(tasks)[source]
Submit tasks for execution.
- Parameters:
tasks (
List[SimulationTask]) – List of simulation tasks to execute- Returns:
List of Dask futures for the tasks
- Return type:
List[Future]
- class POMDPPlanners.simulations.simulations_deployment.task_managers.JoblibTaskManager(cache_db, n_jobs=-1, cache_dir=None, clear_cache_on_start=False, verbose=0, logger_debug=False, console_output=True, no_logs=False)[source]
Bases:
TaskManagerExternalDBA task manager that uses joblib for parallel execution and caching.
- Parameters:
- set_progress_callback(callback)[source]
Register a callback invoked once per completed task.
The callback runs in the parent process inside the joblib generator loop, so it is safe to touch parent-only resources (e.g. SQLite connections). Exceptions raised by the callback are caught and logged at DEBUG level so a flaky callback cannot break the run.
The callback is intentionally excluded from this object’s pickled state (via
__getstate__()) so that joblib’sMemorycache, which hashes function arguments (includingself), can still serialize the task manager even when the callback closes over non-picklable parent objects such as a live notifier or simulator.
- class POMDPPlanners.simulations.simulations_deployment.task_managers.PBSTaskManager(queue, n_workers=4, cores=1, memory='4GB', processes=1, scheduler_address=None, walltime='01:00:00', job_extra=None, cache_size=2000000000, clear_cache_on_start=False, enable_dashboard=True, dashboard_address='0.0.0.0', dashboard_port=8787, dashboard_prefix=None)[source]
Bases:
DaskTaskManagerA task manager that uses Dask with PBS cluster for distributed computing.
This task manager submits jobs to a PBS (Portable Batch System) cluster and provides an optional Dask dashboard for monitoring job execution, resource utilization, and performance metrics.
The dashboard is enabled by default and provides real-time visualization of: - Task progress and execution status - Resource utilization across PBS nodes - Task graphs and dependencies - Performance metrics and bottlenecks
Example
Basic usage with default dashboard:
with PBSTaskManager(queue="gpu_queue", n_workers=4) as manager: futures = manager.submit_tasks(tasks) print(f"Dashboard: {manager.get_dashboard_url()}") results = manager.gather_results(futures)
Custom dashboard configuration:
manager = PBSTaskManager( queue="compute_queue", n_workers=8, dashboard_port=8888, dashboard_address="0.0.0.0", enable_dashboard=True )
Disable dashboard:
manager = PBSTaskManager( queue="batch_queue", enable_dashboard=False )
Note
The dashboard requires network access to the specified port. In PBS environments, ensure the dashboard port is accessible through firewalls and security policies. The dashboard will automatically shut down when the task manager context exits.
- Parameters:
- class POMDPPlanners.simulations.simulations_deployment.task_managers.SequentialTaskManager(cache_db, cache_dir=None, clear_cache_on_start=False, verbose=0, logger_debug=False, console_output=True, no_logs=False)[source]
Bases:
JoblibTaskManagerA task manager that uses sequential execution and caching.