SEAScope.cli package

Submodules

SEAScope.cli.server module

This module contains the implementation of the processing server that can be started from the command line with seascope-processor

class SEAScope.cli.server.ProcessingUnit(s)[source]

Bases: Thread

Thread that handles a single request sent by SEAScope.

Parameters:

s (socket:socket) – The socket connected to SEAScope

close()[source]

Method called on thread termination.

It makes sure that the socket is properly closed before the object is garbage-collected.

run()[source]

Method called when the thread execution starts.

It parses the request sent by SEAScope, extracts an opcode and calls a processing handler accordingly.

SEAScope.cli.server.bind_socket(s, interface='127.0.0.1')[source]

Bind a socket to an interface.

The method tries to bind the default port (53450) first but it will fallback to the first port available if 53450 is already in use.

Parameters:
  • s (socket.socket) – The socket to bind

  • interface (string) – The IP address to which the socket must be bound to

Returns:

A tuple which contains two elements:

  • a str for the address to which the socket is actually bound to

  • a int for the port that the socket has managed to acquire

Return type:

tuple(str, int)

SEAScope.cli.server.plot_extraction()[source]

Handler called to fetch extracted data from SEAScope, render them as 2D plots and save the result as PNG images.

Returns:

A tuple which contains:

  • a bool set to True if the operation succeded

  • a str message containing the path of the output directory where the PNG files have been saved

Return type:

tuple(bool, str)

SEAScope.cli.server.plot_transect()[source]

Handler called to fetch extracted data from SEAScope, render them as transects in a single plot and save the result as a PNG image.

Returns:

A tuple which contains:

  • a bool set to True if the operation succeded

  • a str message containing the path of the output PNG file

Return type:

tuple(bool, str)

SEAScope.cli.server.seascope_processor()[source]

Method called when the user executes seascope-processor on the command line.

It setups logging before starting the sockets server.

SEAScope.cli.server.serialize_extraction()[source]

Handler called to fetch extracted data from SEAScope and save them in a file using the Numpy serialization format.

Returns:

A tuple which contains:

  • a bool set to True if the operation succeded

  • a str message containing the path of the output file

Return type:

tuple(bool, str)

SEAScope.cli.server.serve_forever()[source]

Starts a sockets server that handles requests sent by SEAScope and creates a SEAScope.cli.server.ProcessingUnit for each request to process.

Returns:

A tuple which contains two elements:

  • A bool set to False if an error occurs, True if everything went fine

  • A obj:str that contains the error message, or None if not relevant

Return type:

tuple(bool, str)

Module contents