Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/SK-873 | Remove plots.py #642

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading