You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "aritra24 (via GitHub)" <gi...@apache.org> on 2025/03/14 15:13:58 UTC
[PR] Adds validation on backfill dryrun [airflow]
aritra24 opened a new pull request, #47790:
URL: https://github.com/apache/airflow/pull/47790
Adds some date checks before triggering backfill dryrun
Fixes: #47698
<!--
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.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r1999502372
##########
airflow/ui/src/queries/useCreateBackfill.ts:
##########
@@ -50,7 +50,7 @@ export const useCreateBackfill = ({ onSuccessConfirm }: { onSuccessConfirm: () =
const dataIntervalEnd = new Date(data.requestBody.to_date);
const dagId = data.requestBody.dag_id;
- if (!Boolean(dataIntervalStart) || !Boolean(dataIntervalEnd)) {
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
Is this required ? `!Boolean` check seems clearer to me that calling `getTime` and checking for `isNaN`
Otherwise checking explicitely for `null` or `undefined` is better.
##########
airflow/ui/src/queries/useCreateBackfillDryRun.ts:
##########
@@ -28,12 +28,30 @@ type Props<TData, TError> = {
const useCreateBackfillDryRunKey = "useCreateBackfillDryRunKey";
+const validateHeaderName = (requestBody: CreateBackfillDryRunData) => {
+ const dataIntervalStart = new Date(requestBody.requestBody.from_date);
+ const dataIntervalEnd = new Date(requestBody.requestBody.to_date);
+
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
same here
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "aritra24 (via GitHub)" <gi...@apache.org>.
aritra24 commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r2000987234
##########
airflow/ui/src/queries/useCreateBackfill.ts:
##########
@@ -50,7 +50,7 @@ export const useCreateBackfill = ({ onSuccessConfirm }: { onSuccessConfirm: () =
const dataIntervalEnd = new Date(data.requestBody.to_date);
const dagId = data.requestBody.dag_id;
- if (!Boolean(dataIntervalStart) || !Boolean(dataIntervalEnd)) {
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
Done
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "aritra24 (via GitHub)" <gi...@apache.org>.
aritra24 commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r1996185480
##########
airflow/ui/src/components/DagActions/RunBackfillForm.tsx:
##########
@@ -197,7 +197,14 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
name="max_active_runs"
render={({ field }) => (
<HStack>
- <Input {...field} placeholder="" type="number" width={24} />
+ <Input
+ {...field}
+ max={affectedTasks.total_entries}
+ min={1}
+ placeholder=""
+ type="number"
+ width={24}
Review Comment:
Done
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r1995895366
##########
airflow/ui/src/components/DagActions/RunBackfillForm.tsx:
##########
@@ -197,7 +197,14 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
name="max_active_runs"
render={({ field }) => (
<HStack>
- <Input {...field} placeholder="" type="number" width={24} />
+ <Input
+ {...field}
+ max={affectedTasks.total_entries}
+ min={1}
+ placeholder=""
+ type="number"
+ width={24}
Review Comment:
Can we put a max based on `dag.max_active_runs`?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r2000469308
##########
airflow/ui/src/queries/useCreateBackfill.ts:
##########
@@ -50,7 +50,7 @@ export const useCreateBackfill = ({ onSuccessConfirm }: { onSuccessConfirm: () =
const dataIntervalEnd = new Date(data.requestBody.to_date);
const dagId = data.requestBody.dag_id;
- if (!Boolean(dataIntervalStart) || !Boolean(dataIntervalEnd)) {
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
How can `dataIntervalStart` or `dataIntervalEnd` be malformed string ? (Date constructor as well as the input field should guarantee that we are manipulating a valid date / datetime I think, I might be missing something)
Is that to handle the case where `from_date` or `to_date` are `date` instead of `datetime` ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r2000469308
##########
airflow/ui/src/queries/useCreateBackfill.ts:
##########
@@ -50,7 +50,7 @@ export const useCreateBackfill = ({ onSuccessConfirm }: { onSuccessConfirm: () =
const dataIntervalEnd = new Date(data.requestBody.to_date);
const dagId = data.requestBody.dag_id;
- if (!Boolean(dataIntervalStart) || !Boolean(dataIntervalEnd)) {
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
How can `dataIntervalStart` or `dataIntervalEnd` be malformed string ?
Is that to handle the case where `from_date` or `to_date` are `date` instead of `datetime` ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "aritra24 (via GitHub)" <gi...@apache.org>.
aritra24 commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r2000089251
##########
airflow/ui/src/queries/useCreateBackfill.ts:
##########
@@ -50,7 +50,7 @@ export const useCreateBackfill = ({ onSuccessConfirm }: { onSuccessConfirm: () =
const dataIntervalEnd = new Date(data.requestBody.to_date);
const dagId = data.requestBody.dag_id;
- if (!Boolean(dataIntervalStart) || !Boolean(dataIntervalEnd)) {
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
Hi, so the output for date for a malformed string was a date object with invalid date, which when passed to Boolean would return true. So had to do it this way...
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "aritra24 (via GitHub)" <gi...@apache.org>.
aritra24 commented on code in PR #47790:
URL: https://github.com/apache/airflow/pull/47790#discussion_r2000957555
##########
airflow/ui/src/queries/useCreateBackfill.ts:
##########
@@ -50,7 +50,7 @@ export const useCreateBackfill = ({ onSuccessConfirm }: { onSuccessConfirm: () =
const dataIntervalEnd = new Date(data.requestBody.to_date);
const dagId = data.requestBody.dag_id;
- if (!Boolean(dataIntervalStart) || !Boolean(dataIntervalEnd)) {
+ if (isNaN(dataIntervalStart.getTime()) || isNaN(dataIntervalEnd.getTime())) {
Review Comment:
When I mention malformed here it can mostly only be either a date or an empty string (When no date is selected at start time), so I can maybe change the check to just a not empty string check...
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Adds validation on backfill dryrun [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #47790:
URL: https://github.com/apache/airflow/pull/47790
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org