You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/06/14 07:33:07 UTC

[GitHub] [superset] pritypriya25 opened a new issue #15118: How to compute and cache a screenshot using rest api in superset

pritypriya25 opened a new issue #15118:
URL: https://github.com/apache/superset/issues/15118


   I want to get the chart by hitting the API. I read the documentation and found that I can do this by /chart/{pk}/cache_screenshot/
   But I am unable to know what is the value of pk over here. It is an integer value and provides a path but I am unable to get the value. Can someone guide me on how can I get the value?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] YangJianFei commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
YangJianFei commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-903660105


   @pritypriya25 ,I want know , how to use access_token? can Screenshot?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 closed issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 closed issue #15118:
URL: https://github.com/apache/superset/issues/15118


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-917334166


   @Hvitgar.. Thanks for the solution. It's working for me. Now I am getting the screenshot and image URL. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910186029


   Solving this requires multiple steps. First, you have to adjust several values in your `superset_config.py`:
   Enable
   ```bash
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-860149356


   Hi, @pritypriya25 , the PK is chart id(aka slice id), you can get this `id`(PK) from the chart list.
   1. clicking `Charts` then hover on the chart that you want to compute.
   2. recording the number between "%3A" and "%7d".
   3. filling the number to the API .
   
   <img width="1383" alt="image" src="https://user-images.githubusercontent.com/2016594/121795285-edd48300-cc41-11eb-8bb1-6a998a106394.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-860698820


   thank you @zhaoyongjie . Now I know what is the slice id. But still I can't get my output for from hitting the api chart/{pk}/cache_screenshot. 
      
   ![screenshot](https://user-images.githubusercontent.com/85749375/121902663-27da7d80-cd45-11eb-853b-c310f4c60f5b.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-914184988


   hey @isandyawan, I assume that your error is related to this line in the superset_config.py:
   ```python
   WEBDRIVER_BASEURL = "http://localhost:8088"  # or whatever URL your superset instance is running on, the webdriver will use this URL to connect to superset in order to take a screenshot
   ```
   For taking the screenshot, a browser session accesses the URL above, renders the chart and than produces a screenshot so you have to make sure that superset is accessible on the URL above (it might be a DNS name or IP if hosted publicly, or localhost if on your machine). Also, make sure that the port is correct. Superset offers a health check under `/health` which returns 'OK' if successful, so you can check your configuration with `curl <URL>:<PORT>/health`, in my example using `curl localhost:8088/health` returns 'OK'.
   
   If you are still not able to solve it, please give me more information about the way you are running superset. Are you using docker? Local installation? Cloud?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] isandyawan edited a comment on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
isandyawan edited a comment on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-913485549


   Thank you @Hvitgar for your solution, i have implement it, but when i access screenshot url return 404 not found. Below is log from superset worker:
   `superset_worker          | [2021-09-06 09:08:54,659: WARNING/ForkPoolWorker-1] Failed at generating thumbnail Message: Reached error page: about:neterror?e=dnsNotFound&u=http%3A//l27.0.0.1%3A8088/login/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20l27.0.0.1.
   superset_worker          | Traceback (most recent call last):
   superset_worker          |   File "/app/superset/utils/screenshots.py", line 152, in compute_and_cache
   superset_worker          |     payload = self.get_screenshot(user=user, window_size=window_size)
   superset_worker          |   File "/app/superset/utils/screenshots.py", line 74, in get_screenshot
   superset_worker          |     self.screenshot = driver.get_screenshot(self.url, self.element, user)
   superset_worker          |   File "/app/superset/utils/webdriver.py", line 112, in get_screenshot
   superset_worker          |     driver = self.auth(user)
   superset_worker          |   File "/app/superset/utils/webdriver.py", line 87, in auth
   superset_worker          |     driver, user
   superset_worker          |   File "/app/superset/utils/machine_auth.py", line 53, in authenticate_webdriver
   superset_worker          |     driver.get(headless_url("/login/"))
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
   superset_worker          |     self.execute(Command.GET, {'url': url})
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   superset_worker          |     self.error_handler.check_response(response)
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   superset_worker          |     raise exception_class(message, screen, stacktrace)
   superset_worker          | selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=dnsNotFound&u=http%3A//l27.0.0.1%3A8088/login/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20l27.0.0.1.
   `
   I also try to test webdriver from superset container and i got it :
   
   
   `>>> webdriver Firefox ()
   
   Traceback (most recent call last):
   
   File "<stdin>", line 1, in module>
   
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
   
   keep_alive=True)
   
   self.start_session (capabilities, browser profile)
   
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW SESSION, parameters)
   
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   
   self.error handler.check_response (response) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   
   raise exception class (message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Connection refused (os error 111)
   `
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar edited a comment on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar edited a comment on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910373141


   the file is not in the repository, but you can simply create it yourself and put it in your PYTHONPATH environment variable as described [here](https://superset.apache.org/docs/installation/configuring-superset). This way, you will override the defaults provided [here](https://github.com/apache/superset/blob/master/superset/config.py)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] isandyawan edited a comment on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
isandyawan edited a comment on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-913485549


   Thank you @Hvitgar for your solution, i have implement it, but when i access screenshot url return 404 not found. Below is log from superset worker:
   `superset_worker          | [2021-09-06 09:08:54,659: WARNING/ForkPoolWorker-1] Failed at generating thumbnail Message: Reached error page: about:neterror?e=dnsNotFound&u=http%3A//l27.0.0.1%3A8088/login/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20l27.0.0.1.
   superset_worker          | Traceback (most recent call last):
   superset_worker          |   File "/app/superset/utils/screenshots.py", line 152, in compute_and_cache
   superset_worker          |     payload = self.get_screenshot(user=user, window_size=window_size)
   superset_worker          |   File "/app/superset/utils/screenshots.py", line 74, in get_screenshot
   superset_worker          |     self.screenshot = driver.get_screenshot(self.url, self.element, user)
   superset_worker          |   File "/app/superset/utils/webdriver.py", line 112, in get_screenshot
   superset_worker          |     driver = self.auth(user)
   superset_worker          |   File "/app/superset/utils/webdriver.py", line 87, in auth
   superset_worker          |     driver, user
   superset_worker          |   File "/app/superset/utils/machine_auth.py", line 53, in authenticate_webdriver
   superset_worker          |     driver.get(headless_url("/login/"))
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
   superset_worker          |     self.execute(Command.GET, {'url': url})
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   superset_worker          |     self.error_handler.check_response(response)
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   superset_worker          |     raise exception_class(message, screen, stacktrace)
   superset_worker          | selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=dnsNotFound&u=http%3A//l27.0.0.1%3A8088/login/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20l27.0.0.1.
   `
   I also try to test webdriver from superset container and i got it :
   
   
   `
   >>> webdriver Firefox ()
   Traceback (most recent call last):
   File "<stdin>", line 1, in module>
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
   keep_alive=True)
   self.start_session (capabilities, browser profile)
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW SESSION, parameters)
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   self.error handler.check_response (response) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   raise exception class (message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Connection refused (os error 111)
   `
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910373141


   the file is not in the repository, but you can simply create it yourself and put it in your PYTHONPATH environment variable as described [here](https://superset.apache.org/docs/installation/configuring-superset)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910319769


   @Hvitgar .. Thanks for providing the solution. Actually I am cloning the git repo and running the superset. Could you please provide the file path even because I can't find the file in the repository ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar removed a comment on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar removed a comment on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910186029


   Solving this requires multiple steps. First, you have to adjust several values in your `superset_config.py`:
   Enable
   ```bash
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] isandyawan commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
isandyawan commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910017651


   Hi, have you get a solution? i face same issue...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] isandyawan commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
