FractalServer

class qcfractal.FractalServer(name: str = 'QCFractal Server', port: int = 7777, loop: IOLoop = None, compress_response: bool = True, security: Optional[str] = None, allow_read: bool = False, ssl_options: Union[bool, Dict[str, str]] = True, storage_uri: str = 'postgresql://localhost:5432', storage_project_name: str = 'qcfractal_default', query_limit: int = 1000, view_enabled: bool = False, view_path: Optional[str] = None, logfile_prefix: str = None, log_apis: bool = False, geo_file_path: str = None, queue_socket: BaseAdapter = None, heartbeat_frequency: float = 1800, max_active_services: int = 20, service_frequency: float = 60)[source]

Bases: object

Methods Summary

add_exit_callback(callback, *args, **kwargs)

Adds additional callbacks to perform when closing down the server.

await_results()

A synchronous method for testing or small launches that awaits task completion before adding all queued results to the database and returning.

await_services([max_iter])

A synchronous method that awaits the completion of all services before returning.

check_manager_heartbeats()

Checks the heartbeats and kills off managers that have not been heard from.

client()

Builds a client from this server.

get_address([endpoint])

Obtains the full URI for a given function on the FractalServer.

list_current_tasks()

Provides a list of tasks currently in the queue along with the associated keys.

list_managers([status, name])

Provides a list of managers associated with the server both active and inactive.

start([start_loop, start_periodics])

Starts up the IOLoop and periodic calls.

stop([stop_loop])

Shuts down the IOLoop and periodic updates.

update_public_information()

Updates the public information data

update_server_log()

Updates the servers internal log

update_services()

Runs through all active services and examines their current status.

update_tasks()

Pulls tasks from the queue_adapter, inserts them into the database, and fills the queue_adapter with new tasks.

Methods Documentation

add_exit_callback(callback, *args, **kwargs)[source]

Adds additional callbacks to perform when closing down the server.

Parameters
  • callback (callable) – The function to call at exit

  • *args – Arguments to call with the function.

  • **kwargs – Kwargs to call with the function.

await_results() → bool[source]

A synchronous method for testing or small launches that awaits task completion before adding all queued results to the database and returning.

Returns

Return True if the operation completed successfully

Return type

bool

await_services(max_iter: int = 10) → bool[source]

A synchronous method that awaits the completion of all services before returning.

Parameters

max_iter (int, optional) – The maximum number of service iterations the server will run through. Will terminate early if all services have completed.

Returns

Return True if the operation completed successfully

Return type

bool

check_manager_heartbeats() → None[source]

Checks the heartbeats and kills off managers that have not been heard from.

client()[source]

Builds a client from this server.

get_address(endpoint: Optional[str] = None) → str[source]

Obtains the full URI for a given function on the FractalServer.

Parameters

endpoint (Optional[str], optional) – Specifies a endpoint to provide the URI for. If None returns the server address.

Returns

The endpoint URI

Return type

str

list_current_tasks() → List[Any][source]

Provides a list of tasks currently in the queue along with the associated keys.

Returns

ret – All tasks currently still in the database

Return type

list of tuples

list_managers(status: Optional[str] = None, name: Optional[str] = None) → List[Dict[str, Any]][source]

Provides a list of managers associated with the server both active and inactive.

Parameters
  • status (Optional[str], optional) – Filters managers by status.

  • name (Optional[str], optional) – Filters managers by name

Returns

The requested Manager data.

Return type

List[Dict[str, Any]]

start(start_loop: bool = True, start_periodics: bool = True) → None[source]

Starts up the IOLoop and periodic calls.

Parameters
  • start_loop (bool, optional) – If False, does not start the IOLoop

  • start_periodics (bool, optional) – If False, does not start the server periodic updates such as Service iterations and Manager heartbeat checking.

stop(stop_loop: bool = True) → None[source]

Shuts down the IOLoop and periodic updates.

Parameters

stop_loop (bool, optional) – If False, does not shut down the IOLoop. Useful if the IOLoop is externally managed.

update_public_information() → None[source]

Updates the public information data

update_server_log() → Dict[str, Any][source]

Updates the servers internal log

update_services() → int[source]

Runs through all active services and examines their current status.

update_tasks() → bool[source]

Pulls tasks from the queue_adapter, inserts them into the database, and fills the queue_adapter with new tasks.

Returns

Return True if the operation completed successfully

Return type

bool