stochss_compute.server package¶
Submodules¶
stochss_compute.server.api module¶
stochss_compute.server.api
- async stochss_compute.server.api.start_api(port=29681, cache='cache/', dask_host='localhost', dask_scheduler_port=8786, rm=False)[source]¶
Start the REST API with the following arguments.
- Parameters:
port (int) – The port to listen on.
cache (str) – The cache directory path.
dask_host (str) – The address of the dask cluster.
dask_scheduler_port (int) – The port of the dask cluster.
rm (bool) – Delete the cache when exiting this program.
stochss_compute.server.cache module¶
Cache for StochSS-Compute
- class stochss_compute.server.cache.Cache(cache_dir, results_id)[source]¶
Bases:
object
- Parameters:
cache_dir (str) – The root cache directory.
results_id (str) – Simulation hash.
- exists() bool [source]¶
Check if the results file exists.
- Returns:
os.path.exists(self.results_path)
- Return type:
bool
- get() Results [source]¶
Retrieve a gillespy2.Results object from the cache or None if error.
- Returns:
Results.from_json(results_json)
- Return type:
gillespy2.Results or None
- is_empty() bool [source]¶
Check if the results are empty.
- Returns:
filesize == 0 or self.exists()
- Return type:
bool
- is_ready(n_traj_wanted) bool [source]¶
Check if the results are ready to be retrieved from the cache.
- Parameters:
n_traj_wanted – The number of requested trajectories.
- Type:
int
- Returns:
n_traj_wanted <= len(<Results in cache>)
- Return type:
bool
- n_traj_in_cache() int [source]¶
Check the number of trajectories in the cache.
- Returns:
len() of the gillespy2.Results
- Return type:
int
- n_traj_needed(n_traj_wanted) int [source]¶
- Calculate the difference between the number of trajectories the user has requested
and the number of trajectories currently in the cache.
- Parameters:
n_traj_wanted – The number of requested trajectories.
- Type:
int
- Returns:
A number greater than or equal to zero.
- Return type:
int
stochss_compute.server.is_cached module¶
stochss_compute.server.is_cached
- class stochss_compute.server.is_cached.IsCachedHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]¶
Bases:
RequestHandler
Endpoint that will determine if a particular simulation exists in the cache.
stochss_compute.server.results module¶
stochss_compute.server.results
- class stochss_compute.server.results.ResultsHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]¶
Bases:
RequestHandler
Endpoint for Results objects.
stochss_compute.server.run module¶
stochss_compute.server.run
- class stochss_compute.server.run.RunHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]¶
Bases:
RequestHandler
Endpoint for running Gillespy2 simulations.
stochss_compute.server.sourceip module¶
stochss_compute.server.sourceip
stochss_compute.server.status module¶
stochss_compute.server.status
- class stochss_compute.server.status.StatusHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]¶
Bases:
RequestHandler
Endpoint for requesting the status of a simulation.
Module contents¶
stochss_compute.server