-
Notifications
You must be signed in to change notification settings - Fork 16
Fix parade prep notes #89
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
cd8fdb7
c135682
d2dbbb3
2821608
099441f
9f10274
b03205c
9632c0d
a74b87a
90b5c88
41d9d04
770095e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
|
|
||
| import argparse | ||
| import omero | ||
| from omero.cli import cli_login | ||
| from omero.rtypes import rstring | ||
| import omero.grid | ||
| from omero.gateway import BlitzGateway | ||
|
|
@@ -29,11 +30,8 @@ | |
| NAMESPACE = "openmicroscopy.org/omero/bulk_annotations" | ||
|
|
||
|
|
||
| def run(username, password, plate_id, host, port): | ||
| def run(conn, plate_id): | ||
|
|
||
| conn = BlitzGateway(username, password, host=host, port=port) | ||
| try: | ||
| conn.connect() | ||
| query_service = conn.getQueryService() | ||
|
|
||
| # Create a name for the Original File | ||
|
|
@@ -94,10 +92,10 @@ def run(username, password, plate_id, host, port): | |
|
|
||
| print("Adding data: ", len(data)) | ||
| table.addData(data) | ||
| table.close() | ||
|
|
||
| print("table closed...") | ||
| orig_file = table.getOriginalFile() | ||
| table.close() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so the table could now never be closed if an error is thrown during the save step below
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was also possible before that it didn't get closed if an exception was thrown between table creation and closing.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 9632c0d |
||
| fileAnn = omero.model.FileAnnotationI() | ||
| fileAnn.ns = rstring(NAMESPACE) | ||
| fileAnn.setFile(omero.model.OriginalFileI(orig_file.id.val, False)) | ||
|
|
@@ -109,22 +107,14 @@ def run(username, password, plate_id, host, port): | |
| print("save link...") | ||
| conn.getUpdateService().saveAndReturnObject(link) | ||
|
|
||
| except Exception as exc: | ||
| print("Error while changing names: %s" % str(exc)) | ||
| finally: | ||
| conn.close() | ||
|
|
||
|
|
||
| def main(args): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('username') | ||
| parser.add_argument('password') | ||
| parser.add_argument('plate_id') | ||
| parser.add_argument('--server', default="workshop.openmicroscopy.org", | ||
| help="OMERO server hostname") | ||
| parser.add_argument('--port', default=4064, help="OMERO server port") | ||
| args = parser.parse_args(args) | ||
| run(args.username, args.password, args.plate_id, args.server, args.port) | ||
| with cli_login() as cli: | ||
| conn = BlitzGateway(client_obj=cli._client) | ||
| run(conn, args.plate_id) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.