Skip to content

Add td_format function and apply to Views duration column for better human readability - #20112

Merged
kaxil merged 6 commits into
apache:mainfrom
Acehaidrey:td_format
Dec 15, 2021
Merged

kaxil merged 6 commits into
apache:mainfrom
Acehaidrey:td_format

Conversation

@Acehaidrey

@Acehaidrey Acehaidrey commented Dec 7, 2021 •

Copy link
Copy Markdown
Contributor

This PR came out of the review for: #19921. There was a review for adding an updated view for displaying the duration column in a more readable way.

To be determined if the same application to the TI views are desired as this PR has done so. Otherwise this is just to be a tool to translate some timedelta, or float/int, into the smallest grouped unit of measure to declare how long the duration has been running.

One open question is, is it preferred to make it optionable to apply this change to display the duration as this readable way vs the original timedelta way.

image


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Screen Shot 2021-12-09 at 2 30 15 PM

@boring-cyborg boring-cyborg Bot added the area:webserver Webserver related Issues label Dec 7, 2021
@uranusjr

uranusjr commented Dec 8, 2021

Copy link
Copy Markdown
Member

Need to fix many errors in linters and tests

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

@uranusjr sorry I didn't realize it created PR already. Working on it now!

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

@uranusjr - I don't know what is going on with my build but these import failures of Union I don't have locally. I've tried a few things but can't get this happening on mine. Mind verifying if you apply this change do you see same thing?

@uranusjr

uranusjr commented Dec 9, 2021

Copy link
Copy Markdown
Member

Your local code is different from the code in the PR. The error is pretty straightforward; Union is not imported in timezone.py, so Python errors.

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

@uranusjr oh my God, I am sorry, yes locally I have it imported. But I also merged the code. Let me pull it down. Something is off in my local -

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

@bbovenzi mind looking?

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. I'm wondering if we should do a 01:00:02 format instead. It would be more compact. In the react tree view we even add a day count like 5d01:00:02. That seems readable to me but I'm open to suggestions.

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

@bbovenzi when you recommend that format, 01:00:02 that is what it currently is. That is how the timedeltas look right now if I'm not mistaken. Unless you are looking for something that goes 5d:4h:32m:45s is that what you're recommending?

I'd like to get this in as soon as possible this week so if you don't mind quickly iterating with me to complete the ask.

@kaxil

kaxil commented Dec 14, 2021

Copy link
Copy Markdown
Member

@bbovenzi when you recommend that format, 01:00:02 that is what it currently is. That is how the timedeltas look right now if I'm not mistaken. Unless you are looking for something that goes 5d:4h:32m:45s is that what you're recommending?

I'd like to get this in as soon as possible this week so if you don't mind quickly iterating with me to complete the ask.

01:00:02 vs '1 hour, 2 seconds' (this is what the PR does currently, no?). I think that is what Brent is suggesting.

I am fine with either, I don't have a strong opinion on it.

@kaxil kaxil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic wise looks good to me. I defer to @bbovenzi on the exact format

@kaxil

kaxil commented Dec 14, 2021

Copy link
Copy Markdown
Member

One open question is, is it preferred to make it optionable to apply this change to display the duration as this readable way vs the original timedelta way.

hmm, maybe a config or a profile setting -- not sure @bbovenzi @ryanahamilton thoughts?

@github-actions

Copy link
Copy Markdown
Contributor

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions Bot added the full tests needed We need to run full set of tests for this PR to merge label Dec 14, 2021
@bbovenzi

Copy link
Copy Markdown
Contributor

Good question. Let's go for 5d:4h:32m:45s and I can update other parts of the app in a subsequent pr

@Acehaidrey

Copy link
Copy Markdown
Contributor Author

Thanks for the discussion. I've just made some updates here, waiting for tests to pass then will burden you with review :)

@kaxil
kaxil merged commit 2d9338f into apache:main Dec 15, 2021
@jedcunningham jedcunningham added this to the Airflow 2.3.0 milestone Dec 21, 2021
@jedcunningham jedcunningham added the type:improvement Changelog: Improvements label Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webserver Webserver related Issues full tests needed We need to run full set of tests for this PR to merge type:improvement Changelog: Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants