ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

Omero figure cli #366

Closed will-moore closed 2 years ago

will-moore commented 4 years ago

This aims to simplify the install of figure by registering figure as a CLI plugin to handle setting of config and upload or replace of the figure export script. This should make the install as easy as:

pip install omero-figure
omero figure install

The install command does configuration omero config set .... for all OMERO.figure config and also uploads the export script.

If the settings are already configured, will not duplicate settings, but if a similar (but different) setting is already present, then the new settings will get added to the list. E.g. if top_link title (tooltip) is different then the config will not be recognised as already been set, so the new one will be added to top_links. Same for open_with.

The script upload will replace existing script if already installed, otherwise it will install new script.

I had to move omero_figure under src along with omero.plugins (same layout as for omero_metadata).

will-moore commented 4 years ago

Hmm - travis is failing the same as it did in https://github.com/ome/omero-figure/pull/359

  Fatal error: Unable to find local grunt.

I thought it might be the incorrect path that was causing the problem in #359 but https://github.com/ome/omero-figure/pull/366/commits/512445540248060218f838d522fa123331b9f518 didn't fix it.

cc @manics Any ideas?

jburel commented 4 years ago

@will-moore I have pushed a tmp commit that should fix the problem It requires a change in test-infra see https://github.com/ome/omero-test-infra/pull/56

jburel commented 4 years ago

Excluding this PR so we go over the other ones first

will-moore commented 4 years ago

Updated https://merge-ci.openmicroscopy.org/jenkins/job/OMERO-web/configure to use omero figure install instead of manual config.

manics commented 4 years ago

This might be for a separate PR: Since you're refactoring this would it be worth moving most of the functions in https://github.com/ome/omero-figure/blob/15b696f259ea0718c4f70533d6cfe5a8ebcbebbf/src/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py to a Python library e.g. src/omero_figure/library.py so the actual Figure_To_Pdf.py would be a much simpler wrapper?

mtbc commented 4 years ago

./src/omero/plugins/figure.py:24:1: F401 'sys' imported but unused

will-moore commented 4 years ago

Running

omero figure install

on OMERO.web job https://merge-ci.openmicroscopy.org/jenkins/job/OMERO-web/425/console failed with

12:14:17 + omero figure install
12:14:18 stdin is not a terminal: cannot request server
joshmoore commented 4 years ago

It's trying to login to upload the script? If so, you'll need to proceed with omero login ... or pass all the parameters with the one command.

will-moore commented 4 years ago

Where can I get login credentials?

joshmoore commented 4 years ago

The default omero-test-infra coordinates would be:

omero login root@omero -w omero
will-moore commented 4 years ago

At this point, OMERO-web job deploy is working with

pip install git+git://github.com/$SPACE_USER/omero-figure.git@$MERGE_PUSH_BRANCH#egg=omero-figure
omero login root@omero -w omero
omero figure install

https://merge-ci.openmicroscopy.org/jenkins/job/OMERO-web/428/ and the Figure_To_Pdf.py export script is installed and works. đź‘Ť

TODO:

will-moore commented 4 years ago

Initial testing of script_text = resource_string(__name__, 'Figure_To_Pdf.py') to load the script from the same dir as the plugin (as in e.g. at https://github.com/ome/scc/blob/master/scc/version.py#L35): Resulted in

"Can't perform this operation for loaders without 'get_data()'"
NotImplementedError: Can't perform this operation for loaders without 'get_data()'

@joshmoore hinted "You’ll probably need to search scc’s setup.py for 'data'", but that only finds include_package_data=True, which we already have set.

See https://github.com/ome/omero-figure/pull/366/commits/c7d93fce6bae3adbebda655873b7da57f11e897a

will-moore commented 4 years ago

As noted by JM, Open-with is not working on merge-ci. Not listed in https://merge-ci.openmicroscopy.org/web/webgateway/open_with/ Top-links does include figure and the app is installed, so only openwith config is failing. Added more logging in last commit...

will-moore commented 4 years ago

Updated and fixed the open-with config. Now deploying as expected.

manics commented 4 years ago

It's be good if we could consider how to make automated deployments easier to.

In https://github.com/ome/ansible-example-omero-public-user/pull/5 I concluded the easiest way to get the script in place without hardcoding a version was to copy it:

    - name: Copy Figure_To_Pdf.py script
      become: true
      become_user: omero-server
      copy:
        dest:
          /opt/omero/server/OMERO.server/lib/scripts/omero/figure_scripts/Figure_To_Pdf.py
        remote_src: true
        src:
          /opt/omero/web/venv3/lib/python3.6/site-packages/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py

For example, if omero figure ... could do one of the following without a login

This doesn't need to block this PR, but I'm mentioning it in case it affects the CLI API which we can't break after release

will-moore commented 4 years ago

@manics Copying the script could work when omero-web is installed on the same machine (same $OMERODIR) as the server. So I guess we could add that as another / alternative command e.g:

$ omero figure script upload.  # currently this is just $ omero figure script

$ omero figure script copy

Maybe we need to discuss this PR, figure commands API etc now that the proof of concept is working

snoopycrimecop commented 3 years ago

Conflicting PR. Removed from build OMERO-plugins-push#567. See the console output for more details. Possible conflicts:

--conflicts

will-moore commented 3 years ago

Build failing because this PR is not merging https://merge-ci.openmicroscopy.org/jenkins/job/OMERO-web/680/console

Merge attempt fails, although current status of this PR looks good? https://github.com/snoopycrimecop/omero-figure/commit/4cc755877a1d1d8af6069fbb8ae34e14f26c500f

Repository: ome/omero-figure
Excluded PRs:
  - PR 405 bramalingam 'Django upgrade 2 2' (status: )
  - PR 366 will-moore 'Omero figure cli' (status: )
Already up-to-date.

Generated by OMERO-plugins-push#568 (https://merge-ci.openmicroscopy.org/jenkins/job/OMERO-plugins-push/568/)

For now I'll exclude this and update OMERO-web job to do a regular install

--exclude