question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[WIP] Explore ways to make napari-animation work with async prototype

See original GitHub issue

This task is motivated by a comment in the NAP’s first PR.

The napari-animation plugin is an example of a plugin that relies on the mutation of Dims.current_step being synchronous (both with an active viewer and headless). There are likely others too, but it should serve as a good example that we know is well used.

Here are some possible solutions/ideas, but others likely exist.

  • Define new async entry points in the API and leave the existing sync ones alone (e.g. Dims.set_current_step_async).
  • Define a context manager that forces synchronous (or maybe asynchronous?) slicing.
  • Define functions like LayerSlicer.waitUntilIdle to wait for any pending slicing tasks to be done.

The output of this task should describe a solution with working prototype code. We should probably cover the examples in the napari-animation repo. We should incorporate the description into the NAP to address the questions and feedback in the original comment and replies.

Edit: Initial text comes from @andy-sweet. Github didn’t seem to track the attribution.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:30 (30 by maintainers)

github_iconTop GitHub Comments

1reaction
alisterburtcommented, Aug 25, 2022

loving watching this from afar @kephale and @andy-sweet !

Define a context manager that forces synchronous (or maybe asynchronous?) slicing.

I think I like this option the most 😃

0reactions
kephalecommented, Sep 8, 2022

Great. I’m happy to close this one now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Override function prototype with async method, keeping this ...
Option 1 (Not executed in order): Person.prototype.asyncFunction1 = function () { someApiCall() .then((e) => console.log(e)) .catch() return ...
Read more >
animation with canvas becomes grayscale due to screenshot ...
I noticed that for some image sequences (especially large images) the animation grayes out when using the "with Canvas" capture mode on the ......
Read more >
async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ...
Read more >
Exploring Async/Await Functions in JavaScript - DigitalOcean
In this post we're quickly going over the ins and outs of async/await functions; introduced with ES2017 to help write synchronous-looking ...
Read more >
async - C# Reference - Microsoft Learn
An async method runs synchronously until it reaches its first await expression, at which point the method is suspended until the awaited task...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found