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

Merge populate_metadata PRs (rebased onto develop) #5241

Merged
merged 100 commits into from May 9, 2017
Merged

Merge populate_metadata PRs (rebased onto develop) #5241

merged 100 commits into from May 9, 2017

Conversation

atarkowska
Copy link
Member

@atarkowska atarkowska commented Apr 10, 2017

This is the same as gh-5232 but rebased onto develop and gh-5243


What this PR does

merge #5218 #5220 #5222 #5223 #5224 #5226 #5227 #5229 (no conflicts)

TODO:

@atarkowska
Copy link
Member Author

--rebased-from #5232

This was referenced Apr 10, 2017
@jburel jburel added the develop label Apr 10, 2017
emilroz and others added 26 commits April 12, 2017 09:21
Most methods for dataset loading and parsing were left unimplement.
Now a `Dataset:`-style object can be passed to populate_metadata.py
and images will be looked up by name. Note: there's a small bug with
name lookup that will be corrected separately.
The assumptions for well/imaging naming in a plate or screen
differ from those from image naming in a dataset since there's
no unique way to reference an image in a dataset like there is
well "A1" for example. This commit loosens some of those rules
to allow image columns and image name columns to work together
in the case of datasets. The assumption is that for population
the ID of the image in a dataset won't be known. Instead names
of images will be used as a unique identifier. Currently only
a warning is issued if the name is not unique.
In general, populate_metadata.py looks to be in line for a
refactoring. The number of if-clauses as well as the unhandled
cases (like no catch-all for unknown targets in delete) is
making this ever harder to work with.

All tests passing.
In order to allow Projects to smartly handle multiple images
with the same name (though not in the same dataset), the internals
of ValueResolver have been hidden within a ValueWrapper class.
ValueResolver chooses once which ValueWrapper to use internally
after which the various if/then blocks based on target object are
no longer necessary (needs further refactoring). There *are* still
if/then blocks basked on column-type. These could use some cleaning
but will likely remain to be necessary for multiple-dispatch style
handling.
For extremely large screens (idr0016), both adding
map annotations as well as deleting them lead to either
PG errors or Ice.MessageSizeMax exceptions. Now both
are done in batches of 1000.
def createCsv(self, *args, **kwargs):
csvFileName = super(GZIP, self).createCsv(*args, **kwargs)
gzipFileName = "%s.gz" % csvFileName
with open(csvFileName, 'rb') as f_in, \
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@aleksandra-tarkowska Maybe try nesting them?

with open(csvFileName, 'rb') as f_i:
    with gzip.open(gzipFileName, 'wb') as f_out:

@will-moore
Copy link
Member

@atarkowska
Copy link
Member Author

atarkowska commented Apr 21, 2017

PASS https://ci.openmicroscopy.org/job/OMERO-DEV-merge-integration-Python27/528/testReport/

FAILED: https://ci.openmicroscopy.org/job/OMERO-DEV-merge-integration-python/554/testReport/

test/integration/metadata/test_populate.py:991: in <module>
    class TestPopulateMetadata(TestPopulateMetadataHelper):
test/integration/metadata/test_populate.py:1000: in TestPopulateMetadata
    GZIP(),
test/integration/metadata/test_populate.py:648: in __init__
    colNames="Image Name,Type,Concentration",
test/integration/metadata/test_populate.py:765: in createCsv
    with gzip.open(gzipFileName, 'wb') as f_out:
E   AttributeError: GzipFile instance has no attribute '__exit__'

that test should be excluded


@mark.skipif(sys.version_info < (2, 7),
reason="requires python2.7")
class TestPopulateMetadata(TestPopulateMetadataHelper):
Copy link
Member Author

Choose a reason for hiding this comment

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

why that is not skipped?

Copy link
Member

Choose a reason for hiding this comment

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

Does it detect the error by static analysis without having to even run the test?

Copy link
Member

Choose a reason for hiding this comment

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

My reading of https://docs.pytest.org/en/latest/skipping.html#id1 is that the function (or class in that case) is initialized and then the abortion is testing when setting up the tests. Here, because there is some Python 2.7 specific bit in the static class variables, the class initialization fails before it has a chance to execute the skipping logic.

@joshmoore
Copy link
Member

re: skipping tests, @aleksandra-tarkowska, I would assume what's happening is:

  • createCsv is used in in __init__ of Fixture instances (link)
  • and Fixture subclasses are created statically (link)

i.e. your check doesn't have a chance to run.

@joshmoore
Copy link
Member

Thanks, @aleksandra-tarkowska! Great to have this making it back to the mainline. Merging for 5.3.2 after discussion with @jburel.

@joshmoore joshmoore merged commit dfa9f72 into ome:develop May 9, 2017
@joshmoore joshmoore deleted the rebased/develop/merge_populate branch May 9, 2017 13:39
@jburel jburel added this to the 5.3.2 milestone May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants