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

Screenshot #136

Open
astrovsky01 opened this issue Jun 8, 2020 · 10 comments
Open

Screenshot #136

astrovsky01 opened this issue Jun 8, 2020 · 10 comments

Comments

@astrovsky01
Copy link

I have been trying, and failing to figure out where this is used in either the website or on a running instance.

async def screenshot(

I want to use the same python method of screenshots, since the js one from hglib.js won't allow files to be generated outside of the downloads folder for security reasons.

Could you please point me in the right direction?

Thanks!

@pkerpedjiev
Copy link
Member

If you go to higlass.io/app, click on the view config menu (the little cog wheel in the grey header), and select export as link, you'll get a link that looks like the following: http://higlass.io/l/?d=cgs4_5zYQR-hOM4s2SixMw

This link is resolved in the server to a redirect page which contains some metadata for showing a thumbnail when pasted in Slack or Twitter. You can see this in action by running:

curl http://higlass.io/l/?d=cgs4_5zYQR-hOM4s2SixMw

Buried within all the metadata of the returned page is line that looks like this:

<meta property="og:image" content="http://higlass.io/thumbnail/?d=cgs4_5zYQR-hOM4s2SixMw"/>

The link there will call the thumbnail method in higlass-server/website/view.py which will spin up a chrome instance on the back end, load the page, snap a screenshot and return it. You can see the output yourself by visiting http://higlass.io/thumbnail/?d=cgs4_5zYQR-hOM4s2SixMw

The rendering is a little messed up due to the WebGL drivers on the instance we're using to host higlass.io but you can, in principle see what is happening.

So in short, that method is used to generate a screenshot of higlass loading a viewconf with the uuid specified in the url http://higlass.io/thumbnail/?d=

Does that help?

@astrovsky01
Copy link
Author

astrovsky01 commented Jun 18, 2020

Any idea why uploaded data would act any differently in that thumbnail call than the data present on startup? I'm able to get the image properly, but any from data I upload create a screenshot with either a blank where there heatmap should be (it is visible in the app), or just shows the world "loading", while the startup data works fine

@astrovsky01
Copy link
Author

ping @pkerpedjiev

@pkerpedjiev
Copy link
Member

How are you calling thethumbnail endpoint?

You have to have entire higlass stack (server and webpage) running for it to work. You can see which URL the thumbnail endpoint calls here:

base_url = f'{request.scheme}://localhost/app/'

@astrovsky01
Copy link
Author

I'm running this via higlass docker, and calling the endpoint by adding an http request to your export views as link. I'm getting the image itself, but the actual viewport is rendering incorrectly:
Galaxy285- higlass_image png
That is the image returned, even though the actual view looks like this:
Screen Shot 2020-06-18 at 2 34 58 PM
Occasionally, the image will say "Loading..." in the top right, even though the data is still visible on the actual webpage. This also only happens with manually uploaded data, and regardless of the datatype

@pkerpedjiev
Copy link
Member

Hmm, that is strange. How many workers are you running the Docker with?

One potential reason for this occurring is that you're issuing one request to for the thumbnail and this occupies the server so that your data requests can't get through until something times out.

Maybe try building the Docker container with ./build.sh -w 4?

@astrovsky01
Copy link
Author

astrovsky01 commented Jun 22, 2020

4, and I'm pulling the image and starting it from dockerhub (new version, not your original one), not building the new image locally each time

@astrovsky01
Copy link
Author

For clarification, the only real edits made on the new version are a different unpkg file for the interface, and the modification of that view button

@astrovsky01
Copy link
Author

Rebuilding with -w 4 created the same image as above, with a blank viewport

@pkerpedjiev
Copy link
Member

Ohhhh, I just tried this locally and it didn't work either. It's because the exportViewUrl parameter in the default viewconf points to higlass.io. So when it's trying to create the thumbnail it hits something like http://higlass.io/thumbnail/?d=HNnh9zxgSz68cejCK4avCw. And higlass.io doesn't have access to your data.

You can try replacing exportViewUrl with your local url (e.g. http://localhost:8989/api/v1/viewconfs) and see if that helps but unfortunately for me it ran without returning and I'm a bit at a loss for why that is. I have a few other high priority issues to finish but if that doesn't work for you I can poke around further.

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

No branches or pull requests

2 participants