isandyawan commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-914889227


   > hey @isandyawan, I assume that your error is related to this line in the superset_config.py:
   > 
   > ```python
   > WEBDRIVER_BASEURL = "http://localhost:8088"  # or whatever URL your superset instance is running on, the webdriver will use this URL to connect to superset in order to take a screenshot
   > ```
   > 
   > For taking the screenshot, a browser session accesses the URL above, renders the chart and than produces a screenshot so you have to make sure that superset is accessible on the URL above (it might be a DNS name or IP if hosted publicly, or localhost if on your machine). Also, make sure that the port is correct. Superset offers a health check under `/health` which returns 'OK' if successful, so you can check your configuration with `curl <URL>:<PORT>/health`, in my example using `curl localhost:8088/health` returns 'OK'.
   > 
   > If you are still not able to solve it, please give me more information about the way you are running superset. Are you using docker? Local installation? Cloud?
   
   Hi @Hvitgar , thanks for your answer, i was try to change WEBDRIVER_BASEURL with IP but it cannot work too. I also check using 'curl localhost:8088/health ' and it return 'OK'. I using docker to running superset


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] isandyawan commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
isandyawan commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910017651


   Hi, have you get a solution? i face same issue...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-906429362


   @YangJianFei  you can generate the token through POST api/v1/security​/login. You can find out the request body on the official superset website https://superset.apache.org/docs/rest-api 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 edited a comment on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 edited a comment on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-860698820


   thank you @zhaoyongjie . Now I know what is the slice id. But still I can't get my output from hitting the api chart/{pk}/cache_screenshot. 
      
   ![screenshot](https://user-images.githubusercontent.com/85749375/121902663-27da7d80-cd45-11eb-853b-c310f4c60f5b.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-917238532


   did you do the curl inside your container?If not, please try again from the container as the port inside the container might be different to the one you are using on the system running the container


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-915930761


   @Hvitgar @YangJianFei 
   
   I am adding the following lines in my superset_config.py file.
   
   
   DATA_CACHE_CONFIG = {
   
       'CACHE_TYPE': 'redis',
   
       'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, #1-day default (in secs)
   
       'CACHE_KEY_PREFIX': 'superset_results',
   
       'CACHE_REDIS_URL': 'redis://localhost:6379/0',
   
   }
   
    
   
    
   
   CELERYBEAT_SCHEDULE = {
   
       'cache-warmup-hourly': {
   
           'task': 'cache-warmup',
   
           'schedule': crontab(minute=0, hour='*'),  # hourly
   
           'kwargs': {
   
               'strategy_name': 'top_n_dashboards',
   
               'top_n': 5,
   
               'since': '7 days ago',
   
           },
   
       },
   
   }
   
    
   
   FEATURE_FLAGS = {
   
       "THUMBNAILS": True,
   
       "THUMBNAILS_SQLA_LISTENERS": True,
   
   }
   
    
   
   
   I am now getting the result from hitting the API but the status code is 202 and when I hit the URL given in response then I am not getting any result of the image. Please help me with what else I need to add to my default configured file for getting the image on hitting the image URL. 
   ![Screenshot (27)](https://user-images.githubusercontent.com/85749375/132663126-a3c568db-d79d-4b83-81a1-b6e936810df0.png)
   
   
    
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Hvitgar commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
Hvitgar commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-910199827


   Solving this requires multiple steps. First, you have to adjust several values in your superset_config.py:
   Enable the following feature flags if you want to see thumbnails for your dashboards:
   ```python
   FEATURE_FLAGS = {
       "THUMBNAILS": True,
       "THUMBNAILS_SQLA_LISTENERS": True,
   }
   ```
   provide valid cache configs for `CACHE_CONFIG`, `DATA_CACHE_CONFIG` and `THUMBNAIL_CACHE_CONFIG`, for testing purpose a local FileSystemCache is sufficient:
   ```python
   CACHE_CONFIG = {
       'CACHE_TYPE': 'FileSystemCache',
       'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24,
       'CACHE_THRESHOLD': CACHE_THRESHOLD,  # integer, limit of items in the cache
       'CACHE_DIR': BASE_CACHE_DIR,  # the directory where the cache should be stored
   }
   ```
   additionally, configure the `RESULTS_BACKEND` (once again, for testing FileSystemCache is sufficient):
   ```python
   from cachelib.file import FileSystemCache
   import os
   
   RESULTS_BACKEND = FileSystemCache(
                       cache_dir=os.path.join(BASE_CACHE_DIR, 'results/'),
                       threshold=CACHE_THRESHOLD,
                       default_timeout=CACHE_DEFAULT_TIMEOUT
                       )
   ```
   Next, you need to provide a celery config (the one below is copied from the [official superset documentation](https://superset.apache.org/docs/installation/async-queries-celery) without any modifications):
   
   ```python
   class CeleryConfig(object):
       BROKER_URL = 'redis://localhost:6379/0'
       CELERY_IMPORTS = (
           'superset.sql_lab',
           'superset.tasks',
           'superset.tasks.thumbnails'
       )
       CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
       CELERYD_LOG_LEVEL = 'DEBUG'
       CELERYD_PREFETCH_MULTIPLIER = 10
       CELERY_ACKS_LATE = True
       CELERY_ANNOTATIONS = {
           'sql_lab.get_sql_results': {
               'rate_limit': '100/s',
           },
           'email_reports.send': {
               'rate_limit': '1/s',
               'time_limit': 120,
               'soft_time_limit': 150,
               'ignore_result': True,
           },
       }
   CELERY_CONFIG = CeleryConfig
   ```
   last steps in the `superset_config.py`:
   ```python
   WEBDRIVER_TYPE = "firefox"
   WEBDRIVER_BASEURL = "http://localhost:8088"  # or whatever URL your superset instance is running on, the webdriver will use this URL to connect to superset in order to take a screenshot
   THUMBNAIL_SELENIUM_USER = "admin"  # any user with permissions to view all charts is sufficient
   ```
   
   now, in your superset environment, make sure you have a redis server running and listening on port 6379 (otherwise, adjust the redis port in the settings above).  Also, you will need firefox and geckodriver.
   
   Make sure that your redis server can write data to the disk by connecting to it via `redis-cli` and running the following two commands:
   ```bash
   CONFIG SET dir /app/superset_home/redis  # where the database will be stored, the directory must exist
   CONFIG SET dbfilename redis.rdb  # or any other filename
   ```
   
   Start celery using `celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4`
   
   Now, you should be able to take screenshots and see thumbnails of your dashboards
   
   Note: I am not sure whether all settings are actually needed, this is just the setup that worked for me. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] isandyawan commented on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
isandyawan commented on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-913485549


   Thank you @Hvitgar for your solution, i have implement it, but when i access screenshot url return 404 not found. Below is log from superset worker:
   `superset_worker          | [2021-09-06 09:08:54,659: WARNING/ForkPoolWorker-1] Failed at generating thumbnail Message: Reached error page: about:neterror?e=dnsNotFound&u=http%3A//l27.0.0.1%3A8088/login/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20l27.0.0.1.
   superset_worker          | Traceback (most recent call last):
   superset_worker          |   File "/app/superset/utils/screenshots.py", line 152, in compute_and_cache
   superset_worker          |     payload = self.get_screenshot(user=user, window_size=window_size)
   superset_worker          |   File "/app/superset/utils/screenshots.py", line 74, in get_screenshot
   superset_worker          |     self.screenshot = driver.get_screenshot(self.url, self.element, user)
   superset_worker          |   File "/app/superset/utils/webdriver.py", line 112, in get_screenshot
   superset_worker          |     driver = self.auth(user)
   superset_worker          |   File "/app/superset/utils/webdriver.py", line 87, in auth
   superset_worker          |     driver, user
   superset_worker          |   File "/app/superset/utils/machine_auth.py", line 53, in authenticate_webdriver
   superset_worker          |     driver.get(headless_url("/login/"))
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
   superset_worker          |     self.execute(Command.GET, {'url': url})
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   superset_worker          |     self.error_handler.check_response(response)
   superset_worker          |   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   superset_worker          |     raise exception_class(message, screen, stacktrace)
   superset_worker          | selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=dnsNotFound&u=http%3A//l27.0.0.1%3A8088/login/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20l27.0.0.1.
   `
   I also try to test webdriver from superset container and i got it :
   
   
   `>>> webdriver Firefox ()
   
   Traceback (most recent call last):
   
   File "<stdin>", line 1, in module>
   
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
   
   keep_alive=True)
   
   self.start_session (capabilities, browser profile)
   
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW SESSION, parameters)
   
   File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   
   self.error handler.check_response (response) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
   
   raise exception class (message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Connection refused (os error 111)`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] pritypriya25 removed a comment on issue #15118: How to compute and cache a screenshot using rest api in superset

Posted by GitBox <gi...@apache.org>.
pritypriya25 removed a comment on issue #15118:
URL: https://github.com/apache/superset/issues/15118#issuecomment-915930761


   @Hvitgar @YangJianFei 
   
   I am adding the following lines in my superset_config.py file.
   
   
   DATA_CACHE_CONFIG = {
   
       'CACHE_TYPE': 'redis',
   
       'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, #1-day default (in secs)
   
       'CACHE_KEY_PREFIX': 'superset_results',
   
       'CACHE_REDIS_URL': 'redis://localhost:6379/0',
   
   }
   
    
   
    
   
   CELERYBEAT_SCHEDULE = {
   
       'cache-warmup-hourly': {
   
           'task': 'cache-warmup',
   
           'schedule': crontab(minute=0, hour='*'),  # hourly
   
           'kwargs': {
   
               'strategy_name': 'top_n_dashboards',
   
               'top_n': 5,
   
               'since': '7 days ago',
   
           },
   
       },
   
   }
   
    
   
   FEATURE_FLAGS = {
   
       "THUMBNAILS": True,
   
       "THUMBNAILS_SQLA_LISTENERS": True,
   
   }
   
    
   
   
   I am now getting the result from hitting the API but the status code is 202 and when I hit the URL given in response then I am not getting any result of the image. Please help me with what else I need to add to my default configured file for getting the image on hitting the image URL. 
   ![Screenshot (27)](https://user-images.githubusercontent.com/85749375/132663126-a3c568db-d79d-4b83-81a1-b6e936810df0.png)
   
   
    
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org