link-move icon indicating copy to clipboard operation
link-move copied to clipboard

Dry run mode in LM task

Open atomashpolskiy opened this issue 8 years ago • 6 comments

@andrus , please approve

atomashpolskiy avatar Apr 27 '17 12:04 atomashpolskiy

I guess I don't understand the point of "dryRun"

andrus avatar Apr 27 '17 12:04 andrus

Kind of "preview" mode, that lets you inspect the changes without committing them.

atomashpolskiy avatar Apr 27 '17 12:04 atomashpolskiy

If I understand correctly, the use case for this is to collect changes, and then handle them using custom code via a listener? I was hoping we can actually encapsulate @rzen 's case in a separate task that will not require a listener. Like "SoftDeleteTask"

andrus avatar Apr 27 '17 12:04 andrus

Yeah, but my point is that it's not necessarily the only use case in which "undoing" of changes might be required.

One particular example would be a two-step user approval:

  • task is executed, and changes are accumulated in Cayenne context; nothing is committed
  • user inspects the changes (simple stats or more thorough per-attribute inspection)
  • user approves, and the changes are committed into target With this PR, all that is required to implement such use case would be to capture the ObjectContext. Which might also be exposed in some non-listener API...

Another use case is testing the jobs without actually committing anything. And stage listeners can inspect Execution.isDryRun() in order to prevent sending notifications or doing some other stuff.

atomashpolskiy avatar Apr 27 '17 12:04 atomashpolskiy

In fact I'm not too strong on this one, so feel free to close if it seems to do more harm than good

atomashpolskiy avatar Apr 27 '17 12:04 atomashpolskiy

I think dry run is an interesting idea independent of my original request.

Even more useful if instead of in the code it could be enabled in extractor descriptor.

Something along the lines of:

 <config>
     <type>jdbc</type>
     <connectorId>connector</connectorId>
     <attributes>
     ...
     </attributes>
     <properties>
         <extractor.dryrun>true</extractor.dryrun>
         ...
     </properties>
 </config>

rzen avatar Apr 29 '17 04:04 rzen