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

Add hic aborting and fix remoteAbort signal propagation #1783

Merged
merged 6 commits into from
Mar 12, 2021

Conversation

cmdcolin
Copy link
Collaborator

This fixes a bug in the remoteAbort call where the signalId was not being passed at all (it was calling {...1} which is just {}, the signal wasn't given a name on the object)

Then it adds a couple points in the hic code where it checks the abort signal, using a timeout to yield to the webworker to process the abortsignal RPC calls

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Mar 10, 2021
@codecov
Copy link

codecov bot commented Mar 10, 2021

Codecov Report

Merging #1783 (5409f2f) into master (afdd9e4) will decrease coverage by 0.02%.
The diff coverage is 6.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1783      +/-   ##
==========================================
- Coverage   58.66%   58.63%   -0.03%     
==========================================
  Files         457      457              
  Lines       21193    21206      +13     
  Branches     5016     5017       +1     
==========================================
+ Hits        12432    12434       +2     
- Misses       8451     8462      +11     
  Partials      310      310              
Impacted Files Coverage Δ
packages/core/rpc/remoteAbortSignals.ts 78.78% <0.00%> (-5.09%) ⬇️
packages/core/util/aborting.ts 64.00% <0.00%> (-16.00%) ⬇️
plugins/hic/src/HicRenderer/HicRenderer.ts 0.00% <0.00%> (ø)
packages/core/rpc/BaseRpcDriver.ts 93.75% <100.00%> (ø)
...inearGenomeView/components/RefNameAutocomplete.tsx 93.61% <0.00%> (+4.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afdd9e4...5409f2f. Read the comment docs.

@cmdcolin cmdcolin added bug Something isn't working and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) labels Mar 10, 2021
@cmdcolin cmdcolin requested a review from teresam856 March 10, 2021 05:14
@cmdcolin cmdcolin marked this pull request as draft March 10, 2021 16:22
@cmdcolin
Copy link
Collaborator Author

This may have introduced side effect seen here #1785

Copy link
Contributor

@teresam856 teresam856 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Copy link
Contributor

@teresam856 teresam856 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cmdcolin
Copy link
Collaborator Author

Note that the effect seen in #1785 is visible even if the globalRangeCache is disabled with

diff --git a/packages/core/util/io/rangeFetcher.ts b/packages/core/util/io/rangeFetcher.ts
index f85479f13..9f08e4a03 100644
--- a/packages/core/util/io/rangeFetcher.ts
+++ b/packages/core/util/io/rangeFetcher.ts
@@ -118,7 +118,5 @@ export function clearCache() {
 }

 export function openUrl(url: string): GenericFilehandle {
-  return new RemoteFile(String(url), {
-    fetch: globalCacheFetch,
-  })
+  return new RemoteFile(String(url))
 }

@cmdcolin
Copy link
Collaborator Author

Probably we need to look at AbortablePromiseCache, BAI uses it as an "abortable memoize" and something might be causing it to get purged

@cmdcolin
Copy link
Collaborator Author

This PR is probably good to go but GMOD/abortable-promise-cache#12 should get bumped also

@cmdcolin cmdcolin marked this pull request as ready for review March 11, 2021 00:29
@@ -89,6 +94,11 @@ export default class HicRenderer extends ServerSideRendererType {
baseColor,
])
ctx.fillRect((bin1 - offset) * w, (bin2 - offset) * w, w, w)
if (+Date.now() - start > 400) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the date is being used to count for the timeout?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, the idea is to check every 400ms for whether an abort has arrived. The hic track can on take up to 5s to do a complete render so it intermittently checks to see if it should cancel

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the real trickyness was making sure the abort signal was passed through to the backend. I'm not sure if I have added enough tests to ensure this works but there are a couple added in the BaseRpcDriver...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha. Now the abort signal is getting passed as a prop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, actually every renderer will get a signal prop it just depends on whether they use it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be valuable to use the lessons from this PR to spread it throughout the codebase

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I see.

@cmdcolin
Copy link
Collaborator Author

@rbuels any thoughts on this? would be good to merge with the abortable-promise-cache PR(s) too

@cmdcolin
Copy link
Collaborator Author

there could be more advanced tests because this technically does not test remote abort but I wasn't sure how to instrument that yet

@cmdcolin cmdcolin merged commit 17f6e6e into master Mar 12, 2021
@cmdcolin cmdcolin deleted the add_hic_aborting branch March 13, 2021 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants