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

Fixing some problem MULTIPROCESS_SERVER #888

Merged
merged 13 commits into from
Aug 8, 2024
Merged

Conversation

pariterre
Copy link
Member

@pariterre pariterre commented Aug 6, 2024

This change is Reviewable

Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 9 files at r1, 8 of 8 files at r2, all commit messages.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @pariterre)


bioptim/gui/online_callback_server.py line 41 at r2 (raw file):

class _HeaderMessage(StrEnum):

_HeaderResponse ?


bioptim/gui/online_callback_server.py line 73 at r2 (raw file):

    @intstaticproperty
    def header_generic_len() -> int:
        return 1024

HEADER_GENERIC_LENGTH = 1024


bioptim/gui/online_callback_server.py line 332 at r2 (raw file):

            for phase_times in data_json["dummy_phase_times"]:
                dummy_time_vector.append([DM(v) for v in phase_times])
            del data_json["dummy_phase_times"]

comprehension list

Code quote:

            dummy_time_vector = []
            for phase_times in data_json["dummy_phase_times"]:
                dummy_time_vector.append([DM(v) for v in phase_times])
            del data_json["dummy_phase_times"]

bioptim/gui/online_callback_server.py line 480 at r2 (raw file):

        self._host = host if host else _DEFAULT_HOST
        self._port = port if port else _DEFAULT_PORT

initialize with super the object first

Code quote:

        self._host = host if host else _DEFAULT_HOST
        self._port = port if port else _DEFAULT_PORT

bioptim/gui/online_callback_server.py line 521 at r2 (raw file):

                    "Could not connect to the plotter server, make sure it is running by calling 'PlottingServer()' on "
                    "another python instance or allowing for automatic start (Linux or Windows) of the server setting "
                    "the online_option to 'OnlineOptim.MULTIPROCESS_SERVER' when instantiating your solver"

.


bioptim/gui/online_callback_server.py line 611 at r2 (raw file):

        if (
            self._should_wait_ok_to_client_on_new_data
            and self._socket.recv(_HeaderMessage.header_len).decode() != _HeaderMessage.OK

has_received_OK


bioptim/gui/online_callback_server.py line 619 at r2 (raw file):

        if (
            self._should_wait_ok_to_client_on_new_data
            and self._socket.recv(_HeaderMessage.header_len).decode() != _HeaderMessage.OK

Idem


bioptim/gui/utils.py line 1 at r2 (raw file):

class strstaticproperty:

"""custom decorators for str"""


bioptim/gui/utils.py line 9 at r2 (raw file):

class intstaticproperty:

"""custom decorators for int"""


bioptim/interfaces/interface_utils.py line 36 at r2 (raw file):

    online_optim = interface.opts.online_optim.get_default()
    if online_optim == OnlineOptim.MULTIPROCESS:

map_onlineoptim_to_online_callback = {
OnlineOptim.MULTIPROCESS: OnlineCallbackMultiprocess,
OnlineOptim.MULTIPROCESS_SERVER : OnlineCallbackServer,
...,
}

online_callback = map_onlineoptim_to_online_callback.get(online_optim, None)

if online_callback is None:
raise ....

@Ipuch
Copy link
Collaborator

Ipuch commented Aug 8, 2024

Minimal test if needed.

Copy link
Member Author

@pariterre pariterre left a comment

Choose a reason for hiding this comment

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

Reviewable status: 11 of 14 files reviewed, 10 unresolved discussions (waiting on @Ipuch)


bioptim/gui/online_callback_server.py line 41 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

_HeaderResponse ?

_ResponseHeader done
And found a way to do what should have been done previously


bioptim/gui/online_callback_server.py line 73 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

HEADER_GENERIC_LENGTH = 1024

Done.


bioptim/gui/online_callback_server.py line 332 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

comprehension list

This would be a double list comprehension, it is probably clearer to keep it as is


bioptim/gui/online_callback_server.py line 480 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

initialize with super the object first

Done


bioptim/gui/online_callback_server.py line 521 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

.

Done.


bioptim/gui/online_callback_server.py line 611 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

has_received_OK

Done.


bioptim/gui/online_callback_server.py line 619 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

Idem

Done.


bioptim/interfaces/interface_utils.py line 36 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

map_onlineoptim_to_online_callback = {
OnlineOptim.MULTIPROCESS: OnlineCallbackMultiprocess,
OnlineOptim.MULTIPROCESS_SERVER : OnlineCallbackServer,
...,
}

online_callback = map_onlineoptim_to_online_callback.get(online_optim, None)

if online_callback is None:
raise ....

This looks much more confusing to me, while taking more lines, sticking with previous :P


bioptim/gui/utils.py line 1 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

"""custom decorators for str"""

Removed


bioptim/gui/utils.py line 9 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

"""custom decorators for int"""

Removed

Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @pariterre)

@Ipuch Ipuch merged commit ddfbcd8 into pyomeca:master Aug 8, 2024
19 of 22 checks passed
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