Skip to content

BOINC Cluster - Flask application for monitoring and managing BOINC core clients.

Notifications You must be signed in to change notification settings

drakej/boinc-cluster

Repository files navigation

BOINC Cluster

Flask Application for monitoring and managing a BOINC cluster (multiple hosts).

Also includes python API bindings for the XML RPC_GUI API that the BOINC core client exposes.

The Problem

  • There's currently a lack of easily deployable web applications to manage and monitor multiple BOINC clients (as a cluster of sorts)

The Solution

  • A flask application that utilizes the existing python code provided by boinc-indicator. A huge thanks to Rodrigo Silva who wrote that code for Linux in python and saved myself a lot of time of having to reimplement the RPC API in python (BOINC itself uses C/C++)

The Approach

  • rpc.py is a re-write of gui_rpc_client.{h,cpp} in Python. Should provide the GUI_RPC API as faithfully as possible, in a Pythonic way, similar to what PyGTK/PyGI/PyGObject/gir bindings do with Gtk/GLib/etc libs. It starts as direct copy-and-paste of the C++ code as comments, and is progressively translated to Python code. C++ structs and enums are converted to classes, class RpcClient() being the port of struct RPC_CLIENT.

  • client.py is a conversion of boinccmd, not only from C++ to Python, but also from a command-line utility to an API library. Uses rpc.RpcClient calls to provide an interface that closely matches the command-line options of boinccmd, ported as methods of a BoincClient class.

  • boinccluster.py is the Flask application code which utilizes the BOINC client code in client.py which in turn uses rpc.py

  • Since API and BOINC Cluster Flask application are distinct, in the future they they can be packaged separately and most likely will be when I find the time to isolate and ensure that code is of sufficient quality.

The Challenges

  • Dealing with timeouts when a client is offline or not available. There's a balance to be struct right now since the code isn't aware of if it's attempted a connection prior to each attempt. Currently it's hardcoded in rpc.py but I plan to move it to the configuration long term and implement a way to detect the host is offline and stop attempting connections.

Requirements

  • Python (tested in 3.10)
  • BOINC Client install accessible via TCP/IP LAN

Using the API library

Package and modules names are not set in stone yet. Actually, API is still a non-working stub. But, assuming a boinc package in PYTHONPATH, it will be something like:

For the client API (emulating the options of boinccmd):

from client import BoincClient
bc = BoincClient()
status = bc.get_cc_status()

For the XML GUI_RPC API:

from rpc import RpcClient
rpc = RpcClient()
rpc.init()
status = rpc.get_status()

The idea is to make the client API somewhat higher-lever and a bit more straightforward than the GUI_RPC, since it automatically deals with deals with exchange_version(), read_gui_rpc_password() and authorize(), but it also may have fewer features. Maybe in the future we realize having 2 layers is pointless, and merge both in a single module that provides both complete feature set and straightforward usage. Only time (or you) will tell.

Written by

Licenses and Copyright

Copyright (C) 2013 Rodigo Silva (MestreLion) [email protected]. Copyright (C) 2020 Jonathan Drake (drakej).

License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

About

BOINC Cluster - Flask application for monitoring and managing BOINC core clients.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages