Skip to content

Commit

Permalink
Fix argument usage
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidStirling committed Aug 2, 2024
1 parent 7164289 commit b589642
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion omero2pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _get_table(conn, object_type, object_id):

# Load the table
resources = conn.c.sf.sharedResources()
data_table = resources.openTable(orig_file, _ctx=conn.SERVICE_OPTS)
data_table = resources.openTable(orig_file, conn.SERVICE_OPTS)
conn.SERVICE_OPTS.setOmeroGroup(orig_group)
return data_table

Expand Down
17 changes: 8 additions & 9 deletions omero2pandas/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,13 @@ def create_table(source, table_name, parent_id, parent_type, conn, chunk_size,
iter_data = (source.iloc[i:i + chunk_size]
for i in range(0, len(source), chunk_size))

resources = conn.c.sf.sharedResources(_ctx={
"omero.group": str(parent_group)})
resources = conn.c.sf.sharedResources({"omero.group": str(parent_group)})
repository_id = resources.repositories().descriptions[0].getId().getValue()

table = None
try:
table = resources.newTable(repository_id, table_name, _ctx={
"omero.group": str(parent_group)})
table = resources.newTable(repository_id, table_name,
{"omero.group": str(parent_group)})
table.initialize(columns)
progress_monitor.reset(total=total_rows)
progress_monitor.set_description("Uploading table to OMERO")
Expand All @@ -210,7 +209,7 @@ def create_table(source, table_name, parent_id, parent_type, conn, chunk_size,
chunk.loc[:, str_cols] = chunk.loc[:, str_cols].fillna('')
for omero_column, (name, col_data) in zip(columns, chunk.items()):
if omero_column.name != name:
LOGGER.debug("Matching", omero_column.name, name)
LOGGER.debug(f"Matching {omero_column.name} -> {name}")
omero_column.values = col_data.tolist()
table.addData(columns)
progress_monitor.update(len(chunk))
Expand All @@ -229,7 +228,7 @@ def create_table(source, table_name, parent_id, parent_type, conn, chunk_size,

link_obj.link(target_obj, annotation)
link_obj = conn.getUpdateService().saveAndReturnObject(
link_obj, _ctx={"omero.group": str(parent_group)})
link_obj, {"omero.group": str(parent_group)})
annotation_id = link_obj.child.id.val
LOGGER.info(f"Uploaded as FileAnnotation {annotation_id}")
extra_link_objs = []
Expand All @@ -243,10 +242,10 @@ def create_table(source, table_name, parent_id, parent_type, conn, chunk_size,
if extra_link_objs:
try:
conn.getUpdateService().saveArray(
extra_link_objs, _ctx={"omero.group": str(parent_group)})
extra_link_objs, {"omero.group": str(parent_group)})
LOGGER.info(f"Added links to {len(extra_link_objs)} objects")
except Exception as e:
LOGGER.error("Failed to create extra links", exc_info=e)
except Exception:
LOGGER.error("Failed to create extra links", exc_info=True)
LOGGER.info(f"Finished creating table {table_name} under "
f"{parent_type} {parent_id}")
return annotation_id
Expand Down

0 comments on commit b589642

Please sign in to comment.