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/12/22 16:39:39 UTC

[GitHub] [superset] betodealmeida opened a new pull request #17853: feat: add force option to report screenshots

betodealmeida opened a new pull request #17853:
URL: https://github.com/apache/superset/pull/17853


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   Add a new column `force_screenshot` to the reports/alerts model. For alerts this is always set to true. For reports this is currently set to false, and will be made configurable.
   
   When the flag is true, when generating a screenshot for the alert/report the cache will be bypassed.
   
   Depends on https://github.com/apache/superset/pull/17695.
   
   ### MIGRATION
   
   DB migration adds a new column `force_screenshot`, set to true for existing alerts, false otherwise.
   
   Results:
   
   Current: 0.34 s
   10+: 0.35 s
   100+: 0.39 s
   1000+: 0.74 s
   10000+: 3.58 s
   100000+: 32.59 s
   1000000+: 453.84 s
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   N/A
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   1. Create a report and a alert.
   2. Run `SELECT force_screenshot FROM report_schedule`, check that it's true for the alert and false for the report.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [X] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [X] Migration is atomic, supports rollback & is backwards-compatible
     - [X] Confirm DB migration upgrade and downgrade tested
     - [X] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or 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] betodealmeida merged pull request #17853: feat: add force option to report screenshots

Posted by GitBox <gi...@apache.org>.
betodealmeida merged pull request #17853:
URL: https://github.com/apache/superset/pull/17853


   


-- 
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] betodealmeida commented on a change in pull request #17853: feat: add force option to report screenshots

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #17853:
URL: https://github.com/apache/superset/pull/17853#discussion_r774062961



##########
File path: superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
##########
@@ -512,6 +513,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
     const data: any = {
       ...currentAlert,
       type: isReport ? 'Report' : 'Alert',
+      force_screenshot: contentType === 'chart' && !isReport ? 'true' : 'false',

Review comment:
       This is made configurable for reports in https://github.com/apache/superset/pull/17855




-- 
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] betodealmeida commented on a change in pull request #17853: feat: add force option to report screenshots

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #17853:
URL: https://github.com/apache/superset/pull/17853#discussion_r774062961



##########
File path: superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
##########
@@ -512,6 +513,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
     const data: any = {
       ...currentAlert,
       type: isReport ? 'Report' : 'Alert',
+      force_screenshot: contentType === 'chart' && !isReport ? 'true' : 'false',

Review comment:
       This is made configurable in https://github.com/apache/superset/pull/17855




-- 
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] eschutho commented on a change in pull request #17853: feat: add force option to report screenshots

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #17853:
URL: https://github.com/apache/superset/pull/17853#discussion_r778496723



##########
File path: superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py
##########
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Add force_screenshot to alerts/reports
+
+Revision ID: bb38f40aa3ff
+Revises: 31bb738bd1d2
+Create Date: 2021-12-10 19:25:29.802949
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = "bb38f40aa3ff"
+down_revision = "31bb738bd1d2"
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+Base = declarative_base()
+
+
+class ReportSchedule(Base):
+    __tablename__ = "report_schedule"
+
+    id = sa.Column(sa.Integer, primary_key=True)
+    type = sa.Column(sa.String(50), nullable=False)
+    force_screenshot = sa.Column(sa.Boolean, default=False)

Review comment:
       does this need a chart_id property?




-- 
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] betodealmeida commented on a change in pull request #17853: feat: add force option to report screenshots

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #17853:
URL: https://github.com/apache/superset/pull/17853#discussion_r774063668



##########
File path: superset/reports/commands/execute.py
##########
@@ -181,7 +175,7 @@ def _get_url(
             user_friendly=user_friendly,
             dashboard_id_or_slug=self._report_schedule.dashboard_id,
             standalone=DashboardStandaloneMode.REPORT.value,
-            force=force,
+            # force=force,  TODO (betodealmeida) implement this

Review comment:
       This is currently not supported by the dashboard API (only the chart API), so I thought it would be better to leave it out for now.




-- 
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] betodealmeida commented on a change in pull request #17853: feat: add force option to report screenshots

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #17853:
URL: https://github.com/apache/superset/pull/17853#discussion_r774062961



##########
File path: superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
##########
@@ -512,6 +513,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
     const data: any = {
       ...currentAlert,
       type: isReport ? 'Report' : 'Alert',
+      force_screenshot: contentType === 'chart' && !isReport ? 'true' : 'false',

Review comment:
       This is made configurable in https://github.com/apache/superset/pull/17855/files




-- 
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