QCFractal Snowflake#
The QCFractal Snowflake is a self-contained server and compute manager. The snowflake provides a way to experiment or test QCArchive without needing to set up a standalone server.
There are a few caveats to using the snowflake
The database is stored in a temporary directory and deleted when the snowflake is destructed
By default, security is not enabled
You are generally limited to a couple compute workers, and they run on the same computer the server is running on
Programs for running the computations (like Psi4) must be available on the computer (and in the environment you are running the snowflake in)
Postgres software must be available
While there are ways around the above limitations, they are generally against the spirit of using the snowflake, and you are probably better off setting up a complete server instead.
Warning
When a snowflake is destructed, the database is destroyed and all data is lost. It is not meant to permanently store data.
Using the Snowflake#
The snowflake can be used by constructing a FractalSnowflake. From there, a client can be obtained and used as if it were any other client.
>>> from qcfractal.snowflake import FractalSnowflake
>>> snowflake = FractalSnowflake()
>>> client = snowflake.client()
>>> # Add computations, create datasets, do whatever you want
>>> client.add_singlepoints(mol, 'psi4', 'energy', 'hf', 'sto-3g')
Snowflake API#
- class FractalSnowflake(start=True, compute_workers=2, database_config=None, extra_config=None)[source]#
Bases:
object
A temporary, self-contained server
A snowflake contains the server and compute manager, and can be used to test QCFractal/QCPortal, or to experiment.
All data is lost when the server is shutdown.
This can also be used as a context manager (with FractalSnowflake(…) as s:)
- Parameters:
start (bool)
compute_workers (int)
database_config (Optional[DatabaseConfig])
extra_config (Optional[Dict[str, Any]])
- wait_for_api()[source]#
Wait for the flask/api server to come up and then exit
If it does not come up after some time, an exception will be raised
- get_uri()[source]#
Obtain the URI/address of the REST interface of this server
- Returns:
Address/URI of the rest interface (ie, ‘http://127.0.0.1:1234’)
- Return type:
str
- await_results(ids=None, timeout=None)[source]#
Wait for computations to complete
This function will block until the specified computations are complete (either success for failure). If timeout is given, that is the maximum amount of time to wait for a result. This timer is reset after each completed result.
- Parameters:
ids (Optional[Sequence[int]]) – Result/Procedure IDs to wait for. If not specified, all currently incomplete tasks will be waited for.
timeout (Optional[float]) – Maximum time to wait for a single result.
- Returns:
True if all the results were received, False if timeout has elapsed without receiving a completed computation
- Return type:
bool