ome / omero-mapr

An OMERO.web app allowing to browse the data through attributes linked to the image
https://pypi.org/project/omero-mapr/
GNU Affero General Public License v3.0
5 stars 12 forks source link

Django1.11 py3 #54

Closed will-moore closed 4 years ago

will-moore commented 4 years ago

Update mapr to work on Django 1.11

will-moore commented 4 years ago

cc @olatarkowska These are the few changes I made so far. I'll keep looking at it unless you want to start working on it?

will-moore commented 4 years ago

So, this is working for me locally now for P/D/I but not S/P/W, and travis integration tests are failing.

will-moore commented 4 years ago

Travis fails in integration tests at:

    def test_api_mapannotations_query_string(self, imaprtest, ac):
        request_url = reverse("mapannotations_api_mapannotations",
>                             args=[ac['menu']])
tests/integration/test_mapr_views.py:117: 

with a NoReverseMatch.

Tried testing locally with:

git clone git://github.com/ome/omero-test-infra .omero
$ .omero/docker app

but that failed with import for test setup:

        rc = popen.wait()
        if rc != 0:
>           raise Exception("import failed: [%r] %s\n%s" % (args, rc, err))
E           Exception: import failed: [['/opt/omero/web/venv/bin/python', './bin/omero', '-s', 'omero', '-k', 'a8756b62-9553-4245-b781-8c140f2cdafa', '-p', '4064', 'import', '--skip', 'all', '--output', 'legacy', '--', path(u'/opt/omero/web/omero/tmp/omero_omero-web/255/import_fake_file_0Xjmo03&&fields=1&plateRows=1&plateCols=6&plateAcqs=1&plates=1.fake')]] 2
joshmoore commented 4 years ago

Once OMERO.server 5.6.0-m1 is uploaded, I should be able to get an omero-test-infra branch that you can use on this PR.

joshmoore commented 4 years ago

Latest travis build with the new travis infra is still showing:

>       raise NoReverseMatch(msg)
E       django.urls.exceptions.NoReverseMatch: Reverse for 'maprindex' not found. 'maprindex' is not a valid view function or pattern name.

even though the image tells me:

bash-4.2$ ./venv3/bin/pip freeze | grep -i django
You are using pip version 9.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Django==1.11.26
django-pipeline==1.6.14
joshmoore commented 4 years ago

@olatarkowska @will-moore : re-built with the latest version of omero-test-infra. Other plugins are going green, but no change here.

will-moore commented 4 years ago

Trying locally:

$ git clone git://github.com/ome/omero-test-infra .omero
Cloning into '.omero'...
remote: Enumerating objects: 597, done.
remote: Total 597 (delta 0), reused 0 (delta 0), pack-reused 597
Receiving objects: 100% (597/597), 113.23 KiB | 588.00 KiB/s, done.
Resolving deltas: 100% (351/351), done.
$ .omero/docker app
.omero/utils: line 26: conditional binary operator expected

That line is:

if [[ -v VIRTUAL_ENV ]]; then
joshmoore commented 4 years ago

.omero/utils: line 26: conditional binary operator expected

Interesting. "The version of /bin/bash on OS X as late as 10.11.3 does not support [[." Can you replace that line with: if [ -n "$VIRTUAL_ENV" ]; then?

will-moore commented 4 years ago

As discussed, this works:

VIRTUAL_ENV=${VIRTUAL_ENV:-}
if [ ! -z ${VIRTUAL_ENV} ]; then

or if [ ! -z ${VIRTUAL_ENV:-} ]; then

Gave me:

flake8.main.application   MainProcess   1879 INFO     Found a total of 12 violations and reported 1
./omero_mapr/show.py:85:29: F821 undefined name 'long'

which is not the same as travis failure above:

>       raise NoReverseMatch(msg)
E       django.urls.exceptions.NoReverseMatch: Reverse for 'maprindex' not found. 'maprindex' is not a valid view function or pattern name.

but easier to fix...

will-moore commented 4 years ago
        if rc != 0:
            raise Exception("import failed: [%r] %s\n%s\n%s" % (
>               args, rc, out, err))
E           Exception: import failed: [['/opt/omero/web/venv3/bin/python', './bin/omero', '-s', 'omero', '-k', 'b9ed32fb-56c6-4f6c-a2c7-8ac7d2018755', '-p', '4064', 'import', '--skip', 'all', '--output', 'legacy', '--', path('/opt/omero/web/OMERO.web/var/omero/tmp/omero_omero-web/352/import_fake_file_0cq2rh6d_&&plates=1&plateAcqs=1&plateCols=6&plateRows=1&fields=1.fake')]] 1
E           b''
E           b'  File "./bin/omero", line 2\n    . /opt/omero/web/venv3/bin/activate\n    ^\nSyntaxError: invalid syntax\n'
sbesson commented 4 years ago

After some initial debugging, https://github.com/ome/omero-mapr/pull/54#issuecomment-555448578 is related to the import set-up defined in https://github.com/ome/omero-mapr/blob/0.3.2/omero_mapr/testlib/__init__.py#L51.

This import depends on this stage of omero-test-infra which downloads the OMERO.java client into the Web docker container so that omero import commands can be executed - https://github.com/ome/omero-test-infra/blob/5862dfdd1e2155dffd6a89d6c518db9d37e90246/docker#L149-L154.

I think the two options are:

joshmoore commented 4 years ago

I imagine eventually a plugin is going to want to import in which case it probably is worth enabling java sooner rather than later.

will-moore commented 4 years ago

As discussed, disable omero-test-infra for now to get this green and deployable.

manics commented 4 years ago

Merging as discussed in the Python chat.