Request

class openff.evaluator.client.Request(client=None)[source]

An estimation request which has been sent to a EvaluatorServer instance.

This object can be used to query and retrieve the results of the request when finished, or be stored to retrieve the request at some point in the future.

__init__(client=None)[source]
Parameters

client (EvaluatorClient, optional) – The client which submitted this request.

Methods

__init__([client])

param client

The client which submitted this request.

from_json(file_path)

Create this object from a JSON file.

get_attributes([attribute_type])

Returns all attributes of a specific attribute_type.

json([file_path, format])

Creates a JSON representation of this class.

parse_json(string_contents)

Parses a typed json string into the corresponding class structure.

results([synchronous, polling_interval])

Attempt to retrieve the results of the request from the server.

validate([attribute_type])

Validate the values of the attributes.

Attributes

connection_options

The options used to connect to the server handling the request.

id

The unique id assigned to this request by the server.

id

The unique id assigned to this request by the server. The default value of this attribute is not set and must be set by the user..

Type

str

connection_options

The options used to connect to the server handling the request. The default value of this attribute is not set and must be set by the user..

Type

ConnectionOptions

results(synchronous=False, polling_interval=5)[source]

Attempt to retrieve the results of the request from the server.

If the method is run synchronously it will block the main thread either all of the requested properties have been estimated, or an exception is returned.

Parameters
  • synchronous (bool) – If True, this method will block the main thread until the server either returns a result or an error.

  • polling_interval (float) – If running synchronously, this is the time interval (seconds) between checking if the calculation has finished. This will be ignored if running asynchronously.

Returns

  • RequestResult, optional – Returns the current results of the request. This may be None if any unexpected exceptions occurred while retrieving the estimate.

  • EvaluatorException, optional – The exception raised will trying to retrieve the result if any.

classmethod from_json(file_path)

Create this object from a JSON file.

Parameters

file_path (str) – The path to load the JSON from.

Returns

The parsed class.

Return type

cls

classmethod get_attributes(attribute_type=None)

Returns all attributes of a specific attribute_type.

Parameters

attribute_type (type of Attribute, optional) – The type of attribute to search for.

Returns

The names of the attributes of the specified type.

Return type

list of str

json(file_path=None, format=False)

Creates a JSON representation of this class.

Parameters
  • file_path (str, optional) – The (optional) file path to save the JSON file to.

  • format (bool) – Whether to format the JSON or not.

Returns

The JSON representation of this class.

Return type

str

classmethod parse_json(string_contents)

Parses a typed json string into the corresponding class structure.

Parameters

string_contents (str or bytes) – The typed json string.

Returns

The parsed class.

Return type

Any

validate(attribute_type=None)

Validate the values of the attributes. If attribute_type is set, only attributes of that type will be validated.

Parameters

attribute_type (type of Attribute, optional) – The type of attribute to validate.

Raises

ValueError or AssertionError