-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add mantidworkbench as an entry point for the mantidworkbench Conda package #37750
base: main
Are you sure you want to change the base?
Conversation
@@ -100,10 +100,11 @@ set(PYTHON_ARGS " -Wdefault::DeprecationWarning -Werror:::mantid -Werror:::manti | |||
set(PYTHON_EXEC_LOCAL "\${CONDA_PREFIX}/bin/python") | |||
set(PREAMBLE "${CONDA_PREAMBLE_TEXT}") | |||
set(LOCAL_PYPATH "${CMAKE_CURRENT_BINARY_DIR}/bin/") | |||
# The python command to start workbench | |||
set(MANTIDWORKBENCH_EXEC "-c \"from workbench.app.main import main; main()\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are feeling a little crazy, you can rename workbench.app.main
to workbench.app.__main__
and people then can run python -m workbench.app
to get workbench started.
For simpler things, the little import-y bit here is autogenerated by setuptools once you define the entrypoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We appear to be most of the way there https://github.com/mantidproject/mantid/blob/main/qt/applications/workbench/workbench/__main__.py
from workbench.app.main import main | ||
|
||
|
||
def launch(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is missing the bits for return codes. The final lines should be like this. Things that return None
will exit with a zero return code as you would expect.
Can the new wrapper get named |
👋 Hi, @thomashampson, Conflicts have been detected against the base branch. Please rebase your branch against the base branch. |
I'm going to change the milestone on this as it's unlikely we can get this sorted before end of tomorrow. |
44d22a5
to
c262ecd
Compare
from workbench.app.main import main | ||
|
||
|
||
def launch(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This becomes much easier to add tests to if the sys.argv
is an argument to the function
def launch(): | |
def launch(args): |
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(launch()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then this becomes
sys.exit(launch()) | |
sys.exit(launch(sys.argv)) |
command = ["launch_mantidworkbench"] + sys.argv[1:] | ||
subprocess.run(command) | ||
else: | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't main()
get the command line arguments?
88fdeea
to
01e69ff
Compare
I've updated the diagram in the description to reflect the recent changes. |
I've verified on Windows that:
|
I've verified that |
For some reason the standalone package isn't launching on MacOS. |
Co-authored-by: James Clarke <[email protected]> Co-authored-by: Thomas Hampson <[email protected]>
Co-authored-by: James Clarke <[email protected]> Co-authored-by: Thomas Hampson <[email protected]>
Co-authored-by: James Clarke <[email protected]> Co-authored-by: Thomas Hampson <[email protected]>
Co-authored-by: James Clarke <[email protected]> Co-authored-by: Jonathan Haigh <[email protected]>
…inux Co-authored-by: James Clarke <[email protected]> Co-authored-by: Jonathan Haigh <[email protected]>
Co-authored-by: James Clarke <[email protected]> Co-authored-by: Jonathan Haigh <[email protected]>
for more information, see https://pre-commit.ci
Renamed from workbench_launcher_jemalloc to launch_mantidworkbench
Co-authored-by: Pete Peterson <[email protected]>
01e69ff
to
e34ccfb
Compare
https://builds.mantidproject.org/job/build_packages_from_branch/956/ macOS standalone after rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops didn't mean to approve yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(fix the mac stand alone)
https://builds.mantidproject.org/job/build_packages_from_branch/959/ This one's going to be a winner Edit: updated to second attempt at winning |
Then someone can pass in arguments directly instead of using sys.argv. If no arguments are given then sys.argv gets used by default. Co-authored-by: Thomas Hampson <[email protected]>
748c60f
to
6492632
Compare
Description of work
mantidworkbench
as an entry point to the application. Users can now launch with eitherworkbench
ormantidworkbench
from within a Conda environment.jemalloc
on Linux. Previously, theworkbench
entry point did not include the samejemalloc
setup as themantidworkbench
script that was available on Linux installs. Now on Linux both entry points will call the same launch script that will configurejemalloc
to be used.Here is a diagram to help illustrate the changes:
Summary of work
Added a new wrapper script called
workbench_launch_wrapper
that is now the entry point defined in the conda-build recipe. The new script will detect whether you are using Linux. If not, workbench is launched as before. If it is Linux, it will call the script that used to be namedmantidworkbench
that will configurejemalloc
before launching the application.Purpose of work
mantidworkbench
entry point to avoid confusion.jemalloc
)workbench
), it bypasses thejemalloc
setup, and the application does not perform well.Fixes #37538
To test:
On all OS:
Install the test package:
conda install jclarkestfc/label/entryPointTest::mantidworkbench
Test the following things:
mantidworkbench
andworkbench
--single-process
argument to either entry pointos.environ['LD_PRELOAD']
in workbench's python console. It should output the location oflibjemalloc.so.2
from inside your Conda environment.https://builds.mantidproject.org/job/build_packages_from_branch/957/
Reviewer
Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.