Skip to content

Commit

Permalink
removed plots.py & the useage of the Plot class from the old api (ser…
Browse files Browse the repository at this point in the history
…ver & interface.py) (#642)
  • Loading branch information
niklastheman authored Jun 24, 2024
1 parent 9a903eb commit 308d66a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 464 deletions.
8 changes: 0 additions & 8 deletions docs/fedn.network.dashboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ fedn.network.dashboard package
Submodules
----------

fedn.network.dashboard.plots module
-----------------------------------

.. automodule:: fedn.network.dashboard.plots
:members:
:undoc-members:
:show-inheritance:

fedn.network.dashboard.restservice module
-----------------------------------------

Expand Down
25 changes: 0 additions & 25 deletions fedn/network/api/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from fedn.network.combiner.interfaces import CombinerInterface, CombinerUnavailableError
from fedn.network.state import ReducerState, ReducerStateToString
from fedn.utils.checksum import sha
from fedn.utils.plots import Plot

__all__ = ("API",)

Expand Down Expand Up @@ -901,30 +900,6 @@ def get_client_config(self, checksum=True):
payload["checksum"] = checksum_str
return jsonify(payload)

def get_plot_data(self, feature=None):
"""Get plot data.
:return: The plot data as json response.
:rtype: :py:class:`flask.Response`
"""
plot = Plot(self.control.statestore)

try:
valid_metrics = plot.fetch_valid_metrics()
feature = feature or valid_metrics[0]
box_plot = plot.create_box_plot(feature)
except Exception as e:
valid_metrics = None
box_plot = None
logger.debug(e)

result = {
"valid_metrics": valid_metrics,
"box_plot": box_plot,
}

return jsonify(result)

def list_combiners_data(self, combiners):
"""Get combiners data.
Expand Down
20 changes: 0 additions & 20 deletions fedn/network/api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,26 +625,6 @@ def list_combiners_data():
if custom_url_prefix:
app.add_url_rule(f"{custom_url_prefix}/list_combiners_data", view_func=list_combiners_data, methods=["POST"])


@app.route("/get_plot_data", methods=["GET"])
@jwt_auth_required(role="admin")
def get_plot_data():
"""Get plot data from the statestore.
rtype: json
"""
try:
feature = request.args.get("feature", None)
response = api.get_plot_data(feature=feature)
except TypeError:
return jsonify({"success": False, "message": "Invalid data provided"}), 400
except Exception:
return jsonify({"success": False, "message": "An unexpected error occurred"}), 500
return response


if custom_url_prefix:
app.add_url_rule(f"{custom_url_prefix}/get_plot_data", view_func=get_plot_data, methods=["GET"])

if __name__ == "__main__":
config = get_controller_config()
port = config["port"]
Expand Down
Loading

0 comments on commit 308d66a

Please sign in to comment.