Repository navigation
Progress Reporting Implementation - #43
Conversation
f2e15d4 to
e5db14b
Compare
|
Update: |
e5db14b to
3c769ed
Compare
|
Closes scijava/scijava#42 |
3c769ed to
a13f9b2
Compare
ba6315b to
10395e7
Compare
Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>
This allows a progress() check to return 0 instead of NaN
This allows the dependencies to update the progress of their parent Task This commit also fixes some expected answers within ProvenanceTest. Previously, these tests asserted that only the outside (mapper) function altered the output. But, in this case, the output was directly created by the mapped function. Thus there were really two Ops that directly altered the output. Now, the test reflects that.
Also, we no longer need to run the ops on separate threads since we are interrupting instead of polling
This commit also changes the name of the ProgressListener's functional method to acknowledgeUpdate, instead of updateProgress, as an update does not necessarily imply that the PROGRESS is being updated.
10395e7 to
11f50d2
Compare
ctrueden
left a comment
There was a problem hiding this comment.
I had a lot of problems trying to test and review this code from Eclipse. I cleaned up many of the problems and merged the work to main, then rebased this branch over it, but there will continue to be problems until #57 is merged due to Eclipse's failure surrounding annotation processing. Even with the EclipseHelper. I played with augmenting the Ruby script that merges main and test annotations, to make it also clean up after Eclipse, but couldn't make it work out of the box no matter what I tried. Even with building from the command line via mvn clean install followed by a refresh in Eclipse, the unit tests in Eclipse still are crazy and can't find plugins and a bunch of them fail. So I'm giving up: I'm just going to push through all these PRs as fast as I can until after #57. Then I hope it will become possible to develop this project in Eclipse without so much pain.
| if (!metadata.hints().contains(History.SKIP_RECORDING)) { | ||
| metadata.history().addExecution(this, output); | ||
| } | ||
| metadata.history().logOutput(this, output); |
There was a problem hiding this comment.
If you change this to metadata().history()..., this could be a default method of RichOp interface.
There was a problem hiding this comment.
Eh...by default I'd prefer to do nothing in RichOp. Do you strongly about this @ctrueden?
…ss-reporting-revisions Revisions to #43
This PR introduces a mechanism for Progress Reporting within the Ops framework. The core of this mechanism is the static
Progressclass, which is used both for Ops to broadcast updates to their progress and for users to be notified of updates to Ops' progress. TheProgressclass maintains a set ofTasks, describing all concurrently-executing processing hierarchies. Below details the (current) methods by which each party interfaces with theProgressclass:1: Ops Implementing Progress Reporting
Ops obtained via the matcher are automagically registered as
Tasks, recorded withinProgress. Therefore, in order to report numerical progress, Ops must:Progress.defineTotalProgress(int numStages, int numSubTasks)):a. A stage is defined as a section of Op processing done within the Op itself, and are customizable within the Op
b. A subtask is defined as a standalone task that will report its progress to this Op. Any Op dependency execution is automatically registered as a subtask.
Progress.setStageMax(long max)After this setup, the Op can report its progress by calling
Progress.update().Here is an example of how an Op might define progress:
Ops can also update their status, without any setup, using the method
Progress.setStatus(String status):2: The
ProgressListenerinterface as an interrupt mechanism for progress updatesProgress updates can trigger interrupt code via the
ProgressListenerinterface. This interface is aFunctionalInterface, with a functional methodacknowledgeUpdate(Task task)(allowing aProgressListenerto be defined as a lambda).ProgressListenerscan be registered using the methodProgress.addListener(Object progressible, ProgressListener p); an example of aProgressListenerinterrupt is shown below:During the op call, the lambda-defined
ProgressListenerwill function as a callback Object, with itsacknowledgeUpdate(Task task)functional method being called every time the Op callsProgress.update(). The methodTask.status()can also be called if the listener is interested in the status of the Op.