aepsych.server

Submodules

aepsych.server.server module

aepsych.server.server.get_next_filename(folder, fname, ext)[source]
class aepsych.server.server.AEPsychServer(socket=None, database_path=None, thrift=False)[source]

Bases: object

Server for doing black box optimization using gaussian processes.

Keyword Arguments
  • json (socket -- socket object that implements send and receive for) –

  • (default (messages) – ZMQSocket).

  • here (TODO actually make an abstract interface to subclass from) –

cleanup()[source]
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.

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.

replay(uuid_to_replay, skip_computations=False)[source]

Run a replay against the server. The UUID will be looked up in the database. if skip_computations is true, skip all the asks and queries, which should make the replay much faster.

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]
versioned_handler(request)[source]
handle_setup_v01(request)[source]
handle_resume_v01(request)[source]
handle_ask_v01(request)[source]

Returns dictionary with two entries: “config” – dictionary with config (keys are strings, values are floats) “is_finished” – bool, true if the strat is finished

unversioned_handler(request)[source]
handle_setup(request)[source]
handle_ask(request)[source]
handle_tell(request)[source]
handle_update(request)[source]
handle_params(request)[source]
handle_can_model(request)[source]
handle_query(request)[source]
query(query_type='max', probability_space=False, x=None, y=None, constraints=None)[source]
handle_exit(request)[source]
property strat
property parnames
property outcome_type
property n_strats
ask()[source]

get the next point to query from the model

Returns

dict – new config dict (keys are strings, values are floats)

tell(outcome, config)[source]

tell the model which input was run and what the outcome was

Parameters
  • dictionary (inputs {dict} --) –

  • strings (keys are) –

  • int. (values are floats or) –

  • over (keys should inclde all of the parameters we are tuning) –

  • 'outcome' (plus) –

  • {0 (which would be in) –

  • 1}.

  • types (TODO better) –

configure(**config_args)[source]
write_strats(termination_type)[source]
generate_debug_info(exception_type, dumptype)[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)[source]

aepsych.server.sockets module

aepsych.server.sockets.SimplifyArrays(message)[source]
aepsych.server.sockets.createSocket(socket_type='pysocket', port=5555, msg_queue=None)[source]
class aepsych.server.sockets.DummySocket[source]

Bases: object

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

Bases: object

sends/receives json-formated messages over ZMQ

Parameters

over (port {int} -- port to listen) –

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

Bases: object

close()[source]
receive()[source]
send(message)[source]
class aepsych.server.sockets.ThriftSocketWrapper(msg_queue=None)[source]

Bases: object

close()[source]
receive()[source]
send(message)[source]

Module contents

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

Bases: object

Server for doing black box optimization using gaussian processes.

Keyword Arguments
  • json (socket -- socket object that implements send and receive for) –

  • (default (messages) – ZMQSocket).

  • here (TODO actually make an abstract interface to subclass from) –

cleanup()[source]
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.

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.

replay(uuid_to_replay, skip_computations=False)[source]

Run a replay against the server. The UUID will be looked up in the database. if skip_computations is true, skip all the asks and queries, which should make the replay much faster.

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]
versioned_handler(request)[source]
handle_setup_v01(request)[source]
handle_resume_v01(request)[source]
handle_ask_v01(request)[source]

Returns dictionary with two entries: “config” – dictionary with config (keys are strings, values are floats) “is_finished” – bool, true if the strat is finished

unversioned_handler(request)[source]
handle_setup(request)[source]
handle_ask(request)[source]
handle_tell(request)[source]
handle_update(request)[source]
handle_params(request)[source]
handle_can_model(request)[source]
handle_query(request)[source]
query(query_type='max', probability_space=False, x=None, y=None, constraints=None)[source]
handle_exit(request)[source]
property strat
property parnames
property outcome_type
property n_strats
ask()[source]

get the next point to query from the model

Returns

dict – new config dict (keys are strings, values are floats)

tell(outcome, config)[source]

tell the model which input was run and what the outcome was

Parameters
  • dictionary (inputs {dict} --) –

  • strings (keys are) –

  • int. (values are floats or) –

  • over (keys should inclde all of the parameters we are tuning) –

  • 'outcome' (plus) –

  • {0 (which would be in) –

  • 1}.

  • types (TODO better) –

configure(**config_args)[source]
write_strats(termination_type)[source]
generate_debug_info(exception_type, dumptype)[source]