Skip to content
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

Swap PluginRunner with TaskRunner #1360

Merged
merged 4 commits into from Oct 3, 2023
Merged

Conversation

petebankhead
Copy link
Member

@petebankhead petebankhead commented Oct 3, 2023

Minor changes:

  • Use 'crop' rather than 'trim' with Tiler
    • Turn this setting off by default with PixelProcessor

Major change:

  • Convert PluginRunner to TaskRunner
  • Provide QPEx.createTaskRunner() and QPEx.createTaskRunner(int nThreads) methods

The reasoning is that PluginRunner no longer really makes sense as a name: the class rather represents a simple and generic way to run tasks in parallel. It's also more general than in previous QuPath releases.

The following script shows it in action:

def tasks = []
for (int i in 1..50) {
    int n = i
    tasks << () -> sleepyTask(n)
}

def runner = createTaskRunner()
runner.runTasks(tasks)

def sleepyTask(int n) {
    Thread.sleep(250L)
    println "I'm awake! And I'm task $n"
}

When run interactively, this should show a progress dialog (after a short delay). But when using Run for project it will switch to using a command line task runner, and not generate a new dialog of its own.

The number of threads can also be specified. For example, for single-threaded tasks we can use

def runner = createTaskRunner(1)

This is an easy way to provide a progress monitor for multiple tasks.

Also turn this setting off by default with `PixelProcessor`.
@petebankhead petebankhead added this to the v0.5.0 milestone Oct 3, 2023
Also add methods to create a `TaskRunner` to `QPEx`.
These were causing problems with the progress dialog getting stuck.
@petebankhead petebankhead merged commit 14b4e60 into qupath:main Oct 3, 2023
3 checks passed
@petebankhead petebankhead deleted the processing branch October 3, 2023 09:02
@petebankhead petebankhead changed the title Use 'crop' rather than 'trim' with Tiler Swap PluginRunner with TaskRunner Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant