Input/Output Drivers¶
File Input Drivers¶
-
class
cis_interface.drivers.FileInputDriver.
FileInputDriver
(name, args, **kwargs)[source]¶ Class that sends messages read from a file.
Parameters:
-
class
cis_interface.drivers.AsciiFileInputDriver.
AsciiFileInputDriver
(name, args, **kwargs)[source]¶ Class that sends lines from an ASCII file.
Parameters: - name (str) – Name of the queue that messages should be sent to.
- args (str or dict) – Path to the file that messages should be read from or dictionary containing the filepath and other keyword arguments to be passed to the created AsciiFile object.
- comment (str, optional) – String that should be used to identify
comments. Default set by
AsciiFile
. - newline (str, optional) – String that should be used to identify
the end of a line. Default set by
AsciiFile
. - **kwargs – Additional keyword arguments are passed to parent class.
-
class
cis_interface.drivers.AsciiTableInputDriver.
AsciiTableInputDriver
(name, args, **kwargs)[source]¶ Class to handle input from an ASCII table.
Parameters: - name (str) – Name of the input queue to send messages to.
- args (str or dict) – Path to the file that messages should be read from or dictionary containing the filepath and other keyword arguments to be passed to the created AsciiTable object.
- format_str (str) – Format string that should be used to format output in the case that the io_mode is ‘w’ (write). It is not required if the io_mode is any other value.
- field_names (list, optional) – List of column names. Defaults to None.
- field_units (list, optional) – List of column units. Defaults to None.
- use_astropy (bool, optional) – If True, astropy is used to determine a table’s format if it is installed. If False, a format string must be contained in the table. Defaults to False.
- delimiter (str, optional) – String that should be used to separate columns. Default set by serialize._default_delimiter.
- comment (str, optional) – String that should be used to identify comments. Default set by serialize._default_comment.
- newline (str, optional) – String that should be used to identify the end of a line. Default set by serialize._default_newline.
- as_array (bool, optional) – If True, the table contents are sent all at once as an array. Defaults to False.
- **kwargs – Additional keyword arguments are passed to parent class.
-
class
cis_interface.drivers.PickleFileInputDriver.
PickleFileInputDriver
(name, args, **kwargs)[source]¶ Class that sends messages read from a file.
Parameters:
File Output Drivers¶
-
class
cis_interface.drivers.FileOutputDriver.
FileOutputDriver
(name, path, in_temp=False, **kwargs)[source]¶ Class to handle output of received messages to a file.
Parameters: - name (str) – Name of the output queue to receive messages from.
- path (str) – Path to the file that messages should be written to.
- in_temp (bool, str, optional) – If True or ‘True’, the path will be considered relative to the temporary directory. Defaults to False.
- **kwargs – Additional keyword arguments are passed to the parent class.
-
class
cis_interface.drivers.AsciiFileOutputDriver.
AsciiFileOutputDriver
(name, args, **kwargs)[source]¶ Class to handle output line by line to an ASCII file.
Parameters: - name (str) – Name of the output queue to receive messages from.
- args (str or dict) – Path to the file that messages should be written to or dictionary containing the filepath and other keyword arguments to be passed to the created AsciiFile object.
- comment (str, optional) – String that should be used to identify
comments. Default set by
AsciiFile
. - newline (str, optional) – String that should be used to identify
the end of a line. Default set by
AsciiFile
. - **kwargs – Additional keyword arguments are passed to parent class.
-
class
cis_interface.drivers.PickleFileOutputDriver.
PickleFileOutputDriver
(name, args, **kwargs)[source]¶ Class that writes received messages to a file.
Parameters:
General Input Drivers¶
-
class
cis_interface.drivers.InputDriver.
InputDriver
(name, args, **kwargs)[source]¶ Driver for receiving input from another model’s comm via a local comm.
Parameters:
General Output Drivers¶
-
class
cis_interface.drivers.InputDriver.
InputDriver
(name, args, **kwargs)[source] Driver for receiving input from another model’s comm via a local comm.
Parameters:
-
class
cis_interface.drivers.RMQInputDriver.
RMQInputDriver
(name, args, **kwargs)[source] Driver for receiving input from a RabbitMQ server via a local comm.
Parameters:
Input/Output Drivers¶
-
class
cis_interface.drivers.RPCDriver.
RPCDriver
(name, args=None, **kwargs)[source]¶ Base class for any driver that requires to access to input & output queues for RPC type functionality.
Parameters: - name (str) – The name of the message queue set that the driver should connect to. (name + “_IN” and name + “_OUT”)
- **kwargs – Additional keyword arguments are passed to parent class.
-
icomm
¶ cis_interface.drivers.CommDriver
– Driver for the input message queue.
-
ocomm
¶ cis_interface.drivers.CommDriver
– Driver for the output message ueue.
-
comms_open
¶ bool – True if both input and output comms open.
-
is_valid
¶ bool – True if both comms are open and parent class is valid.
-
n_msg_in
¶ int – The number of messages in the input comm.
-
n_msg_out
¶ int – The number of messages in the output comm.
-
recv
(*args, **kwargs)[source]¶ Receive message smaller than maxMsgSize from the input comm.
Parameters: - *args – Arguments are passed to input comm recv method.
- **kwargs – Keyword arguments are passed to input comm recv method.
Returns: - Success or failure of recv and the received
message.
Return type:
-
recv_nolimit
(*args, **kwargs)[source]¶ Receive message larger than maxMsgSize from the output comm.
Parameters: - *args – Arguments are passed to input comm recv_nolimit method.
- **kwargs – Keyword arguments are passed to input comm recv_nolimit method.
Returns: - Success or failure of recv and the received
message.
Return type:
-
send
(data, *args, **kwargs)[source]¶ Send message smaller than maxMsgSize to the output comm.
Parameters: - data (str) – Message to be sent.
- *args – Arguments are passed to output comm send method.
- **kwargs – Keyword arguments are passed to output comm send method.
Returns: Succes or failure of send.
Return type:
-
send_nolimit
(data, *args, **kwargs)[source]¶ Send message larger than maxMsgSize to the input comm.
Parameters: - data (str) – Message to be sent.
- *args – Arguments are passed to output comm send_nolimit method.
- **kwargs – Keyword arguments are passed to output comm send_nolimit method.
Returns: Succes or failure of send.
Return type:
-
class
cis_interface.drivers.ClientDriver.
ClientDriver
(model_request_name, request_name=None, comm=None, comm_address=None, **kwargs)[source]¶ Alias for ClientRequestDriver.
-
class
cis_interface.drivers.ServerDriver.
ServerDriver
(model_request_name, request_name=None, comm=None, comm_address=None, **kwargs)[source]¶ Alias for ServerRequestDriver.