How to use the qcfractal.interface.FractalClient function in qcfractal

To help you get started, we’ve selected a few qcfractal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MolSSI / QCFractal / manager_helpers / dask_manager_template.py View on Github external
# Not sure of the validity of this, but it seems to be the only terminal-invoking way
    # so python envs may be setup from there
    # Commands to execute before the Dask
    env_extra=TASK_STARTUP_COMMANDS
)

# Setup up adaption
# Workers are distributed down to the cores through the sub-divided processes
# Optimization may be needed
cluster.adapt(minimum=0, maximum=MAX_NODES)

dask_client = Client(cluster)


# Build a interface to the server
client = portal.FractalClient(FRACTAL_ADDRESS, verify=False)

# Build a manager
manager = qcfractal.queue.QueueManager(client, dask_client, update_frequency=0.5,
                                       cores_per_task=CORES_PER_NODE // MAX_TASKS_PER_NODE,
                                       memory_per_task=MEMORY_PER_NODE // MAX_TASKS_PER_NODE)

# Important for a calm shutdown
from qcfractal.cli.cli_utils import install_signal_handlers
install_signal_handlers(manager.loop, manager.stop)

# Start the loop
manager.start()
github MolSSI / QCFractal / qcfractal / testing.py View on Github external
def live_fractal_or_skip():
    """
    Ensure Fractal live connection can be made
    First looks for a local staging server, then tries QCArchive.
    """
    try:
        return FractalClient("localhost:7777", verify=False)
    except (requests.exceptions.ConnectionError, ConnectionRefusedError):
        print("Failed to connect to localhost, trying MolSSI QCArchive.")
        try:
            requests.get("https://api.qcarchive.molssi.org:443", json={}, timeout=5)
            return FractalClient()
        except (requests.exceptions.ConnectionError, ConnectionRefusedError):
            return pytest.skip("Could not make a connection to central Fractal server")
github MolSSI / QCFractal / examples / local_dataset / build_database.py View on Github external
ds = portal.collections.ReactionDataset("Water", ds_type="ie")

# Portal has some molecules stored for easy access.
water_dimer = portal.data.get_molecule("water_dimer_minima.psimol")
water_dimer_stretch = portal.data.get_molecule("water_dimer_stretch.psimol")

# We can also create a new molecule from canonical strings such as a Psi4 molecule
helium_dimer = portal.Molecule.from_data("He 0 0 -5\n--\nHe 0 0 5", dtype="psi4")

# Add several intermolecular interaction, dimers are automatically fragmented
ds.add_ie_rxn("Water Dimer", water_dimer)
ds.add_ie_rxn("Water Dimer Stretch", water_dimer_stretch)
ds.add_ie_rxn("Helium Dimer", helium_dimer)

# Build a interface to the server 
p = portal.FractalClient("localhost:7777", verify=False)

# Add the database to the server
ds.save(p)
github MolSSI / QCFractal / examples / local_dataset / compute_database.py View on Github external
import qcfractal.interface as portal

# Build a interface to the server 
p = portal.FractalClient("localhost:7777", verify=False)

# Pull data from the server
ds = portal.collections.ReactionDataset.from_server(p, "Water")
print(ds.data)

# Print the current data
# Should be blank, except for an index
print(ds.df)

# Submit computations (cp corrected scf/sto-3g)
r = ds.compute("scf", "sto-3g", stoich="cp", program="psi4")

print("Jobs to be computed:")
print("\n".join(r.submitted) + "\n")
print("Jobs Already Done:")
print("\n".join(r.existing) + "\n")
github MolSSI / QCFractal / qcfractal / snowflake.py View on Github external
"start",
                f"--logfile={self._dbname}",
                f"--base-folder={self._qcfdir.name}",
                f"--server-name={self._dbname}",
                f"--port={self._server_port}",
                f"--local-manager={self._ncores}",
                f"--server-name=FractalSnowFlake_{self._dbname[:8]}",
            ],
            cwd=self._qcfdir.name,
        )  # yapf: disable

        for x in range(timeout * 10):

            try:
                # Client will attempt to connect to the server
                FractalClient(self)
                break
            except ConnectionRefusedError:
                pass

            time.sleep(0.1)
        else:
            self._running = True
            self.stop()
            out, err = self._qcfractal_proc.communicate()
            raise ConnectionRefusedError(
                "Snowflake instance did not boot properly, try increasing the timeout.\n\n"
                f"stdout:\n{out.decode()}\n\n",
                f"stderr:\n{err.decode()}",
            )

        self._running = True
github MolSSI / QCFractal / examples / parsl_torsiondrive / parsl_manager.py View on Github external
#                 'debug',                  # Channel
#                 scheduler_options='',     # Input your scheduler_options if needed
#                 worker_init='conda activate qcf',  # Activate the conda environment
#                 walltime="00:10:00",
#                 init_blocks=1,
#                 max_blocks=1,
#                 nodes_per_block=1,        # Keep one node per block
#             ),
#         )
# 
#     ],
# )


# Build a interface to the server 
client = portal.FractalClient("localhost:7777", verify=False)

# Build a manager
manager = qcfractal.queue.QueueManager(client, config, update_frequency=0.5)

# Important for a calm shutdown
from qcfractal.cli.cli_utils import install_signal_handlers
install_signal_handlers(manager.loop, manager.stop)

# Start the loop
manager.start()
github MolSSI / QCFractal / qcfractal / snowflake.py View on Github external
def client(self):
        """
        Builds a client from this server.
        """

        return FractalClient(self)