8#include <boost/uuid/uuid.hpp> 
   10#include <pybind11/pybind11.h> 
   11#include <pybind11/embed.h> 
   12#include "nlohmann/json.hpp" 
   37        Server(
const std::string& socket);
 
   60                void        write(
const std::string& txt);
 
   62                std::string 
str() 
const;
 
 
   94        virtual uint64_t         
send(
const std::string& output, 
const std::string& msg_type,
 
   95                                                uint64_t parent_id=0, uint64_t cell_id=0, 
bool last_in_sequence=
false);
 
  100        bool                     handles(
const std::string& otype) 
const;
 
  189                                                        bool handle_output=
true,
 
  190                                                        bool extract_variables=
false,
 
  191                                                        std::set<std::string> remove_variable_assignments=std::set<std::string>());
 
  211        std::future<std::string> 
job;
 
 
std::set< std::string > remove_variable_assignments
Definition Server.hh:168
 
std::set< std::string > variables
Definition Server.hh:167
 
std::string input
Definition Server.hh:163
 
uint64_t cell_id
Definition Server.hh:166
 
Block()
Definition Server.cc:458
 
websocket_server::id_type ws_id
Definition Server.hh:161
 
std::string output
Definition Server.hh:164
 
std::deque< uint64_t > reuse_output_cell_ids
Definition Server.hh:174
 
std::string msg_type
Definition Server.hh:162
 
std::string error
Definition Server.hh:165
 
nlohmann::json response
Definition Server.hh:179
 
Python output catching.
Definition Server.hh:55
 
void clear()
Definition Server.cc:66
 
std::string str() const
Definition Server.cc:72
 
CatchOutput()
Definition Server.cc:52
 
std::string collect
Definition Server.hh:64
 
void write(const std::string &txt)
Definition Server.cc:60
 
boost::uuids::uuid uuid
Definition Server.hh:133
 
Connection()
Definition Server.cc:303
 
websocket_server::id_type ws_id
Definition Server.hh:132
 
Object representing a Cadabra server, capable of receiving messages on a websocket,...
Definition Server.hh:33
 
void on_message(websocket_server::id_type id, const std::string &msg, const websocket_server::request_type &req, const std::string &ip_address)
Definition Server.cc:472
 
Block current_block
Definition Server.hh:182
 
void send_progress_update(const std::string &msg, int n, int total)
Definition Server.cc:661
 
void init()
Definition Server.cc:135
 
CatchOutput catchErr
Definition Server.hh:67
 
virtual void on_block_error(Block)
Definition Server.cc:691
 
virtual void on_block_finished(Block)
Called by the run_block() thread upon completion of the task.
Definition Server.cc:573
 
pybind11::object main_namespace
Definition Server.hh:222
 
std::thread runner
Definition Server.hh:148
 
std::string authentication_token
Definition Server.hh:140
 
pybind11::module main_module
Definition Server.hh:221
 
virtual void on_kernel_fault(Block)
Definition Server.cc:720
 
ConnectionMap connections
Definition Server.hh:136
 
std::future< std::string > job
Definition Server.hh:211
 
void on_open(websocket_server::id_type id)
Definition Server.cc:308
 
virtual ~Server()
Definition Server.cc:47
 
Stopwatch sympy_stopwatch
Definition Server.hh:70
 
std::mutex ws_mutex
Definition Server.hh:144
 
CatchOutput catchOut
Definition Server.hh:67
 
std::set< std::string > run_string_variables
Definition Server.hh:193
 
virtual uint64_t send(const std::string &output, const std::string &msg_type, uint64_t parent_id=0, uint64_t cell_id=0, bool last_in_sequence=false)
Raw code to send a string (which must be JSON formatted) as a message to the client.
Definition Server.cc:612
 
unsigned long main_thread_id
Definition Server.hh:153
 
websocket_server wserver
Definition Server.hh:120
 
std::map< websocket_server::id_type, Connection > ConnectionMap
Definition Server.hh:135
 
std::string run_string(const std::string &, bool handle_output=true, bool extract_variables=false, std::set< std::string > remove_variable_assignments=std::set< std::string >())
Definition Server.cc:212
 
void wait_for_job()
Thread entry point for the code that waits for blocks to appear on the block queue,...
Definition Server.cc:357
 
bool handles(const std::string &otype) const
Definition Server.cc:606
 
int run_on_port
Definition Server.hh:152
 
void dispatch_message(websocket_server::id_type, const std::string &json_string)
Takes a JSON encoded message and performs the required action to process it.
Definition Server.cc:490
 
void run(int port=0, bool exit_on_disconnect=true)
The only user-visible part: just instantiate a server object and start it with run().
Definition Server.cc:749
 
Server(const Server &)=delete
 
std::string architecture() const
Definition Server.cc:77
 
std::mutex block_available_mutex
Definition Server.hh:149
 
pybind11::scoped_interpreter guard
Definition Server.hh:220
 
std::queue< Block > block_queue
Definition Server.hh:181
 
void on_close(websocket_server::id_type id)
Definition Server.cc:317
 
Server()
Definition Server.cc:32
 
bool exit_on_disconnect
Definition Server.hh:151
 
std::condition_variable block_available
Definition Server.hh:150
 
void stop_block()
Halt the currently running block and prevent execution of any further blocks that may still be on the...
Definition Server.cc:441
 
void send_json(const std::string &)
Definition Server.cc:684
 
websocket_server::id_type current_ws_id
Definition Server.hh:183
 
Stopwatch server_stopwatch
Definition Server.hh:69
 
void wait_for_websocket()
Thread entry point for code that sets up and runs the websocket listener.
Definition Server.cc:336
 
uint64_t current_id
Definition Server.hh:184
 
bool started
Definition Server.hh:210
 
The Stopwach class provides a simple interace to allow timing function calls etc.....
Definition Stopwatch.hh:107
 
Definition websocket_server.hh:16
 
boost::beast::http::request< boost::beast::http::string_body > request_type
Definition websocket_server.hh:19
 
std::size_t id_type
Definition websocket_server.hh:18