BaseManager API Reference
- class RIFT.simulation_manager.BaseManager.SimulationArchive(name=None, **kwargs)
Bases:
objectSimulationArchive: tool to allow (a) storing list of ‘simulations’, (b) querying if present, (c) generating if needed,from a generation function
-simulation_exists_q : check if simulation present -retrieve_simulation :
- INTERNAL DATA STRUCTURES:
simulations : key/value pairs, keys are simulation params, values are simulation results. NOT LIKE OTHER REALIZATIONS.
- generate_simulation(sim_params, generator=None, generator_kwargs={})
- retrieve_simulation(sim_params)
- simulation_exists_q(sim_params)
- class RIFT.simulation_manager.BaseManager.SimulationArchiveOnLocalDisk(name=None, storage_method=None, **kwargs)
Bases:
SimulationArchive- User can specify a ‘base location’. Simulations are associated with files on disk.
The generator function is passed the base location as a keyword argument.
simulation output is saved to disk. User is responsible for managing the save_command. File names are identical to the key value.
No setup services are provided about the base location, aside from that. INTERNAL DATA STRUCTURES
simulations: key/value pairs, value is [sim_params, file_name, meta_name]
- generate_simulation(sim_params, sim_name=None, meta_name=None, generator=None, generator_kwargs={})
- index_simulation(sim_params)
- retrieve_simulation(sim_params)
- retrieve_simulation_by_name(internal_name)
- simulation_exists_q(sim_params)
- class RIFT.simulation_manager.BaseManager.SimulationArchiveOnLocalDiskExternalQueue(**kwargs)
Bases:
SimulationArchiveOnLocalDiskUser can specify a ‘base location’. Simulations are associated with files on disk. Simulations are performed by an external queue manager, and ready at some point TBD. Instead of generating simulations, we queue simulations – so we have a simulations_queue
- INTERNAL DATA STRUCTURES
self.simulations = [sim_params, fname, fname_meta, annotations] # annotator can do whatever it wants, in element 3
- LIFECYCLE
register_simulation(sim_params) -> status=’ready’ (manager builds DAG/submit file) -> status=’submit_ready’ (condor/slurm dispatches) -> status=’running’ (worker writes sim_path) -> status=’complete’
(caller polls simulation_status_q)
(failure) -> status=’stuck’
- get_status(sim_params=None, sim_name=None)
- refresh_status_from_disk()
Sweep all sims; promote ready/submit_ready/running -> complete when _internal_check_complete says the output is present. Returns the count of sims newly marked complete.
- register_simulation(sim_params, sim_name=None, meta_name=None)
Register a simulation slot in the archive WITHOUT executing the generator. Allocates the sim_path/metadata, sets status=’ready’. Returns the internal sim_name (key into self.simulations). Idempotent: if the sim is already registered, returns its existing key.
- set_status(status, sim_params=None, sim_name=None)
Explicitly set the queue_status on a single sim. Use this from managers (CondorManager/SlurmManager) when a transition is observed.
- simulation_status_q(sim_params)
- simulation_status_update(sim_params, status=None)
Update queue status for one sim. If status is given, set it explicitly; otherwise ask the annotator for a default transition (legacy behavior used by the BaseManager __main__ demo).
- simulations_with_status(status)
Return list of internal names whose queue_status == status.
- RIFT.simulation_manager.BaseManager.append_queue_default(params=None, sim_path=None, sim_meta_path=None, sim_annotation=None, status=None)
Default annotator. If status is given, set it explicitly; otherwise: no prior annotation -> ‘ready’; any prior annotation -> ‘complete’ (legacy behavior preserved for the BaseManager __main__ demo).
- RIFT.simulation_manager.BaseManager.dummy_true(**kwargs)
- RIFT.simulation_manager.BaseManager.easy_write(fname, content_lines)
- RIFT.simulation_manager.BaseManager.output_file_exists_check(params=None, sim_path=None, sim_meta_path=None, sim_annotation=None)
Default _internal_check_complete for queue-backed archives: a simulation is complete iff its output file exists and is non-empty. Workers are responsible for writing to sim_path.