Conversation
|
Discussed in api meeting today:
|
This allows usage of non-string attributes. E.g. 'obj.column, obj.row' for wells. But now you need to specify the 'obj' in the order_by. E.g. 'lower(obj.name)' for images etc.
|
Tests failing because of requirement for Wells support in omero-marshal: https://ci.openmicroscopy.org/view/Failing/job/OMERO-DEV-merge-integration-Python27/437/testReport/ |
| " left outer join fetch wellSamples.plateAcquisition"\ | ||
| " as plateAcquisition" | ||
| if load_pixels or load_channels: | ||
| query += ' left outer join fetch image.pixels pixels' \ |
There was a problem hiding this comment.
I will add as pixels to match the rest of the query, easier to read
There was a problem hiding this comment.
The section to load pixels and channels is also in def _getQueryString(cls, opts=None): ( line 7159)
I think we should have helper method to generate part of the query instead of having the same code in various locations of the files
If we make a change to the query, we will certainly forget to update one query
| from omero_marshal import get_encoder | ||
| from omero.model import DatasetI, ProjectI, ScreenI, PlateI, ImageI | ||
| from omero.rtypes import rstring, unwrap | ||
| from omero.model import DatasetI, ProjectI, ScreenI, PlateI, ImageI, \ |
There was a problem hiding this comment.
one per line and in alphabetical order
| import pytest | ||
| from omero.gateway import BlitzGateway | ||
| from omero_marshal import get_encoder | ||
| from omero.model import PlateI, WellI, WellSampleI, ImageI, LengthI |
There was a problem hiding this comment.
alphabetical order and one per line
| screen = get_update_service(user1).saveAndReturnObject(screen) | ||
| plate = get_update_service(user1).saveAndReturnObject(plate) | ||
|
|
||
| # Add well to first plate |
There was a problem hiding this comment.
i will add a plate acquisition to the test data since it is what will happen by default with a plate import
There was a problem hiding this comment.
I've added PlateAcquisition testing to test_api_wells.py but not duplicated this in test_api_containers.py because this test is really concerned with testing urls: Screen -> Plate -> Wells and we don't need to cover PlateAcquisitions twice. Also, it's nice to test that we can load Wells with NO Plate Acquisitions which we're not testing anywhere else now.
There was a problem hiding this comment.
I will check both cases to be on the safe side
i.e. with plate acquisitions and without
There was a problem hiding this comment.
I will update test_api_wells.py to test with & without PlateAcquisitions, but it doesn't make sense for every test to test everything. Otherwise we will never stop writing tests and all the tests will be so large that you can't understand them.
| return connection | ||
|
|
||
|
|
||
| def cmp_name_insensitive(x, y): |
There was a problem hiding this comment.
probably time to have helper methods since this one for example is now in all the test files
| @pytest.fixture() | ||
| def user1(self): | ||
| """Return a new user in a read-annotate group.""" | ||
| group = self.new_group(perms='rwra--') |
There was a problem hiding this comment.
testing other permissions will be useful
There was a problem hiding this comment.
I'm not sure what you're wanting here. Testing that queries still work in a read-only or private group? Tests in test_api_projects.py do various permissions & cross-group queries so I don't think we need to replicate this in other tests that are focussed on different objects?
There was a problem hiding this comment.
as far as I can tell only read-annotate and read-only are covered in test_api_projects.py
Also with the introduction of new roles, test with various levels of permissions need to be added (admin, owner etc).
This can be done in a follow up PR to solidify what is currently in place
We have seen previously problems when loading different objects i.e. what was true for projects
was not for, for example, image.
| well.column = rint(col) | ||
| well.row = rint(row) | ||
| well.plate = PlateI(plate.id.val, False) | ||
| # Only wells in first Column have well-samples etc |
|
|
||
| @pytest.fixture() | ||
| def small_plate(self, user1): | ||
| """ |
There was a problem hiding this comment.
same here: I will add plate acquisition to match reality
|
|
|
@jburel - I don't understand that travis failure. I have the same version of flake8 locally but don't see any failure. Also the line 149 is 2 blank lines! |
|
|
That |
|
The changes look good, waiting on travis now |
|
@jburel Travis is good, but we really need the omero-marshal PR in since without it we still have failing tests etc. |
|
of course we need to have the tests passing before we merge anything |
|
why not to add omero-marshal merge build to CI and then pip install from snoopy? Exactly as we handle other web plugins |
|
Conflicting PR. Removed from build OMERO-DEV-merge-push#576. See the console output for more details.
|
|
With requirements.txt now pointing at ome/omero-marshal#31 browsing of SPW is working on merge build, E.g. (user-3) |
| return super(ApiView, self).dispatch(*args, **kwargs) | ||
|
|
||
| def add_data(self, marshalled, request, **kwargs): | ||
| def add_data(self, marshalled, request, urls={}, **kwargs): |
There was a problem hiding this comment.
Watch out for argument constructs like this. urls={} does not create a new dictionary on every method invocation so if you modify it, add new keys, etc. they are going to get picked up and used in subsequent invocations. If you want to be on the safe side, set the default to None and create the dictionary in the method on None.
/cc @jburel
|
Is this PR going to be merged? Then I could rebase my annotation count PR #5023 (merge conflicts with this PR). |
|
Now that we have ome/omero-marshal#31 merged I think what we need to do here is revert the change to |
This reverts commit 852c3ed.
| # Urls to add to marshalled object. See ProjectsView for more details | ||
| urls = { | ||
| 'url:wells': {'name': 'api_plate_wells', | ||
| 'kwargs': {'plate_id': 'OBJECT_ID'}} |
There was a problem hiding this comment.
if that is placeholder why OBJECT_ID not just None ?
There was a problem hiding this comment.
OBJECT_ID is a unique identifier that this should be replaced with the ID of the current object. It's possible that other IDs could be used in future. Using None doesn't explicitly say what the placeholder should be replaced with.
|
tmp change has been reverted. https://ci.openmicroscopy.org/view/Failing/job/OMERO-DEV-merge-integration-Python27/451/testReport/OmeroWeb.test.integration.test_api_wells/ is green |
What this PR does
Adds support for Wells to web api.
NB: Needs ome/omero-marshal#31.
requirements.txtpoints to that branch of omero-marshal to allow testing of this PR. Once that is merged, we can revert requirements.txt.Testing this PR
test_api_wells.py/plates//plates/- each Plate will have link to 'url:wells': 'plates/:id/wells'/plates/:idalso links to 'wells'Related reading
As discussed at ome/design#65 Wells are the next object we need to support. This now allows browsing Screen -> Plate -> Well -> Image starting at
/api/.Also tests ome/omero-marshal#31.
cc @chris-allan @jburel @aleksandra-tarkowska
To consider for follow-up: