This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 3b032e5a6a Use "note" instead of "notes" in API re dag run / task
instance notes (#27867)
3b032e5a6a is described below
commit 3b032e5a6a9a2dda0fa98d8b4d54dba7d2b305be
Author: Daniel Standish <[email protected]>
AuthorDate: Thu Nov 24 03:51:51 2022 -0800
Use "note" instead of "notes" in API re dag run / task instance notes
(#27867)
* rename notes to note in endpoint code
* rename notes to note in model code
* update test code
* update react code
* fixups
* fixup! fixups
* fix rebase mistake
Co-authored-by: Ephraim Anierobi <[email protected]>
---
.../api_connexion/endpoints/dag_run_endpoint.py | 8 ++--
.../endpoints/task_instance_endpoint.py | 16 ++++----
airflow/api_connexion/openapi/v1.yaml | 16 ++++----
airflow/api_connexion/schemas/dag_run_schema.py | 4 +-
.../api_connexion/schemas/task_instance_schema.py | 6 +--
airflow/models/dagrun.py | 2 +-
airflow/models/taskinstance.py | 2 +-
airflow/www/forms.py | 4 +-
airflow/www/static/js/api/index.ts | 8 ++--
airflow/www/static/js/api/useGridData.test.ts | 2 +-
.../{useSetDagRunNotes.ts => useSetDagRunNote.ts} | 14 +++----
...kInstanceNotes.ts => useSetTaskInstanceNote.ts} | 16 ++++----
airflow/www/static/js/dag/InstanceTooltip.test.tsx | 6 +--
airflow/www/static/js/dag/InstanceTooltip.tsx | 4 +-
.../www/static/js/dag/details/NotesAccordion.tsx | 26 ++++++-------
airflow/www/static/js/dag/details/dagRun/index.tsx | 4 +-
.../dag/details/taskInstance/MappedInstances.tsx | 2 +-
.../static/js/dag/details/taskInstance/index.tsx | 2 +-
airflow/www/static/js/dag/grid/dagRuns/Bar.tsx | 2 +-
airflow/www/static/js/dag/grid/dagRuns/Tooltip.tsx | 2 +-
.../www/static/js/dag/grid/dagRuns/index.test.tsx | 6 +--
airflow/www/static/js/dag/grid/index.test.tsx | 8 ++--
.../www/static/js/dag/grid/renderTaskRows.test.tsx | 4 +-
airflow/www/static/js/dag/grid/renderTaskRows.tsx | 4 +-
airflow/www/static/js/types/api-generated.ts | 26 ++++++-------
airflow/www/static/js/types/index.ts | 4 +-
airflow/www/static/js/utils/index.test.ts | 2 +-
airflow/www/static/js/utils/index.ts | 4 +-
airflow/www/templates/airflow/dag.html | 6 +--
airflow/www/utils.py | 2 +-
airflow/www/views.py | 18 ++++-----
.../endpoints/test_dag_run_endpoint.py | 44 +++++++++++-----------
.../test_mapped_task_instance_endpoint.py | 2 +-
.../endpoints/test_task_instance_endpoint.py | 34 ++++++++---------
tests/api_connexion/schemas/test_dag_run_schema.py | 6 +--
.../schemas/test_task_instance_schema.py | 6 +--
tests/www/views/test_views_grid.py | 8 ++--
37 files changed, 165 insertions(+), 165 deletions(-)
diff --git a/airflow/api_connexion/endpoints/dag_run_endpoint.py
b/airflow/api_connexion/endpoints/dag_run_endpoint.py
index e14bde177d..b566ba2df7 100644
--- a/airflow/api_connexion/endpoints/dag_run_endpoint.py
+++ b/airflow/api_connexion/endpoints/dag_run_endpoint.py
@@ -424,7 +424,7 @@ def clear_dag_run(*, dag_id: str, dag_run_id: str, session:
Session = NEW_SESSIO
],
)
@provide_session
-def set_dag_run_notes(*, dag_id: str, dag_run_id: str, session: Session =
NEW_SESSION) -> APIResponse:
+def set_dag_run_note(*, dag_id: str, dag_run_id: str, session: Session =
NEW_SESSION) -> APIResponse:
"""Set the note for a dag run."""
dag_run: DagRun | None = (
session.query(DagRun).filter(DagRun.dag_id == dag_id, DagRun.run_id ==
dag_run_id).one_or_none()
@@ -434,7 +434,7 @@ def set_dag_run_notes(*, dag_id: str, dag_run_id: str,
session: Session = NEW_SE
raise NotFound(error_message)
try:
post_body = set_dagrun_note_form_schema.load(get_json_request_dict())
- new_value_for_notes = post_body["notes"]
+ new_note = post_body["note"]
except ValidationError as err:
raise BadRequest(detail=str(err))
@@ -442,9 +442,9 @@ def set_dag_run_notes(*, dag_id: str, dag_run_id: str,
session: Session = NEW_SE
current_user_id = getattr(current_user, "id", None)
if dag_run.dag_run_note is None:
- dag_run.notes = (new_value_for_notes, current_user_id)
+ dag_run.note = (new_note, current_user_id)
else:
- dag_run.dag_run_note.content = new_value_for_notes
+ dag_run.dag_run_note.content = new_note
dag_run.dag_run_note.user_id = current_user_id
session.commit()
return dagrun_schema.dump(dag_run)
diff --git a/airflow/api_connexion/endpoints/task_instance_endpoint.py
b/airflow/api_connexion/endpoints/task_instance_endpoint.py
index 3f692d8a0d..4e9d6cb9a1 100644
--- a/airflow/api_connexion/endpoints/task_instance_endpoint.py
+++ b/airflow/api_connexion/endpoints/task_instance_endpoint.py
@@ -34,7 +34,7 @@ from airflow.api_connexion.schemas.task_instance_schema
import (
TaskInstanceReferenceCollection,
clear_task_instance_form,
set_single_task_instance_state_form,
- set_task_instance_notes_form_schema,
+ set_task_instance_note_form_schema,
set_task_instance_state_form,
task_instance_batch_form,
task_instance_collection_schema,
@@ -550,11 +550,11 @@ def post_set_task_instances_state(*, dag_id: str,
session: Session = NEW_SESSION
return
task_instance_reference_collection_schema.dump(TaskInstanceReferenceCollection(task_instances=tis))
-def set_mapped_task_instance_notes(
+def set_mapped_task_instance_note(
*, dag_id: str, dag_run_id: str, task_id: str, map_index: int
) -> APIResponse:
"""Set the note for a Mapped Task instance."""
- return set_task_instance_notes(dag_id=dag_id, dag_run_id=dag_run_id,
task_id=task_id, map_index=map_index)
+ return set_task_instance_note(dag_id=dag_id, dag_run_id=dag_run_id,
task_id=task_id, map_index=map_index)
@security.requires_access(
@@ -629,13 +629,13 @@ def patch_mapped_task_instance(
],
)
@provide_session
-def set_task_instance_notes(
+def set_task_instance_note(
*, dag_id: str, dag_run_id: str, task_id: str, map_index: int = -1,
session: Session = NEW_SESSION
) -> APIResponse:
"""Set the note for a Task instance. This supports both Mapped and
non-Mapped Task instances."""
try:
- post_body =
set_task_instance_notes_form_schema.load(get_json_request_dict())
- new_value_for_notes = post_body["notes"]
+ post_body =
set_task_instance_note_form_schema.load(get_json_request_dict())
+ new_note = post_body["note"]
except ValidationError as err:
raise BadRequest(detail=str(err))
@@ -674,9 +674,9 @@ def set_task_instance_notes(
current_user_id = getattr(current_user, "id", None)
if ti.task_instance_note is None:
- ti.notes = (new_value_for_notes, current_user_id)
+ ti.note = (new_note, current_user_id)
else:
- ti.task_instance_note.content = new_value_for_notes
+ ti.task_instance_note.content = new_note
ti.task_instance_note.user_id = current_user_id
session.commit()
return task_instance_schema.dump((ti, sla_miss))
diff --git a/airflow/api_connexion/openapi/v1.yaml
b/airflow/api_connexion/openapi/v1.yaml
index a7de1ce86c..0094e0d7f1 100644
--- a/airflow/api_connexion/openapi/v1.yaml
+++ b/airflow/api_connexion/openapi/v1.yaml
@@ -598,7 +598,7 @@ paths:
*New in version 2.5.0*
x-openapi-router-controller:
airflow.api_connexion.endpoints.task_instance_endpoint
- operationId: set_task_instance_notes
+ operationId: set_task_instance_note
tags: [DAG]
requestBody:
description: Parameters of set Task Instance note.
@@ -638,7 +638,7 @@ paths:
*New in version 2.5.0*
x-openapi-router-controller:
airflow.api_connexion.endpoints.task_instance_endpoint
- operationId: set_mapped_task_instance_notes
+ operationId: set_mapped_task_instance_note
tags: [DAG]
requestBody:
description: Parameters of set Task Instance note.
@@ -935,7 +935,7 @@ paths:
*New in version 2.5.0*
x-openapi-router-controller:
airflow.api_connexion.endpoints.dag_run_endpoint
- operationId: set_dag_run_notes
+ operationId: set_dag_run_note
tags: [DAGRun]
requestBody:
description: Parameters of set DagRun note.
@@ -2808,7 +2808,7 @@ components:
The value of this field can be set only when creating the object.
If you try to modify the
field of an existing object, the request fails with an BAD_REQUEST
error.
- notes:
+ note:
type: string
description: |
Contains manually entered notes by the user about the DagRun.
@@ -2884,7 +2884,7 @@ components:
SetDagRunNote:
type: object
properties:
- notes:
+ note:
description: Custom notes left by users for this Dag Run.
type: string
@@ -3249,7 +3249,7 @@ components:
triggerer_job:
$ref: '#/components/schemas/Job'
nullable: true
- notes:
+ note:
type: string
description: |
Contains manually entered notes by the user about the TaskInstance.
@@ -4174,9 +4174,9 @@ components:
SetTaskInstanceNote:
type: object
required:
- - notes
+ - note
properties:
- notes:
+ note:
description: The custom note to set for this Task Instance.
type: string
diff --git a/airflow/api_connexion/schemas/dag_run_schema.py
b/airflow/api_connexion/schemas/dag_run_schema.py
index 1a63a0eba3..7ca857951b 100644
--- a/airflow/api_connexion/schemas/dag_run_schema.py
+++ b/airflow/api_connexion/schemas/dag_run_schema.py
@@ -73,7 +73,7 @@ class DAGRunSchema(SQLAlchemySchema):
data_interval_end = auto_field(dump_only=True)
last_scheduling_decision = auto_field(dump_only=True)
run_type = auto_field(dump_only=True)
- notes = auto_field(dump_only=True)
+ note = auto_field(dump_only=True)
@pre_load
def autogenerate(self, data, **kwargs):
@@ -167,7 +167,7 @@ class DagRunsBatchFormSchema(Schema):
class SetDagRunNoteFormSchema(Schema):
"""Schema for handling the request of clearing a DAG run."""
- notes = fields.String(allow_none=True, validate=validate.Length(max=1000))
+ note = fields.String(allow_none=True, validate=validate.Length(max=1000))
dagrun_schema = DAGRunSchema()
diff --git a/airflow/api_connexion/schemas/task_instance_schema.py
b/airflow/api_connexion/schemas/task_instance_schema.py
index 2dc2355d49..970ef9a0fd 100644
--- a/airflow/api_connexion/schemas/task_instance_schema.py
+++ b/airflow/api_connexion/schemas/task_instance_schema.py
@@ -62,7 +62,7 @@ class TaskInstanceSchema(SQLAlchemySchema):
queued_dttm = auto_field(data_key="queued_when")
pid = auto_field()
executor_config = auto_field()
- notes = auto_field()
+ note = auto_field()
sla_miss = fields.Nested(SlaMissSchema, dump_default=None)
rendered_fields = JsonObjectField(dump_default={})
trigger = fields.Nested(TriggerSchema)
@@ -200,7 +200,7 @@ class SetTaskInstanceNoteFormSchema(Schema):
# Note: We can't add map_index to the url as subpaths can't start with
dashes.
map_index = fields.Int(allow_none=False)
- notes = fields.String(allow_none=True, validate=validate.Length(max=1000))
+ note = fields.String(allow_none=True, validate=validate.Length(max=1000))
task_instance_schema = TaskInstanceSchema()
@@ -211,4 +211,4 @@ set_task_instance_state_form =
SetTaskInstanceStateFormSchema()
set_single_task_instance_state_form = SetSingleTaskInstanceStateFormSchema()
task_instance_reference_schema = TaskInstanceReferenceSchema()
task_instance_reference_collection_schema =
TaskInstanceReferenceCollectionSchema()
-set_task_instance_notes_form_schema = SetTaskInstanceNoteFormSchema()
+set_task_instance_note_form_schema = SetTaskInstanceNoteFormSchema()
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index e148d08f49..d8f92d0099 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -175,7 +175,7 @@ class DagRun(Base, LoggingMixin):
viewonly=True,
)
dag_run_note = relationship("DagRunNote", back_populates="dag_run",
uselist=False)
- notes = association_proxy("dag_run_note", "content", creator=_creator_note)
+ note = association_proxy("dag_run_note", "content", creator=_creator_note)
DEFAULT_DAGRUNS_TO_EXAMINE = airflow_conf.getint(
"scheduler",
diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
index 4122a6b05d..201a7b6439 100644
--- a/airflow/models/taskinstance.py
+++ b/airflow/models/taskinstance.py
@@ -440,7 +440,7 @@ class TaskInstance(Base, LoggingMixin):
rendered_task_instance_fields = relationship("RenderedTaskInstanceFields",
lazy="noload", uselist=False)
execution_date = association_proxy("dag_run", "execution_date")
task_instance_note = relationship("TaskInstanceNote",
back_populates="task_instance", uselist=False)
- notes = association_proxy("task_instance_note", "content",
creator=_creator_note)
+ note = association_proxy("task_instance_note", "content",
creator=_creator_note)
task: Operator # Not always set...
def __init__(
diff --git a/airflow/www/forms.py b/airflow/www/forms.py
index 391146fab1..78ea1a8565 100644
--- a/airflow/www/forms.py
+++ b/airflow/www/forms.py
@@ -138,7 +138,7 @@ class DagRunEditForm(DynamicForm):
widget=AirflowDateTimePickerROWidget(),
)
conf = TextAreaField(lazy_gettext("Conf"), widget=BS3TextAreaROWidget())
- notes = TextAreaField(lazy_gettext("User Note"),
widget=BS3TextAreaFieldWidget())
+ note = TextAreaField(lazy_gettext("User Note"),
widget=BS3TextAreaFieldWidget())
def populate_obj(self, item):
"""Populates the attributes of the passed obj with data from the
form's fields."""
@@ -173,7 +173,7 @@ class TaskInstanceEditForm(DynamicForm):
widget=AirflowDateTimePickerROWidget(),
validators=[InputRequired()],
)
- notes = TextAreaField(lazy_gettext("User Note"),
widget=BS3TextAreaFieldWidget())
+ note = TextAreaField(lazy_gettext("User Note"),
widget=BS3TextAreaFieldWidget())
class ConnectionForm(DynamicForm):
diff --git a/airflow/www/static/js/api/index.ts
b/airflow/www/static/js/api/index.ts
index 9deca4fa46..5df46587e0 100644
--- a/airflow/www/static/js/api/index.ts
+++ b/airflow/www/static/js/api/index.ts
@@ -36,8 +36,8 @@ import useDatasets from './useDatasets';
import useDataset from './useDataset';
import useDatasetDependencies from './useDatasetDependencies';
import useDatasetEvents from './useDatasetEvents';
-import useSetDagRunNotes from './useSetDagRunNotes';
-import useSetTaskInstanceNotes from './useSetTaskInstanceNotes';
+import useSetDagRunNote from './useSetDagRunNote';
+import useSetTaskInstanceNote from './useSetTaskInstanceNote';
import useUpstreamDatasetEvents from './useUpstreamDatasetEvents';
import useTaskInstance from './useTaskInstance';
@@ -64,8 +64,8 @@ export {
useMarkSuccessTask,
useQueueRun,
useRunTask,
- useSetDagRunNotes,
- useSetTaskInstanceNotes,
+ useSetDagRunNote,
+ useSetTaskInstanceNote,
useTaskInstance,
useUpstreamDatasetEvents,
};
diff --git a/airflow/www/static/js/api/useGridData.test.ts
b/airflow/www/static/js/api/useGridData.test.ts
index d57c9e92b8..d84abf67e6 100644
--- a/airflow/www/static/js/api/useGridData.test.ts
+++ b/airflow/www/static/js/api/useGridData.test.ts
@@ -35,7 +35,7 @@ const commonDagRunParams = {
externalTrigger: false,
conf: null,
confIsJson: false,
- notes: '',
+ note: '',
};
describe('Test areActiveRuns()', () => {
diff --git a/airflow/www/static/js/api/useSetDagRunNotes.ts
b/airflow/www/static/js/api/useSetDagRunNote.ts
similarity index 81%
rename from airflow/www/static/js/api/useSetDagRunNotes.ts
rename to airflow/www/static/js/api/useSetDagRunNote.ts
index a80710cb45..927adb0ae2 100644
--- a/airflow/www/static/js/api/useSetDagRunNotes.ts
+++ b/airflow/www/static/js/api/useSetDagRunNote.ts
@@ -27,26 +27,26 @@ import useErrorToast from 'src/utils/useErrorToast';
import { emptyGridData } from './useGridData';
import type { GridData } from './useGridData';
-const setDagRunNotesURI = getMetaValue('set_dag_run_notes');
+const setDagRunNoteURI = getMetaValue('set_dag_run_note');
interface Props {
dagId: string;
runId: string;
}
-export default function useSetDagRunNotes({
+export default function useSetDagRunNote({
dagId, runId,
}: Props) {
const queryClient = useQueryClient();
const errorToast = useErrorToast();
- const setDagRunNotes = setDagRunNotesURI.replace('_DAG_RUN_ID_', runId);
+ const setDagRunNote = setDagRunNoteURI.replace('_DAG_RUN_ID_', runId);
return useMutation(
- ['setDagRunNotes', dagId, runId],
- (notes: string | null) => axios.patch<AxiosResponse,
API.DAGRun>(setDagRunNotes, { notes }),
+ ['setDagRunNote', dagId, runId],
+ (note: string | null) => axios.patch<AxiosResponse,
API.DAGRun>(setDagRunNote, { note }),
{
onSuccess: async (data) => {
- const notes = data.notes ?? null;
+ const note = data.note ?? null;
const updateGridData = (oldGridData: GridData | undefined) => (
!oldGridData
@@ -54,7 +54,7 @@ export default function useSetDagRunNotes({
: {
...oldGridData,
dagRuns: oldGridData.dagRuns.map((dr) => (
- dr.runId === runId ? { ...dr, notes } : dr)),
+ dr.runId === runId ? { ...dr, note } : dr)),
}
);
diff --git a/airflow/www/static/js/api/useSetTaskInstanceNotes.ts
b/airflow/www/static/js/api/useSetTaskInstanceNote.ts
similarity index 88%
rename from airflow/www/static/js/api/useSetTaskInstanceNotes.ts
rename to airflow/www/static/js/api/useSetTaskInstanceNote.ts
index f07f80f7a5..d35cedd696 100644
--- a/airflow/www/static/js/api/useSetTaskInstanceNotes.ts
+++ b/airflow/www/static/js/api/useSetTaskInstanceNote.ts
@@ -25,8 +25,8 @@ import useErrorToast from 'src/utils/useErrorToast';
import type { API } from 'src/types';
-const setTaskInstancesNotesURI = getMetaValue('set_task_instance_notes');
-const setMappedTaskInstancesNotesURI =
getMetaValue('set_mapped_task_instance_notes');
+const setTaskInstancesNoteURI = getMetaValue('set_task_instance_note');
+const setMappedTaskInstancesNoteURI =
getMetaValue('set_mapped_task_instance_note');
interface Props {
dagId: string;
@@ -35,7 +35,7 @@ interface Props {
mapIndex?: number;
}
-export default function useSetTaskInstanceNotes({
+export default function useSetTaskInstanceNote({
dagId, runId, taskId, mapIndex = -1,
}: Props) {
const queryClient = useQueryClient();
@@ -43,17 +43,17 @@ export default function useSetTaskInstanceNotes({
// Note: Werkzeug does not like the META URL on dag.html with an integer. It
can not put
// _MAP_INDEX_ there as it interprets that as the integer. Hence, we pass 0
as the integer.
// To avoid we replace other stuff, we add the surrounding strings to the
replacement query.
- const url = (mapIndex >= 0 ? setMappedTaskInstancesNotesURI :
setTaskInstancesNotesURI)
+ const url = (mapIndex >= 0 ? setMappedTaskInstancesNoteURI :
setTaskInstancesNoteURI)
.replace('_DAG_RUN_ID_', runId)
.replace('_TASK_ID_/0/setNote', `_TASK_ID_/${mapIndex}/setNote`)
.replace('_TASK_ID_', taskId);
return useMutation(
['setTaskInstanceNotes', dagId, runId, taskId, mapIndex],
- (notes: string | null) => axios.patch<AxiosResponse,
API.TaskInstance>(url, { notes }),
+ (note: string | null) => axios.patch<AxiosResponse, API.TaskInstance>(url,
{ note }),
{
onSuccess: async (data) => {
- const notes = data.notes ?? null;
+ const note = data.note ?? null;
const updateMappedInstancesResult = (oldMappedInstances?:
API.TaskInstanceCollection) => {
if (!oldMappedInstances) {
@@ -67,7 +67,7 @@ export default function useSetTaskInstanceNotes({
...oldMappedInstances,
taskInstances: oldMappedInstances.taskInstances?.map((ti) => (
ti.dagRunId === runId && ti.taskId === taskId && ti.mapIndex ===
mapIndex
- ? { ...ti, notes }
+ ? { ...ti, note }
: ti
)),
};
@@ -85,7 +85,7 @@ export default function useSetTaskInstanceNotes({
) {
return {
...oldTaskInstance,
- notes,
+ note,
};
}
return oldTaskInstance;
diff --git a/airflow/www/static/js/dag/InstanceTooltip.test.tsx
b/airflow/www/static/js/dag/InstanceTooltip.test.tsx
index cd83d0dbfb..8543057e7b 100644
--- a/airflow/www/static/js/dag/InstanceTooltip.test.tsx
+++ b/airflow/www/static/js/dag/InstanceTooltip.test.tsx
@@ -33,7 +33,7 @@ const instance = {
state: 'success' as TaskState,
runId: 'run',
taskId: 'task',
- notes: '',
+ note: '',
};
describe('Test Task InstanceTooltip', () => {
@@ -84,7 +84,7 @@ describe('Test Task InstanceTooltip', () => {
state: 'success',
startDate: '',
endDate: '',
- notes: '',
+ note: '',
},
],
},
@@ -104,7 +104,7 @@ describe('Test Task InstanceTooltip', () => {
const { getByText } = render(
<InstanceTooltip
group={{ id: 'task', label: 'task', instances: [] }}
- instance={{ ...instance, notes: 'note' }}
+ instance={{ ...instance, note: 'note' }}
/>,
{ wrapper: Wrapper },
);
diff --git a/airflow/www/static/js/dag/InstanceTooltip.tsx
b/airflow/www/static/js/dag/InstanceTooltip.tsx
index d45b874d07..f5aad277bb 100644
--- a/airflow/www/static/js/dag/InstanceTooltip.tsx
+++ b/airflow/www/static/js/dag/InstanceTooltip.tsx
@@ -33,7 +33,7 @@ interface Props {
const InstanceTooltip = ({
group,
instance: {
- startDate, endDate, state, runId, mappedStates, notes,
+ startDate, endDate, state, runId, mappedStates, note,
},
}: Props) => {
if (!group) return null;
@@ -103,7 +103,7 @@ const InstanceTooltip = ({
{' '}
{formatDuration(getDuration(startDate, endDate))}
</Text>
- {notes && (
+ {note && (
<Text>Contains a note</Text>
)}
</Box>
diff --git a/airflow/www/static/js/dag/details/NotesAccordion.tsx
b/airflow/www/static/js/dag/details/NotesAccordion.tsx
index e0e5ed696d..63fbdbf573 100644
--- a/airflow/www/static/js/dag/details/NotesAccordion.tsx
+++ b/airflow/www/static/js/dag/details/NotesAccordion.tsx
@@ -34,7 +34,7 @@ import {
import ResizeTextarea from 'react-textarea-autosize';
import { getMetaValue } from 'src/utils';
-import { useSetDagRunNotes, useSetTaskInstanceNotes } from 'src/api';
+import { useSetDagRunNote, useSetTaskInstanceNote } from 'src/api';
import { MdEdit } from 'react-icons/md';
interface Props {
@@ -49,15 +49,15 @@ const NotesAccordion = ({
dagId, runId, taskId, mapIndex, initialValue,
}: Props) => {
const canEdit = getMetaValue('can_edit') === 'True';
- const [notes, setNotes] = useState(initialValue ?? '');
+ const [note, setNote] = useState(initialValue ?? '');
const [editMode, setEditMode] = useState(false);
const {
mutateAsync: apiCallToSetDagRunNote, isLoading: dagRunIsLoading,
- } = useSetDagRunNotes({ dagId, runId });
+ } = useSetDagRunNote({ dagId, runId });
const {
mutateAsync: apiCallToSetTINote, isLoading: tiIsLoading,
- } = useSetTaskInstanceNotes({
+ } = useSetTaskInstanceNote({
dagId,
runId,
taskId: taskId ?? '',
@@ -70,9 +70,9 @@ const NotesAccordion = ({
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (taskId == null) {
- await apiCallToSetDagRunNote(notes);
+ await apiCallToSetDagRunNote(note);
} else {
- await apiCallToSetTINote(notes);
+ await apiCallToSetTINote(note);
}
setEditMode(false);
};
@@ -104,8 +104,8 @@ const NotesAccordion = ({
minRows={3}
maxRows={10}
as={ResizeTextarea}
- value={notes}
- onChange={(e) => setNotes(e.target.value)}
+ value={note}
+ onChange={(e) => setNote(e.target.value)}
data-testid="notes-input"
/>
</Box>
@@ -114,7 +114,7 @@ const NotesAccordion = ({
Save Note
</Button>
<Button
- onClick={() => { setNotes(initialValue ?? '');
setEditMode(false); }}
+ onClick={() => { setNote(initialValue ?? '');
setEditMode(false); }}
isLoading={isLoading}
ml={3}
>
@@ -124,17 +124,17 @@ const NotesAccordion = ({
</form>
) : (
<>
- <Text whiteSpace="pre-line">{notes}</Text>
+ <Text whiteSpace="pre-line">{note}</Text>
<Button
onClick={() => setEditMode(true)}
isDisabled={!canEdit}
isLoading={isLoading}
- title={`${!notes ? 'Add' : 'Edit'} a note to this
${objectIdentifier}`}
- aria-label={`${!notes ? 'Add' : 'Edit'} a note to this
${objectIdentifier}`}
+ title={`${!note ? 'Add' : 'Edit'} a note to this
${objectIdentifier}`}
+ aria-label={`${!note ? 'Add' : 'Edit'} a note to this
${objectIdentifier}`}
mt={2}
leftIcon={<MdEdit />}
>
- {!notes ? 'Add Note' : 'Edit Note'}
+ {!note ? 'Add Note' : 'Edit Note'}
</Button>
</>
)}
diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx
b/airflow/www/static/js/dag/details/dagRun/index.tsx
index ccfc0aa4c6..ffbf613da5 100644
--- a/airflow/www/static/js/dag/details/dagRun/index.tsx
+++ b/airflow/www/static/js/dag/details/dagRun/index.tsx
@@ -81,7 +81,7 @@ const DagRun = ({ runId }: Props) => {
externalTrigger,
conf,
confIsJson,
- notes,
+ note,
} = run;
const graphParams = new URLSearchParamsWrapper({
execution_date: executionDate,
@@ -117,7 +117,7 @@ const DagRun = ({ runId }: Props) => {
<NotesAccordion
dagId={dagId}
runId={runId}
- initialValue={notes}
+ initialValue={note}
key={dagId + runId}
/>
</Box>
diff --git a/airflow/www/static/js/dag/details/taskInstance/MappedInstances.tsx
b/airflow/www/static/js/dag/details/taskInstance/MappedInstances.tsx
index 785e6912fb..913322d729 100644
--- a/airflow/www/static/js/dag/details/taskInstance/MappedInstances.tsx
+++ b/airflow/www/static/js/dag/details/taskInstance/MappedInstances.tsx
@@ -66,7 +66,7 @@ const MappedInstances = ({
<StatusWithNotes
state={mi.state === undefined || mi.state === 'none' ? null :
mi.state}
mx={2}
- containsNotes={!!mi.notes}
+ containsNotes={!!mi.note}
/>
{mi.state || 'no status'}
</Flex>
diff --git a/airflow/www/static/js/dag/details/taskInstance/index.tsx
b/airflow/www/static/js/dag/details/taskInstance/index.tsx
index c893c850f4..329d84533a 100644
--- a/airflow/www/static/js/dag/details/taskInstance/index.tsx
+++ b/airflow/www/static/js/dag/details/taskInstance/index.tsx
@@ -174,7 +174,7 @@ const TaskInstance = ({
runId={runId}
taskId={taskId}
mapIndex={instance.mapIndex}
- initialValue={instance.notes}
+ initialValue={instance.note}
key={dagId + runId + taskId + instance.mapIndex}
/>
)}
diff --git a/airflow/www/static/js/dag/grid/dagRuns/Bar.tsx
b/airflow/www/static/js/dag/grid/dagRuns/Bar.tsx
index 623fde36fb..542d380240 100644
--- a/airflow/www/static/js/dag/grid/dagRuns/Bar.tsx
+++ b/airflow/www/static/js/dag/grid/dagRuns/Bar.tsx
@@ -112,7 +112,7 @@ const DagRunBar = ({
width="10px"
height={`${(duration / max) * BAR_HEIGHT}px`}
minHeight="14px"
- background={getStatusBackgroundColor(color, !!run.notes)}
+ background={getStatusBackgroundColor(color, !!run.note)}
borderRadius={2}
cursor="pointer"
pb="2px"
diff --git a/airflow/www/static/js/dag/grid/dagRuns/Tooltip.tsx
b/airflow/www/static/js/dag/grid/dagRuns/Tooltip.tsx
index f6836f1f54..6a4bea21a9 100644
--- a/airflow/www/static/js/dag/grid/dagRuns/Tooltip.tsx
+++ b/airflow/www/static/js/dag/grid/dagRuns/Tooltip.tsx
@@ -56,7 +56,7 @@ const DagRunTooltip = ({ dagRun }: Props) => {
{' '}
{dagRun.runType}
</Text>
- {dagRun.notes && (
+ {dagRun.note && (
<Text>Contains a note</Text>
)}
</Box>
diff --git a/airflow/www/static/js/dag/grid/dagRuns/index.test.tsx
b/airflow/www/static/js/dag/grid/dagRuns/index.test.tsx
index 3d98e18a90..e81d5cbfc1 100644
--- a/airflow/www/static/js/dag/grid/dagRuns/index.test.tsx
+++ b/airflow/www/static/js/dag/grid/dagRuns/index.test.tsx
@@ -45,7 +45,7 @@ const generateRuns = (length: number): DagRun[] => (
externalTrigger: false,
conf: null,
confIsJson: false,
- notes: 'someRandomValue',
+ note: 'someRandomValue',
}))
);
@@ -66,7 +66,7 @@ describe('Test DagRuns', () => {
externalTrigger: false,
conf: null,
confIsJson: false,
- notes: 'someRandomValue',
+ note: 'someRandomValue',
},
{
runId: 'run2',
@@ -82,7 +82,7 @@ describe('Test DagRuns', () => {
externalTrigger: false,
conf: null,
confIsJson: false,
- notes: 'someRandomValue',
+ note: 'someRandomValue',
},
];
const data = {
diff --git a/airflow/www/static/js/dag/grid/index.test.tsx
b/airflow/www/static/js/dag/grid/index.test.tsx
index 28ff73c2da..3e6f4536bb 100644
--- a/airflow/www/static/js/dag/grid/index.test.tsx
+++ b/airflow/www/static/js/dag/grid/index.test.tsx
@@ -44,7 +44,7 @@ const mockGridData = {
state: 'success',
taskId: 'group_1',
tryNumber: 1,
- notes: 'abc',
+ note: 'abc',
},
],
children: [
@@ -60,7 +60,7 @@ const mockGridData = {
state: 'success',
taskId: 'group_1.task_1',
tryNumber: 1,
- notes: 'abc',
+ note: 'abc',
},
],
children: [
@@ -77,7 +77,7 @@ const mockGridData = {
state: 'success',
taskId: 'group_1.task_1.sub_task_1',
tryNumber: 1,
- notes: 'abc',
+ note: 'abc',
},
],
},
@@ -100,7 +100,7 @@ const mockGridData = {
runType: 'scheduled',
executionDate: '2021-11-08T21:14:19.704433+00:00',
lastSchedulingDecision: '2021-11-08T21:14:19.704433+00:00',
- notes: 'myCoolDagRun',
+ note: 'myCoolDagRun',
externalTrigger: false,
conf: null,
confIsJson: false,
diff --git a/airflow/www/static/js/dag/grid/renderTaskRows.test.tsx
b/airflow/www/static/js/dag/grid/renderTaskRows.test.tsx
index e6d573734a..0b635927dd 100644
--- a/airflow/www/static/js/dag/grid/renderTaskRows.test.tsx
+++ b/airflow/www/static/js/dag/grid/renderTaskRows.test.tsx
@@ -44,7 +44,7 @@ describe('Test renderTaskRows', () => {
startDate: '2021-10-26T15:42:03.391917+00:00',
state: 'success',
taskId: 'group_1',
- notes: '',
+ note: '',
},
],
children: [
@@ -59,7 +59,7 @@ describe('Test renderTaskRows', () => {
startDate: '2021-10-26T15:42:03.391917+00:00',
state: 'success',
taskId: 'group_1.task_1',
- notes: '',
+ note: '',
},
],
},
diff --git a/airflow/www/static/js/dag/grid/renderTaskRows.tsx
b/airflow/www/static/js/dag/grid/renderTaskRows.tsx
index 08d912d3ea..9e4b3c0b37 100644
--- a/airflow/www/static/js/dag/grid/renderTaskRows.tsx
+++ b/airflow/www/static/js/dag/grid/renderTaskRows.tsx
@@ -85,7 +85,7 @@ const TaskInstances = ({
className={`js-${runId}`}
data-selected={isSelected}
transition="background-color 0.2s"
- key={`${runId}-${task.id}-${instance ? instance.notes : ''}`}
+ key={`${runId}-${task.id}-${instance ? instance.note : ''}`}
bg={isSelected ? 'blue.100' : undefined}
>
{instance
@@ -95,7 +95,7 @@ const TaskInstances = ({
group={task}
onSelect={onSelect}
isActive={hoveredTaskState === undefined || hoveredTaskState
=== instance.state}
- containsNotes={!!instance.notes}
+ containsNotes={!!instance.note}
/>
)
: <Box width={boxSizePx} data-testid="blank-task" />}
diff --git a/airflow/www/static/js/types/api-generated.ts
b/airflow/www/static/js/types/api-generated.ts
index 2e35ac9a4f..1ec47bd7d1 100644
--- a/airflow/www/static/js/types/api-generated.ts
+++ b/airflow/www/static/js/types/api-generated.ts
@@ -98,7 +98,7 @@ export interface paths {
*
* *New in version 2.5.0*
*/
- patch: operations["set_task_instance_notes"];
+ patch: operations["set_task_instance_note"];
parameters: {
path: {
/** The DAG ID. */
@@ -116,7 +116,7 @@ export interface paths {
*
* *New in version 2.5.0*
*/
- patch: operations["set_mapped_task_instance_notes"];
+ patch: operations["set_mapped_task_instance_note"];
parameters: {
path: {
/** The DAG ID. */
@@ -211,7 +211,7 @@ export interface paths {
*
* *New in version 2.5.0*
*/
- patch: operations["set_dag_run_notes"];
+ patch: operations["set_dag_run_note"];
parameters: {
path: {
/** The DAG ID. */
@@ -1043,7 +1043,7 @@ export interface components {
*
* *New in version 2.5.0*
*/
- notes?: string | null;
+ note?: string | null;
};
/**
* @description Modify the state of a DAG run.
@@ -1084,7 +1084,7 @@ export interface components {
} & components["schemas"]["CollectionInfo"];
SetDagRunNote: {
/** @description Custom notes left by users for this Dag Run. */
- notes?: string;
+ note?: string;
};
/** @description Log of user operations via CLI or Web UI. */
EventLog: {
@@ -1289,7 +1289,7 @@ export interface components {
*
* *New in version 2.5.0*
*/
- notes?: string | null;
+ note?: string | null;
};
/**
* @description Collection of task instances.
@@ -1829,7 +1829,7 @@ export interface components {
};
SetTaskInstanceNote: {
/** @description The custom note to set for this Task Instance. */
- notes: string;
+ note: string;
};
ListDagRunsForm: {
/**
@@ -2643,7 +2643,7 @@ export interface operations {
*
* *New in version 2.5.0*
*/
- set_task_instance_notes: {
+ set_task_instance_note: {
parameters: {
path: {
/** The DAG ID. */
@@ -2678,7 +2678,7 @@ export interface operations {
*
* *New in version 2.5.0*
*/
- set_mapped_task_instance_notes: {
+ set_mapped_task_instance_note: {
parameters: {
path: {
/** The DAG ID. */
@@ -2984,7 +2984,7 @@ export interface operations {
*
* *New in version 2.5.0*
*/
- set_dag_run_notes: {
+ set_dag_run_note: {
parameters: {
path: {
/** The DAG ID. */
@@ -4509,8 +4509,8 @@ export type GetDagVariables =
CamelCasedPropertiesDeep<operations['get_dag']['pa
export type DeleteDagVariables =
CamelCasedPropertiesDeep<operations['delete_dag']['parameters']['path']>;
export type PatchDagVariables =
CamelCasedPropertiesDeep<operations['patch_dag']['parameters']['path'] &
operations['patch_dag']['parameters']['query'] &
operations['patch_dag']['requestBody']['content']['application/json']>;
export type PostClearTaskInstancesVariables =
CamelCasedPropertiesDeep<operations['post_clear_task_instances']['parameters']['path']
&
operations['post_clear_task_instances']['requestBody']['content']['application/json']>;
-export type SetTaskInstanceNotesVariables =
CamelCasedPropertiesDeep<operations['set_task_instance_notes']['parameters']['path']
&
operations['set_task_instance_notes']['requestBody']['content']['application/json']>;
-export type SetMappedTaskInstanceNotesVariables =
CamelCasedPropertiesDeep<operations['set_mapped_task_instance_notes']['parameters']['path']
&
operations['set_mapped_task_instance_notes']['requestBody']['content']['application/json']>;
+export type SetTaskInstanceNoteVariables =
CamelCasedPropertiesDeep<operations['set_task_instance_note']['parameters']['path']
&
operations['set_task_instance_note']['requestBody']['content']['application/json']>;
+export type SetMappedTaskInstanceNoteVariables =
CamelCasedPropertiesDeep<operations['set_mapped_task_instance_note']['parameters']['path']
&
operations['set_mapped_task_instance_note']['requestBody']['content']['application/json']>;
export type PostSetTaskInstancesStateVariables =
CamelCasedPropertiesDeep<operations['post_set_task_instances_state']['parameters']['path']
&
operations['post_set_task_instances_state']['requestBody']['content']['application/json']>;
export type GetDagRunsVariables =
CamelCasedPropertiesDeep<operations['get_dag_runs']['parameters']['path'] &
operations['get_dag_runs']['parameters']['query']>;
export type PostDagRunVariables =
CamelCasedPropertiesDeep<operations['post_dag_run']['parameters']['path'] &
operations['post_dag_run']['requestBody']['content']['application/json']>;
@@ -4520,7 +4520,7 @@ export type DeleteDagRunVariables =
CamelCasedPropertiesDeep<operations['delete_
export type UpdateDagRunStateVariables =
CamelCasedPropertiesDeep<operations['update_dag_run_state']['parameters']['path']
&
operations['update_dag_run_state']['requestBody']['content']['application/json']>;
export type ClearDagRunVariables =
CamelCasedPropertiesDeep<operations['clear_dag_run']['parameters']['path'] &
operations['clear_dag_run']['requestBody']['content']['application/json']>;
export type GetUpstreamDatasetEventsVariables =
CamelCasedPropertiesDeep<operations['get_upstream_dataset_events']['parameters']['path']>;
-export type SetDagRunNotesVariables =
CamelCasedPropertiesDeep<operations['set_dag_run_notes']['parameters']['path']
&
operations['set_dag_run_notes']['requestBody']['content']['application/json']>;
+export type SetDagRunNoteVariables =
CamelCasedPropertiesDeep<operations['set_dag_run_note']['parameters']['path'] &
operations['set_dag_run_note']['requestBody']['content']['application/json']>;
export type GetEventLogsVariables =
CamelCasedPropertiesDeep<operations['get_event_logs']['parameters']['query']>;
export type GetEventLogVariables =
CamelCasedPropertiesDeep<operations['get_event_log']['parameters']['path']>;
export type GetImportErrorsVariables =
CamelCasedPropertiesDeep<operations['get_import_errors']['parameters']['query']>;
diff --git a/airflow/www/static/js/types/index.ts
b/airflow/www/static/js/types/index.ts
index dd2468646e..524e09a92a 100644
--- a/airflow/www/static/js/types/index.ts
+++ b/airflow/www/static/js/types/index.ts
@@ -56,7 +56,7 @@ interface DagRun {
externalTrigger: boolean;
conf: string | null;
confIsJson: boolean;
- notes: string | null;
+ note: string | null;
}
interface TaskInstance {
@@ -72,7 +72,7 @@ interface TaskInstance {
tryNumber?: number;
triggererJob?: Job;
trigger?: Trigger;
- notes: string | null;
+ note: string | null;
}
interface Trigger {
diff --git a/airflow/www/static/js/utils/index.test.ts
b/airflow/www/static/js/utils/index.test.ts
index adf50e27de..f0d7787ea6 100644
--- a/airflow/www/static/js/utils/index.test.ts
+++ b/airflow/www/static/js/utils/index.test.ts
@@ -132,7 +132,7 @@ describe('Test getDagRunLabel', () => {
externalTrigger: false,
conf: null,
confIsJson: false,
- notes: 'someRandomValue',
+ note: 'someRandomValue',
} as DagRun;
test('Defaults to dataIntervalEnd', async () => {
diff --git a/airflow/www/static/js/utils/index.ts
b/airflow/www/static/js/utils/index.ts
index dd18475ed9..aa0c695c9f 100644
--- a/airflow/www/static/js/utils/index.ts
+++ b/airflow/www/static/js/utils/index.ts
@@ -125,8 +125,8 @@ const getDagRunLabel = ({
ordering = ['dataIntervalEnd', 'executionDate'],
}: RunLabelProps) => dagRun[ordering[0]] ?? dagRun[ordering[1]];
-const getStatusBackgroundColor = (color: string, hasNotes: boolean) => (
- hasNotes
+const getStatusBackgroundColor = (color: string, hasNote: boolean) => (
+ hasNote
? `linear-gradient(-135deg, ${Color(color).hex()}60 5px, ${color} 0);`
: color
);
diff --git a/airflow/www/templates/airflow/dag.html
b/airflow/www/templates/airflow/dag.html
index 1400f2e77d..e6da97e68d 100644
--- a/airflow/www/templates/airflow/dag.html
+++ b/airflow/www/templates/airflow/dag.html
@@ -72,9 +72,9 @@
<meta name="task_log_api" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_log_endpoint_get_log',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_', task_id='_TASK_ID_',
task_try_number='-1') }}">
<meta name="upstream_dataset_events_api" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_dag_run_endpoint_get_upstream_dataset_events',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_') }}">
<meta name="task_instance_api" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_task_instance_endpoint_get_task_instance',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_', task_id='_TASK_ID_') }}">
- <meta name="set_task_instance_notes" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_task_instance_endpoint_set_task_instance_notes',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_', task_id='_TASK_ID_' ) }}">
- <meta name="set_mapped_task_instance_notes" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_task_instance_endpoint_set_mapped_task_instance_notes',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_', task_id='_TASK_ID_', map_index=0
) }}">
- <meta name="set_dag_run_notes" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_dag_run_endpoint_set_dag_run_notes',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_') }}">
+ <meta name="set_task_instance_note" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_task_instance_endpoint_set_task_instance_note',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_', task_id='_TASK_ID_' ) }}">
+ <meta name="set_mapped_task_instance_note" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_task_instance_endpoint_set_mapped_task_instance_note',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_', task_id='_TASK_ID_', map_index=0
) }}">
+ <meta name="set_dag_run_note" content="{{
url_for('/api/v1.airflow_api_connexion_endpoints_dag_run_endpoint_set_dag_run_note',
dag_id=dag.dag_id, dag_run_id='_DAG_RUN_ID_') }}">
<!-- End Urls -->
<meta name="is_paused" content="{{ dag_is_paused }}">
diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index c1908ed87c..971a2c7a82 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -159,7 +159,7 @@ def encode_dag_run(dag_run: DagRun | None) -> dict[str,
Any] | None:
"external_trigger": dag_run.external_trigger,
"conf": conf,
"conf_is_json": conf_is_json,
- "notes": dag_run.notes,
+ "note": dag_run.note,
}
diff --git a/airflow/www/views.py b/airflow/www/views.py
index d5c7235969..e334dcce7b 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -263,7 +263,7 @@ def dag_to_grid(dag, dag_runs, session):
TaskInstance.task_id,
TaskInstance.run_id,
TaskInstance.state,
- func.min(TaskInstanceNote.content).label("notes"),
+ func.min(TaskInstanceNote.content).label("note"),
func.count(func.coalesce(TaskInstance.state,
sqla.literal("no_status"))).label("state_count"),
func.min(TaskInstance.start_date).label("start_date"),
func.max(TaskInstance.end_date).label("end_date"),
@@ -297,7 +297,7 @@ def dag_to_grid(dag, dag_runs, session):
"start_date": task_instance.start_date,
"end_date": task_instance.end_date,
"try_number": try_count,
- "notes": task_instance.notes,
+ "note": task_instance.note,
}
def _mapped_summary(ti_summaries):
@@ -4894,7 +4894,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"queued_at",
"start_date",
"end_date",
- "notes",
+ "note",
"external_trigger",
"conf",
"duration",
@@ -4907,7 +4907,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"run_type",
"start_date",
"end_date",
- # "notes", # todo: maybe figure out how to re-enable this
+ # "note", # todo: maybe figure out how to re-enable this
"external_trigger",
]
label_columns = {
@@ -4921,7 +4921,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"end_date",
"run_id",
"conf",
- "notes",
+ "note",
]
# duration is not a DB column, its derived
@@ -4934,7 +4934,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"queued_at",
"start_date",
"end_date",
- "notes",
+ "note",
"external_trigger",
"conf",
]
@@ -5267,7 +5267,7 @@ class
TaskInstanceModelView(AirflowPrivilegeVerifierModelView):
"start_date",
"end_date",
"duration",
- "notes",
+ "note",
"job_id",
"hostname",
"unixname",
@@ -5299,7 +5299,7 @@ class
TaskInstanceModelView(AirflowPrivilegeVerifierModelView):
"operator",
"start_date",
"end_date",
- # "notes", # todo: maybe make notes work with TI search?
+ # "note", # todo: maybe make note work with TI search?
"hostname",
"priority_weight",
"queue",
@@ -5316,7 +5316,7 @@ class
TaskInstanceModelView(AirflowPrivilegeVerifierModelView):
"start_date",
"end_date",
"state",
- "notes",
+ "note",
]
add_exclude_columns = ["next_method", "next_kwargs", "trigger_id"]
diff --git a/tests/api_connexion/endpoints/test_dag_run_endpoint.py
b/tests/api_connexion/endpoints/test_dag_run_endpoint.py
index fe0d144f47..8b02bb321f 100644
--- a/tests/api_connexion/endpoints/test_dag_run_endpoint.py
+++ b/tests/api_connexion/endpoints/test_dag_run_endpoint.py
@@ -241,7 +241,7 @@ class TestGetDagRun(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
}
def test_should_respond_404(self):
@@ -299,7 +299,7 @@ class TestGetDagRuns(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
{
"dag_id": "TEST_DAG_ID",
@@ -315,7 +315,7 @@ class TestGetDagRuns(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
],
"total_entries": 2,
@@ -371,7 +371,7 @@ class TestGetDagRuns(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
{
"dag_id": "TEST_DAG_ID",
@@ -387,7 +387,7 @@ class TestGetDagRuns(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
],
"total_entries": 2,
@@ -636,7 +636,7 @@ class TestGetDagRunBatch(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
{
"dag_id": "TEST_DAG_ID",
@@ -652,7 +652,7 @@ class TestGetDagRunBatch(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
],
"total_entries": 2,
@@ -695,7 +695,7 @@ class TestGetDagRunBatch(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
{
"dag_id": "TEST_DAG_ID",
@@ -711,7 +711,7 @@ class TestGetDagRunBatch(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
],
"total_entries": 2,
@@ -752,7 +752,7 @@ class TestGetDagRunBatch(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
{
"dag_id": "TEST_DAG_ID",
@@ -768,7 +768,7 @@ class TestGetDagRunBatch(TestDagRunEndpoint):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
],
"total_entries": 2,
@@ -1068,7 +1068,7 @@ class TestPostDagRun(TestDagRunEndpoint):
"data_interval_start": expected_logical_date,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
}
def test_should_respond_400_if_a_dag_has_import_errors(self, session):
@@ -1118,7 +1118,7 @@ class TestPostDagRun(TestDagRunEndpoint):
"data_interval_start": logical_date,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
}
def
test_should_response_400_for_conflicting_execution_date_logical_date(self):
@@ -1331,7 +1331,7 @@ class TestPatchDagRunState(TestDagRunEndpoint):
"data_interval_end": dr.data_interval_end.isoformat(),
"last_scheduling_decision": None,
"run_type": run_type,
- "notes": None,
+ "note": None,
}
@pytest.mark.parametrize("invalid_state", ["running"])
@@ -1427,7 +1427,7 @@ class TestClearDagRun(TestDagRunEndpoint):
"data_interval_end": dr.data_interval_end.isoformat(),
"last_scheduling_decision": None,
"run_type": dr.run_type,
- "notes": None,
+ "note": None,
}
ti.refresh_from_db()
@@ -1605,16 +1605,16 @@ class TestSetDagRunNote(TestDagRunEndpoint):
session.commit()
created_dr: DagRun = dag_runs[0]
- new_notes_value = "My super cool DagRun notes"
+ new_note_value = "My super cool DagRun notes"
response = self.client.patch(
f"api/v1/dags/{created_dr.dag_id}/dagRuns/{created_dr.run_id}/setNote",
- json={"notes": new_notes_value},
+ json={"note": new_note_value},
environ_overrides={"REMOTE_USER": "test"},
)
dr = session.query(DagRun).filter(DagRun.run_id ==
created_dr.run_id).first()
assert response.status_code == 200, response.text
- assert dr.notes == new_notes_value
+ assert dr.note == new_note_value
assert response.json == {
"conf": {},
"dag_id": dr.dag_id,
@@ -1629,21 +1629,21 @@ class TestSetDagRunNote(TestDagRunEndpoint):
"data_interval_end": None,
"last_scheduling_decision": None,
"run_type": dr.run_type,
- "notes": new_notes_value,
+ "note": new_note_value,
}
assert dr.dag_run_note.user_id is not None
def test_should_raises_401_unauthenticated(self, session):
response = self.client.patch(
"api/v1/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID_1/setNote",
- json={"notes": "I am setting a note while being unauthenticated."},
+ json={"note": "I am setting a note while being unauthenticated."},
)
assert_401(response)
def test_should_raise_403_forbidden(self):
response = self.client.patch(
"api/v1/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID_1/setNote",
- json={"notes": "I am setting a note without the proper
permissions."},
+ json={"note": "I am setting a note without the proper
permissions."},
environ_overrides={"REMOTE_USER": "test_no_permissions"},
)
assert response.status_code == 403
@@ -1651,7 +1651,7 @@ class TestSetDagRunNote(TestDagRunEndpoint):
def test_should_respond_404(self):
response = self.client.patch(
"api/v1/dags/INVALID_DAG_ID/dagRuns/TEST_DAG_RUN_ID_1/setNote",
- json={"notes": "I am setting a note on a DAG that doesn't exist."},
+ json={"note": "I am setting a note on a DAG that doesn't exist."},
environ_overrides={"REMOTE_USER": "test"},
)
assert response.status_code == 404
diff --git
a/tests/api_connexion/endpoints/test_mapped_task_instance_endpoint.py
b/tests/api_connexion/endpoints/test_mapped_task_instance_endpoint.py
index 36d7aee1c0..cfb141e09b 100644
--- a/tests/api_connexion/endpoints/test_mapped_task_instance_endpoint.py
+++ b/tests/api_connexion/endpoints/test_mapped_task_instance_endpoint.py
@@ -225,7 +225,7 @@ class
TestGetMappedTaskInstance(TestMappedTaskInstanceEndpoint):
"hostname": "",
"map_index": 0,
"max_tries": 0,
- "notes": None,
+ "note": None,
"operator": "MockOperator",
"pid": None,
"pool": "default_pool",
diff --git a/tests/api_connexion/endpoints/test_task_instance_endpoint.py
b/tests/api_connexion/endpoints/test_task_instance_endpoint.py
index 4eef4c8412..af1866fb1a 100644
--- a/tests/api_connexion/endpoints/test_task_instance_endpoint.py
+++ b/tests/api_connexion/endpoints/test_task_instance_endpoint.py
@@ -158,7 +158,7 @@ class TestTaskInstanceEndpoint:
session.add(dr)
ti = TaskInstance(task=tasks[i], **self.ti_init)
ti.dag_run = dr
- ti.notes = "placeholder-note"
+ ti.note = "placeholder-note"
for key, value in self.ti_extras.items():
setattr(ti, key, value)
@@ -201,7 +201,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": "placeholder-note",
+ "note": "placeholder-note",
"operator": None,
"pid": 100,
"pool": "default_pool",
@@ -256,7 +256,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": "placeholder-note",
+ "note": "placeholder-note",
"operator": "_PythonDecoratedOperator",
"pid": 100,
"pool": "default_pool",
@@ -301,7 +301,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": "placeholder-note",
+ "note": "placeholder-note",
"operator": "_PythonDecoratedOperator",
"pid": 100,
"pool": "default_pool",
@@ -349,7 +349,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": "placeholder-note",
+ "note": "placeholder-note",
"operator": "_PythonDecoratedOperator",
"pid": 100,
"pool": "default_pool",
@@ -384,7 +384,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
for idx in (1, 2):
ti = TaskInstance(task=old_ti.task, run_id=old_ti.run_id,
map_index=idx)
ti.rendered_task_instance_fields = RTIF(ti, render_templates=False)
- for attr in ["duration", "end_date", "pid", "start_date", "state",
"queue", "notes"]:
+ for attr in ["duration", "end_date", "pid", "start_date", "state",
"queue", "note"]:
setattr(ti, attr, getattr(old_ti, attr))
session.add(ti)
session.commit()
@@ -407,7 +407,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": map_index,
"max_tries": 0,
- "notes": "placeholder-note",
+ "note": "placeholder-note",
"operator": "_PythonDecoratedOperator",
"pid": 100,
"pool": "default_pool",
@@ -1816,11 +1816,11 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
@provide_session
def test_should_respond_200(self, session):
tis = self.create_task_instances(session)
- new_notes_value = "My super cool TaskInstance notes."
+ new_note_value = "My super cool TaskInstance note."
response = self.client.patch(
"api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/"
"print_the_context/setNote",
- json={"notes": new_notes_value},
+ json={"note": new_note_value},
environ_overrides={"REMOTE_USER": "test"},
)
assert response.status_code == 200, response.text
@@ -1833,7 +1833,7 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": new_notes_value,
+ "note": new_note_value,
"operator": "_PythonDecoratedOperator",
"pid": 100,
"pool": "default_pool",
@@ -1862,18 +1862,18 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
for idx in (1, 2):
ti = TaskInstance(task=old_ti.task, run_id=old_ti.run_id,
map_index=idx)
ti.rendered_task_instance_fields = RTIF(ti, render_templates=False)
- for attr in ["duration", "end_date", "pid", "start_date", "state",
"queue", "notes"]:
+ for attr in ["duration", "end_date", "pid", "start_date", "state",
"queue", "note"]:
setattr(ti, attr, getattr(old_ti, attr))
session.add(ti)
session.commit()
# in each loop, we should get the right mapped TI back
for map_index in (1, 2):
- new_notes_value = f"My super cool TaskInstance notes {map_index}"
+ new_note_value = f"My super cool TaskInstance note {map_index}"
response = self.client.patch(
"api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/"
f"print_the_context/{map_index}/setNote",
- json={"notes": new_notes_value},
+ json={"note": new_note_value},
environ_overrides={"REMOTE_USER": "test"},
)
assert response.status_code == 200, response.text
@@ -1887,7 +1887,7 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
"hostname": "",
"map_index": map_index,
"max_tries": 0,
- "notes": new_notes_value,
+ "note": new_note_value,
"operator": "_PythonDecoratedOperator",
"pid": 100,
"pool": "default_pool",
@@ -1915,7 +1915,7 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
)
response = self.client.patch(
url,
- json={"notes": "I am setting a note while being
unauthenticated."},
+ json={"note": "I am setting a note while being
unauthenticated."},
)
assert_401(response)
@@ -1924,7 +1924,7 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
response = self.client.patch(
"api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/"
f"print_the_context{map_index}/setNote",
- json={"notes": "I am setting a note without the proper
permissions."},
+ json={"note": "I am setting a note without the proper
permissions."},
environ_overrides={"REMOTE_USER": "test_no_permissions"},
)
assert response.status_code == 403
@@ -1935,7 +1935,7 @@ class TestSetTaskInstanceNote(TestTaskInstanceEndpoint):
response = self.client.patch(
f"api/v1/dags/INVALID_DAG_ID/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context"
f"{map_index}/setNote",
- json={"notes": "I am setting a note on a DAG that doesn't
exist."},
+ json={"note": "I am setting a note on a DAG that doesn't
exist."},
environ_overrides={"REMOTE_USER": "test"},
)
assert response.status_code == 404
diff --git a/tests/api_connexion/schemas/test_dag_run_schema.py
b/tests/api_connexion/schemas/test_dag_run_schema.py
index a79983601c..74a119ca55 100644
--- a/tests/api_connexion/schemas/test_dag_run_schema.py
+++ b/tests/api_connexion/schemas/test_dag_run_schema.py
@@ -77,7 +77,7 @@ class TestDAGRunSchema(TestDAGRunBase):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
}
@pytest.mark.parametrize(
@@ -171,7 +171,7 @@ class TestDagRunCollection(TestDAGRunBase):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
{
"dag_id": "my-dag-run",
@@ -187,7 +187,7 @@ class TestDagRunCollection(TestDAGRunBase):
"data_interval_start": None,
"last_scheduling_decision": None,
"run_type": "manual",
- "notes": None,
+ "note": None,
},
],
"total_entries": 2,
diff --git a/tests/api_connexion/schemas/test_task_instance_schema.py
b/tests/api_connexion/schemas/test_task_instance_schema.py
index 50cf5dee07..e46d0f8a5b 100644
--- a/tests/api_connexion/schemas/test_task_instance_schema.py
+++ b/tests/api_connexion/schemas/test_task_instance_schema.py
@@ -55,7 +55,7 @@ class TestTaskInstanceSchema:
"duration": 10000,
"pool": "default_pool",
"queue": "default_queue",
- "notes": "added some notes",
+ "note": "added some notes",
}
yield
@@ -76,7 +76,7 @@ class TestTaskInstanceSchema:
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": "added some notes",
+ "note": "added some notes",
"operator": "EmptyOperator",
"pid": 100,
"pool": "default_pool",
@@ -121,7 +121,7 @@ class TestTaskInstanceSchema:
"hostname": "",
"map_index": -1,
"max_tries": 0,
- "notes": "added some notes",
+ "note": "added some notes",
"operator": "EmptyOperator",
"pid": 100,
"pool": "default_pool",
diff --git a/tests/www/views/test_views_grid.py
b/tests/www/views/test_views_grid.py
index a6e3271391..2ff6db4751 100644
--- a/tests/www/views/test_views_grid.py
+++ b/tests/www/views/test_views_grid.py
@@ -178,7 +178,7 @@ def test_one_run(admin_client, dag_with_runs: list[DagRun],
session):
"execution_date": "2016-01-01T00:00:00+00:00",
"external_trigger": False,
"last_scheduling_decision": None,
- "notes": None,
+ "note": None,
"queued_at": None,
"run_id": "run_1",
"run_type": "scheduled",
@@ -194,7 +194,7 @@ def test_one_run(admin_client, dag_with_runs: list[DagRun],
session):
"execution_date": "2016-01-02T00:00:00+00:00",
"external_trigger": False,
"last_scheduling_decision": None,
- "notes": None,
+ "note": None,
"queued_at": None,
"run_id": "run_2",
"run_type": "scheduled",
@@ -213,7 +213,7 @@ def test_one_run(admin_client, dag_with_runs: list[DagRun],
session):
"run_id": "run_1",
"start_date": None,
"end_date": None,
- "notes": None,
+ "note": None,
"state": "success",
"task_id": "task1",
"try_number": 1,
@@ -222,7 +222,7 @@ def test_one_run(admin_client, dag_with_runs: list[DagRun],
session):
"run_id": "run_2",
"start_date": None,
"end_date": None,
- "notes": None,
+ "note": None,
"state": "success",
"task_id": "task1",
"try_number": 1,