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

Gsoc2024 rebased autoplot #2547

Merged
merged 18 commits into from
Nov 22, 2024
Merged

Gsoc2024 rebased autoplot #2547

merged 18 commits into from
Nov 22, 2024

Conversation

ReimarBauer
Copy link
Member

Purpose of PR?:

This is the current GSOC Project by PreetamSundarDas rebased to develop.

I do mark in the PR what we need to change on this Branch before it can be merged.

Feel free to help with the ToDo's

update msui mainwindow based on left treewidget, download from operations implemented completely and prcess dialogs added, update msui mainwindow based on left treewidget,
@ReimarBauer ReimarBauer marked this pull request as draft October 4, 2024 06:19
mslib/msui/topview.py Outdated Show resolved Hide resolved
@@ -165,11 +271,13 @@ def draw(self, flight, section, vertical, filename, init_time, time, url, layer,
image_io = io.BytesIO(img.read())
img = PIL.Image.open(image_io)
self.myfig.draw_image(img)
self.myfig.fig.savefig(f"{flight}_{layer}_{no_of_plots}.png")
t = str(time)
Copy link
Member Author

@ReimarBauer ReimarBauer Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToDo: t as extra var seems not needed

That can be looked up on a refactoring. Some method have too much lines. Some code is duplicated.


def get_op_id(token, mscolab_server_url, curr_op):
logging.debug('get_recent_op_id')
if verify_user_token(mscolab_server_url, token):
Copy link
Member Author

@ReimarBauer ReimarBauer Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToDo: refactor similiar to
https://github.com/Open-MSS/MSS/pull/2521/files#diff-8bb1b53508f9fe252a80649575f92b7aa4756be8dda54c217a7c1d9063d6b0c5

This should be done after the merge into develop. It is also a question if we need that here.

* rename cli_tool back to main

* renamed dock to apd

* refactored session and response names

* improve comment
@ReimarBauer
Copy link
Member Author

ReimarBauer commented Oct 5, 2024

ToDo: On Sideview or Linearview the operation/flights did not reload updaten on clicking in the navigation of the autoplot widget

#2553

@ReimarBauer
Copy link
Member Author

ToDo: On Sideview or Linearview the operation/flights did not reload updaten on clicking in the navigation of the autoplot widget

#2553

@ReimarBauer
Copy link
Member Author

ReimarBauer commented Oct 5, 2024

When not logged in or not the flightpath loaded, errors are shown on the terminal. A user should get shown what is missing. e.g. you need to login to the server to access the operations or/and open the flighttracks.

problem_with_access_to_files_ops

addressed by:
#2557

@ReimarBauer
Copy link
Member Author

When different projections are used a reload of flight data triggered by e.g. sideview does not use on topview the stored projection. It keeps the current selected.

projection_did_not_change

@ReimarBauer
Copy link
Member Author

When not using a localhost mscolab server I ran into. It seems not to use the user defined mscolab_server_url

CRITICAL: MSS Version: 9.2.0
CRITICAL: Python Version: 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0]
CRITICAL: Platform: Linux-6.11.0-102007-tuxedo-x86_64-with-glibc2.35 (('64bit', 'ELF'))
CRITICAL: Fatal error: Traceback (most recent call last):
  File "/home/reimar/MAIN/MSS/mslib/msui/mscolab.py", line 706, in after_login
    self.conn = sc.ConnectionManager(self.token, user=self.user, mscolab_server_url=self.mscolab_server_url)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/msui/socket_control.py", line 65, in __init__
    self.sio.connect(self.mscolab_server_url)
  File "/home/reimar/Miniforge/envs/mssdev/lib/python3.11/site-packages/socketio/client.py", line 168, in connect
    raise exceptions.ConnectionError(
socketio.exceptions.ConnectionError: One or more namespaces failed to connect

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/reimar/MAIN/MSS/mslib/msui/mscolab.py", line 379, in login_handler
    self.mscolab.after_login(data["email"], self.mscolab_server_url, response)
  File "/home/reimar/MAIN/MSS/mslib/msui/mscolab.py", line 708, in after_login
    raise MSColabConnectionError("Couldn't create a socket connection. Maybe the MSColab server is too old."
mslib.msui.mscolab_exceptions.MSColabConnectionError: Couldn't create a socket connection. Maybe the MSColab server is too old.(One or more namespaces failed to connect). New Login required!

ERROR: Problems reloading stored performance settings (<class 'TypeError'>: unable to convert a C++ 'QVariantMap' instance to a Python object). Switching to default
ERROR: unexpected error: <class 'requests.exceptions.ConnectionError'> http://localhost:8083/token HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /token (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x707c1ecb7650>: Failed to establish a new connection: [Errno 111] Verbindungsaufbau abgelehnt'))
Traceback (most recent call last):
  File "/home/reimar/MAIN/MSS/mslib/msui/autoplot_dockwidget.py", line 147, in <lambda>
    self.downloadPushButton.clicked.connect(lambda: self.download_plots_cli(config_settings))
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/msui/autoplot_dockwidget.py", line 199, in download_plots_cli
    ctx.invoke(cli_tool, **args)
  File "/home/reimar/Miniforge/envs/mssdev/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/Miniforge/envs/mssdev/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 467, in main
    top_view = TopViewPlotting(cpath, mss_url, mss_password, mss_auth)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 212, in __init__
    super(TopViewPlotting, self).__init__(cpath, mss_auth, mss_password, mss_url)
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 176, in __init__
    self.read_operation(flight, username, password, mscolab_server_url)
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 198, in read_operation
    self.wps, self.wp_model_data = load_from_operation(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@ReimarBauer
Copy link
Member Author

ReimarBauer commented Oct 6, 2024

When not using a localhost mscolab server I ran into. It seems not to use the user defined mscolab_server_url

CRITICAL: MSS Version: 9.2.0
CRITICAL: Python Version: 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0]
CRITICAL: Platform: Linux-6.11.0-102007-tuxedo-x86_64-with-glibc2.35 (('64bit', 'ELF'))
CRITICAL: Fatal error: Traceback (most recent call last):
  File "/home/reimar/MAIN/MSS/mslib/msui/mscolab.py", line 706, in after_login
    self.conn = sc.ConnectionManager(self.token, user=self.user, mscolab_server_url=self.mscolab_server_url)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/msui/socket_control.py", line 65, in __init__
    self.sio.connect(self.mscolab_server_url)
  File "/home/reimar/Miniforge/envs/mssdev/lib/python3.11/site-packages/socketio/client.py", line 168, in connect
    raise exceptions.ConnectionError(
socketio.exceptions.ConnectionError: One or more namespaces failed to connect

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/reimar/MAIN/MSS/mslib/msui/mscolab.py", line 379, in login_handler
    self.mscolab.after_login(data["email"], self.mscolab_server_url, response)
  File "/home/reimar/MAIN/MSS/mslib/msui/mscolab.py", line 708, in after_login
    raise MSColabConnectionError("Couldn't create a socket connection. Maybe the MSColab server is too old."
mslib.msui.mscolab_exceptions.MSColabConnectionError: Couldn't create a socket connection. Maybe the MSColab server is too old.(One or more namespaces failed to connect). New Login required!

ERROR: Problems reloading stored performance settings (<class 'TypeError'>: unable to convert a C++ 'QVariantMap' instance to a Python object). Switching to default
ERROR: unexpected error: <class 'requests.exceptions.ConnectionError'> http://localhost:8083/token HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /token (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x707c1ecb7650>: Failed to establish a new connection: [Errno 111] Verbindungsaufbau abgelehnt'))
Traceback (most recent call last):
  File "/home/reimar/MAIN/MSS/mslib/msui/autoplot_dockwidget.py", line 147, in <lambda>
    self.downloadPushButton.clicked.connect(lambda: self.download_plots_cli(config_settings))
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/msui/autoplot_dockwidget.py", line 199, in download_plots_cli
    ctx.invoke(cli_tool, **args)
  File "/home/reimar/Miniforge/envs/mssdev/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/Miniforge/envs/mssdev/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 467, in main
    top_view = TopViewPlotting(cpath, mss_url, mss_password, mss_auth)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 212, in __init__
    super(TopViewPlotting, self).__init__(cpath, mss_auth, mss_password, mss_url)
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 176, in __init__
    self.read_operation(flight, username, password, mscolab_server_url)
  File "/home/reimar/MAIN/MSS/mslib/utils/mssautoplot.py", line 198, in read_operation
    self.wps, self.wp_model_data = load_from_operation(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After removing the file it does. We maybe should have done an update in our configs once a different mscolab server is used. This can become later improved.

@ReimarBauer
Copy link
Member Author

When using a http_auth protected mscolab server mssautoplot can't login.

@ReimarBauer
Copy link
Member Author

When using a http_auth protected mscolab server mssautoplot can't login.

http_auth protected mscolab server mssautoplot can't login.

self.config["predefined_map_sections"][section]["CRS"].lower())
except KeyError as e:
print(e)
sys.exit("Invalid SECTION and/or CRS")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToDo: don't sys.exit(), this will also end msui when it is called by the msui - autoplot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be raise SystemExit(...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if filename != "" and filename == flight:
self.read_operation(flight, username, password, mscolab_server_url)
elif filename != "":
self.read_ftml(filename)

def read_ftml(self, filename):
dirpath = "./"
Copy link
Member Author

@ReimarBauer ReimarBauer Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToDo: we should be able to pass a dir and fall back can be the local dir.

This blocks its usage from the autoplot dockingwidget, when the ftml data file is not found.
We maybe should store the dir of the file in the mssautoplot.json and not only the filename.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cli should have a parameter to bypass directories defined in the mssautoplot.json for ftml file, and on default we should store fullpath of the file.

@ReimarBauer ReimarBauer marked this pull request as ready for review November 21, 2024 07:06
@ReimarBauer
Copy link
Member Author

@joernu76 this is an improved version of the origin GSOC project. There are still some ToDos, but they should be done in different PR.

@ReimarBauer ReimarBauer merged commit 604a18c into develop Nov 22, 2024
13 of 21 checks passed
@ReimarBauer ReimarBauer deleted the GSOC2024-rebased-autoplot branch November 22, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants