bugraoz93 commented on code in PR #61942:
URL: https://github.com/apache/airflow/pull/61942#discussion_r2809040913
##########
airflow-ctl/src/airflowctl/ctl/commands/dag_command.py:
##########
@@ -36,25 +43,37 @@ def update_dag_state(
"""Update DAG state (pause/unpause)."""
try:
response = api_client.dags.update(
- dag_id=dag_id, dag_body=DAGPatchBody(is_paused=operation ==
"pause")
Review Comment:
This looks just enter nothing changes
##########
airflow-ctl/src/airflowctl/ctl/commands/dag_command.py:
##########
@@ -36,25 +43,37 @@ def update_dag_state(
"""Update DAG state (pause/unpause)."""
try:
response = api_client.dags.update(
- dag_id=dag_id, dag_body=DAGPatchBody(is_paused=operation ==
"pause")
+ dag_id=dag_id,
+ dag_body=DAGPatchBody(is_paused=operation == "pause")
)
except ServerResponseError as e:
- rich.print(f"[red]Error while trying to {operation} Dag {dag_id}:
{e}[/red]")
+ rich.print(f"[red]Error while trying to {operation} DAG {dag_id}:
{e}[/red]")
sys.exit(1)
- response_dict = response.model_dump()
- rich.print(f"[green]Dag {operation} successful {dag_id}[/green]")
- rich.print("[green]Further Dag details:[/green]")
+ # response may already be a dict from API client
+ if hasattr(response, "model_dump"):
Review Comment:
We are always sure that return model should be datamodel which is if not
maybe wrong response due to errors
##########
airflow-core/docs/best-practices.rst:
##########
@@ -465,15 +465,20 @@ Good example:
.. code-block:: python
- from airflow.sdk import Variable
from airflow.timetables.interval import CronDataIntervalTimetable
-
class CustomTimetable(CronDataIntervalTimetable):
def __init__(self, *args, something="something", **kwargs):
- self._something = Variable.get(something)
+ self._something = something
Review Comment:
This place is for core, ctl docs in the ctl directory
--
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]