aepsych.server

Submodules

aepsych.server.server module

aepsych.server.server.get_next_filename(folder, fname, ext)[source]

Generates appropriate filename for logging purposes.

class aepsych.server.server.AEPsychServer(socket=None, database_path=None)[source]

Bases: object

Server for doing black box optimization using gaussian processes. :keyword socket – socket object that implements send and receive for json: :keyword messages (default: DummySocket()). :keyword TODO actually make an abstract interface to subclass from here:

cleanup()[source]

Close the socket and terminate connection to the server.

Returns:

None

serve()[source]

Run the server. Note that all configuration outside of socket type and port happens via messages from the client. The server simply forwards messages from the client to its setup, ask and tell methods, and responds with either acknowledgment or other response as needed. To understand the server API, see the docs on the methods in this class.

Returns:

None

Raises:
  • RuntimeError – if a request from a client has no request type

  • RuntimeError – if a request from a client has no known request type

  • TODO make things a little more robust to bad messages from client; this – requires resetting the req/rep queue status.

Return type:

None

generate_experiment_table(experiment_id, table_name='experiment_table', return_df=False)[source]

Generate a table of a given experiment with all the raw data.

This table is generated from the database, and is added to the experiment’s database.

Parameters:
  • experiment_id (str) – The experiment ID to generate the table for.

  • table_name (str) – The name of the table. Defaults to “experiment_table”.

  • return_df (bool) – If True, also return the dataframe.

Returns:

The dataframe of the experiment table, if

return_df is True.

Return type:

pd.DataFrame

property strat
property config
property parnames
property n_strats
property can_pregen_ask
write_strats(termination_type)[source]
generate_debug_info(exception_type, dumptype)[source]
handle_request(request)[source]
replay(uuid_to_replay, skip_computations=False)[source]
get_strats_from_replay(uuid_of_replay=None, force_replay=False)[source]
get_strat_from_replay(uuid_of_replay=None, strat_id=- 1)[source]
get_dataframe_from_replay(uuid_of_replay=None, force_replay=False)[source]
aepsych.server.server.startServerAndRun(server_class, socket=None, database_path=None, config_path=None, uuid_of_replay=None)[source]
aepsych.server.server.parse_argument()[source]
aepsych.server.server.start_server(server_class, args)[source]
aepsych.server.server.main(server_class=<class 'aepsych.server.server.AEPsychServer'>)[source]

aepsych.server.sockets module

aepsych.server.sockets.SimplifyArrays(message)[source]
class aepsych.server.sockets.DummySocket[source]

Bases: object

close()[source]
class aepsych.server.sockets.PySocket(port, ip='')[source]

Bases: object

close()[source]
return_socket()[source]
accept_client()[source]
receive(server_exiting)[source]
send(message)[source]

Module contents

class aepsych.server.AEPsychServer(socket=None, database_path=None)[source]

Bases: object

Server for doing black box optimization using gaussian processes. :keyword socket – socket object that implements send and receive for json: :keyword messages (default: DummySocket()). :keyword TODO actually make an abstract interface to subclass from here:

cleanup()[source]

Close the socket and terminate connection to the server.

Returns:

None

serve()[source]

Run the server. Note that all configuration outside of socket type and port happens via messages from the client. The server simply forwards messages from the client to its setup, ask and tell methods, and responds with either acknowledgment or other response as needed. To understand the server API, see the docs on the methods in this class.

Returns:

None

Raises:
  • RuntimeError – if a request from a client has no request type

  • RuntimeError – if a request from a client has no known request type

  • TODO make things a little more robust to bad messages from client; this – requires resetting the req/rep queue status.

Return type:

None

generate_experiment_table(experiment_id, table_name='experiment_table', return_df=False)[source]

Generate a table of a given experiment with all the raw data.

This table is generated from the database, and is added to the experiment’s database.

Parameters:
  • experiment_id (str) – The experiment ID to generate the table for.

  • table_name (str) – The name of the table. Defaults to “experiment_table”.

  • return_df (bool) – If True, also return the dataframe.

Returns:

The dataframe of the experiment table, if

return_df is True.

Return type:

pd.DataFrame

property strat
property config
property parnames
property n_strats
property can_pregen_ask
write_strats(termination_type)[source]
generate_debug_info(exception_type, dumptype)[source]
handle_request(request)[source]
replay(uuid_to_replay, skip_computations=False)[source]
get_strats_from_replay(uuid_of_replay=None, force_replay=False)[source]
get_strat_from_replay(uuid_of_replay=None, strat_id=- 1)[source]
get_dataframe_from_replay(uuid_of_replay=None, force_replay=False)[source]