codeant-ai-for-open-source[bot] commented on code in PR #41336:
URL: https://github.com/apache/superset/pull/41336#discussion_r3459588341
##########
superset/commands/report/exceptions.py:
##########
@@ -336,3 +336,15 @@ def __init__(self) -> None:
),
field_name="recipients",
)
+
+
+class ReportScheduleExecuteNowFailedError(CommandException):
+ message = _("Report Schedule execute now failed.")
Review Comment:
**Suggestion:** Add a class docstring to this newly introduced exception
class so it is documented inline. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The final file state shows this is a newly added Python class with no
docstring. The custom rule requires newly added Python classes to include
inline docstrings, so this is a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=368138130d8f4caea539fa28027a359c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=368138130d8f4caea539fa28027a359c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/report/exceptions.py
**Line:** 341:342
**Comment:**
*Custom Rule: Add a class docstring to this newly introduced exception
class so it is documented inline.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41336&comment_hash=ccca71e3b1775a90f4570270ffbb10c4d15850ec21817562ad19baf77b950b8e&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41336&comment_hash=ccca71e3b1775a90f4570270ffbb10c4d15850ec21817562ad19baf77b950b8e&reaction=dislike'>👎</a>
##########
superset/commands/report/exceptions.py:
##########
@@ -336,3 +336,15 @@ def __init__(self) -> None:
),
field_name="recipients",
)
+
+
+class ReportScheduleExecuteNowFailedError(CommandException):
+ message = _("Report Schedule execute now failed.")
+
+
+class ReportScheduleCeleryNotConfiguredError(CommandException):
+ status = 503
+ message = _(
+ "Report Schedule execution requires a Celery backend to be configured.
"
+ "Please configure a Celery broker (Redis or RabbitMQ) and worker
processes."
Review Comment:
**Suggestion:** Add a class docstring describing when this exception is
raised to satisfy documentation requirements for new classes. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The final file state shows this newly added class also lacks a docstring.
Since the rule explicitly requires docstrings for newly added Python classes,
the suggestion correctly identifies a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3207ca57417a490b9f74ec803e57c68b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=3207ca57417a490b9f74ec803e57c68b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/report/exceptions.py
**Line:** 345:349
**Comment:**
*Custom Rule: Add a class docstring describing when this exception is
raised to satisfy documentation requirements for new classes.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41336&comment_hash=d741eb5d6b275d508f8c02eacf2ffd8505ef785b9cc571e83cb26a12ed78c38c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41336&comment_hash=d741eb5d6b275d508f8c02eacf2ffd8505ef785b9cc571e83cb26a12ed78c38c&reaction=dislike'>👎</a>
##########
superset/commands/report/execute_now.py:
##########
@@ -0,0 +1,148 @@
+# 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.
+import logging
+from datetime import datetime, timezone
+from typing import Any, Optional
+from uuid import uuid4
+
+from flask import current_app
+
+from superset import security_manager
+from superset.commands.base import BaseCommand
+from superset.commands.exceptions import CommandException
+from superset.commands.report.exceptions import (
+ ReportScheduleCeleryNotConfiguredError,
+ ReportScheduleExecuteNowFailedError,
+ ReportScheduleForbiddenError,
+ ReportScheduleNotFoundError,
+)
+from superset.daos.report import ReportScheduleDAO
+from superset.exceptions import SupersetSecurityException
+from superset.reports.models import ReportSchedule
+
+logger = logging.getLogger(__name__)
+
+
+class ExecuteReportScheduleNowCommand(BaseCommand):
+ """
+ Execute a report schedule immediately (manual trigger).
+
+ Validates permissions and triggers immediate execution of a report or alert
+ via Celery task, similar to scheduled execution but without waiting for the
+ cron schedule. Sets ``eta`` to the current UTC time so that the downstream
+ task receives a valid ``scheduled_dttm`` value.
+ """
+
+ def __init__(self, model_id: int) -> None:
+ self._model_id = model_id
+ self._model: Optional[ReportSchedule] = None
Review Comment:
**Suggestion:** Add an inline docstring to this newly added initializer
method to document its purpose and parameter, in line with the requirement that
new functions/classes be documented. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added method in a new file, and it does not include a
docstring. The custom rule explicitly requires newly added Python functions and
classes to be documented inline, so the suggestion matches a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=acf2357ac92c422fbb0cb0f635008134&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=acf2357ac92c422fbb0cb0f635008134&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/report/execute_now.py
**Line:** 50:52
**Comment:**
*Custom Rule: Add an inline docstring to this newly added initializer
method to document its purpose and parameter, in line with the requirement that
new functions/classes be documented.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41336&comment_hash=de021c3ed9686f764214800b129a084a236e0ec18a1976453f84bdccfa4320a7&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41336&comment_hash=de021c3ed9686f764214800b129a084a236e0ec18a1976453f84bdccfa4320a7&reaction=dislike'>👎</a>
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]