Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #5166 (closed)

Opened 13 years ago

Closed 9 years ago

RFE:Delete comment should use Delete2

Reported by: atarkowska Owned by: wmoore
Priority: major Milestone: 5.1.2
Component: OmeroPy Version: 5.1.0
Keywords: n.a. Cc: jamoore, atarkowska, jburel, wmoore, mtbcarroll
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: n.a.
Sprint: n.a.

Description (last modified by wmoore)

When we remove a Comment from P/D/I, we also have to check if it's linked to anything else, and if not then delete it.

Try using Delete2 instead.

Mark:
"I /think/ if you give a child option with excludeType as the list of all the link types (ImageAnnotationLink?, etc.) then I think it will fail if there is such a link.

http://www.openmicroscopy.org/site/support/omero5.1/developers/Server/GraphsMigration.html#examples-in-python
where we have,
keepAnn = [ChildOption?(excludeType=Annotation?)]
make that a list of ImageAnnotationLink? and all the other link types
"

Change History (24)

comment:1 Changed 13 years ago by atarkowska

  • Cc jmoore wmoore added
  • Summary changed from Delete comment can't use IDelete to BUG: Delete comment can't use IDelete

comment:2 Changed 13 years ago by atarkowska

  • Cc atarkowska added; wmoore removed
  • Owner changed from atarkowska to wmoore

comment:3 Changed 13 years ago by atarkowska

Deleting command could also handle removing links while comment is linked to more then one objects

comment:4 Changed 13 years ago by jmoore

  • Cc jburel added

Ola, do we need to add an RFE for the delete service, or is this a bug in your opinion?

comment:5 Changed 13 years ago by atarkowska

Certainly, it would be easier to use server side method specific for that usecase. Currently what was fixed this by using 'remove' method implemented on the client side, see #5325. As Josh suggested, I will link it to API evolution #2656

comment:6 Changed 13 years ago by atarkowska

  • Component changed from General to OmeroPy
  • Milestone changed from OMERO-Beta4.3 to OMERO-Beta4.3.1
  • Sprint 2011-06-02 (13) deleted

comment:7 Changed 13 years ago by atarkowska

  • Remaining Time 0.25 deleted

comment:8 Changed 13 years ago by atarkowska

  • Cc wmoore added
  • Owner wmoore deleted

comment:9 Changed 13 years ago by jmoore

Is there anything someone needs from me for this?

comment:10 Changed 13 years ago by atarkowska

  • Milestone changed from OMERO-Beta4.3.1 to OMERO-Beta4.3.2
  • Priority changed from minor to major
  • Sprint 2011-07-07 (1) deleted
  • Summary changed from BUG: Delete comment can't use IDelete to RFE:Delete comment can't use IDelete

The logic is already implemented in the python gateway. Would be good idea to push it to the server in order to serve the same functionality across both clients.

comment:11 Changed 13 years ago by jburel

  • Milestone changed from OMERO-Beta4.3.2 to Unscheduled

comment:12 Changed 9 years ago by jamoore

  • Milestone changed from Unscheduled to 5.1.1
  • Version set to 5.1.0

Again, IDelete is now gone. See e.g. https://github.com/openmicroscopy/openmicroscopy/pull/3729

Is there any further cleanup to be done in the gateway?

comment:13 Changed 9 years ago by mtbcarroll

  • Cc mtbcarroll added

With luck, Delete2 on the comment now addresses the motivating performance issue.

comment:14 Changed 9 years ago by jamoore

  • Owner set to wmoore

This needs some discussion with Mark to know if all the hacks are now redundant.

comment:15 Changed 9 years ago by mtbcarroll

(Also perhaps with Colin.)

comment:16 Changed 9 years ago by wmoore

  • Milestone changed from 5.1.1 to 5.1.2

Since other Delete work is getting pushed to 5.1.2 https://github.com/openmicroscopy/openmicroscopy/pull/3725 makes sense to do same for this.

comment:17 Changed 9 years ago by wmoore

  • Description modified (diff)
  • Summary changed from RFE:Delete comment can't use IDelete to RFE:Delete comment should use Delete2

comment:18 Changed 9 years ago by wmoore

Alternative is to use regular Delete2 command to delete the Comment with dryRun=True and see if the response lists any other comment annotation links.
Mark:
"easiest just to do a normal Delete2 where you set dryRun=True and target a CommentAnnotation? that is still linked to something and have a look at the response -- that should make the rest obvious"

comment:19 Changed 9 years ago by mtbcarroll

Josh gives me the idea that it might work to simply have

excludeType=['IAnnotationLink']

it's worth a try. (I could test it myself next week if you like.)

Last edited 9 years ago by mtbcarroll (previous) (diff)

comment:20 Changed 9 years ago by mtbcarroll

It doesn't work, for tricky reasons that aren't easy to adjust. I suggest going the dryRun=True route for now and checking the response for any links.

comment:21 Changed 9 years ago by mtbcarroll

(excludeType doesn't work because, as the http://downloads.openmicroscopy.org/omero/5.1.0/api/slice2html/omero/cmd/graphs/ChildOption.html documentation reminds me, these options are about how to treat children; while it makes sense to talk about orphan images or orphan annotations because ILink.child takes them as values, the links themselves aren't usually themselves considered as being children.)

Last edited 9 years ago by mtbcarroll (previous) (diff)

comment:22 Changed 9 years ago by wmoore

Tried using
keepAnn = [ChildOption(excludeType=['ImageAnnotationLink'])]
but this doesn't seem to prevent deletion of the Comment itself.
I guess that's because Image isn't a child of Comment?

This test fails, since Comment is deleted.

    def testDeleteComment(self):
        comment = omero.model.CommentAnnotationI()
        comment = self.update.saveAndReturnObject(comment)
        images = list()
        for i in range(0, 3):
            img = self.new_image(name="testDeleteComment")
            img.linkAnnotation(comment)
            images.append(self.update.saveAndReturnObject(img))

        assert self.query.find("CommentAnnotation", comment.id.val)

        keepAnn = [ChildOption(excludeType=['ImageAnnotationLink'])]
        command = Delete2(targetObjects={"CommentAnnotation": [comment.id.val]}, childOptions=keepAnn)

        handle = self.client.sf.submit(command)
        self.waitOnCmd(self.client, handle)

        assert self.query.find("CommentAnnotation", comment.id.val)

comment:23 Changed 9 years ago by wmoore

Oops - sorry, missed your comments above!
Trying dryRun=True now.

comment:24 Changed 9 years ago by wmoore

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.72407 sec.)

We're Hiring!