You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amoghrajesh (via GitHub)" <gi...@apache.org> on 2023/06/12 06:44:55 UTC
[GitHub] [airflow-site] amoghrajesh opened a new pull request, #799: Extending the back reference script to support providers
amoghrajesh opened a new pull request, #799:
URL: https://github.com/apache/airflow-site/pull/799
With this change, this script can be used to generate back reference docs even for airflow providers
--
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
[GitHub] [airflow-site] potiuk merged pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #799:
URL: https://github.com/apache/airflow-site/pull/799
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1227679114
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +42,18 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
-
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with tempfile.TemporaryDirectory() as tmpdir:
+ temp_dir = Path(tmpdir)
+ file_name = temp_dir / "redirects.txt"
Review Comment:
The downloaded redirects.txt file will not be used - it is notpassed anywhere. I see that in case of construct_mapping method it still opens "current working dir" redirects.txt - which is not going to work - if you downliad the file here, it should be passed on to processing
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +42,18 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
-
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with tempfile.TemporaryDirectory() as tmpdir:
+ temp_dir = Path(tmpdir)
+ file_name = temp_dir / "redirects.txt"
Review Comment:
The downloaded redirects.txt file will not be used - it is notpassed anywhere. I see that in case of construct_mapping method it still opens "current working dir" redirects.txt - which is not going to work - if you download the file here, it should be passed on to processing
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226191142
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
Since we are downloading the redirects from GitHub already can we simply loop over all directories in "docs-archive" and react to 404 not found by skipping a provider? that should be pretty fast.
--
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
[GitHub] [airflow-site] amoghrajesh commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1227831891
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +42,18 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
-
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with tempfile.TemporaryDirectory() as tmpdir:
+ temp_dir = Path(tmpdir)
+ file_name = temp_dir / "redirects.txt"
Review Comment:
Thanks for the feedback. I realised this fault while testing and I have fixed it in the latest commit
--
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
[GitHub] [airflow-site] amoghrajesh commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226308179
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
Good idea. Missed that.
Yeah I agree with you on this, pushing a fix for that :)
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1227919698
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +42,18 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
-
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with tempfile.TemporaryDirectory() as tmpdir:
+ temp_dir = Path(tmpdir)
+ file_name = temp_dir / "redirects.txt"
Review Comment:
LGTM now!
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226347887
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +41,14 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
+ try:
+ filedata = urlopen(url)
+ datatowrite = filedata.read()
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with open('redirects.txt', 'wb') as f:
+ f.write(datatowrite)
+ except URLError as e:
+ log.warning(e)
Review Comment:
(I think what is going to happen with this version is that will keep on using the redirects.txt retrieved from previous successfully downloaded redirect.txt ? I guess it would be great to do three things:
1) make sure that the redirects.txt is named differently depending on a provider (just in case of programming mistakes)
2) store them somewhere where they will be deleted (tmp dir)
3) if download fails, skip the whole `generate_back_reference`
--
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
[GitHub] [airflow-site] amoghrajesh commented on pull request #799: Extending the back reference script to support providers
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #799:
URL: https://github.com/apache/airflow-site/pull/799#issuecomment-1588542107
@potiuk handled the following issues in the latest commit:
- Moved the redirects.txt to a temp directory, cleaning won't be an issue
- Skipping generation in case fetching of the file fails, ie: file doesn't exist, or if redirects are not applicable to that provider
This should handle most edge cases imo. Can you have a round of review when free?
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226194708
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
No need. Just list those folders in `docs-archive` and filter by `providers`
--
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
[GitHub] [airflow-site] potiuk commented on pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #799:
URL: https://github.com/apache/airflow-site/pull/799#issuecomment-1589045545
I guess time to incorporate it in provider's release docs @eladkal @amoghrajesh :)
--
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
[GitHub] [airflow-site] amoghrajesh commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226440500
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +41,14 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
+ try:
+ filedata = urlopen(url)
+ datatowrite = filedata.read()
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with open('redirects.txt', 'wb') as f:
+ f.write(datatowrite)
+ except URLError as e:
+ log.warning(e)
Review Comment:
Very good point. Will handle these points soon and re request for review :)
--
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
[GitHub] [airflow-site] amoghrajesh commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226193932
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
That was my initial idea too. But how do I get the list of directories in GitHub through my script?
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226194708
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
No need. Just list those in `docs-archive`
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226193545
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
Why: the less chance we have to forget to update something, the better. This is for example why in my in-progress PR about sbom generation, I initially had a hard-coded list of Airflow versions - but eventually I settled on retriving them from tags in the git remote "apache/airflow" repo:
https://github.com/apache/airflow/pull/31835/files#diff-54ea68b5e1e61ac0437df0ab7d99dc508595323b11847a957931e0d9007962d7R1241
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226343661
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +41,14 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
+ try:
+ filedata = urlopen(url)
+ datatowrite = filedata.read()
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with open('redirects.txt', 'wb') as f:
+ f.write(datatowrite)
+ except URLError as e:
+ log.warning(e)
Review Comment:
Should not we also skip generation in this case?
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226347887
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +41,14 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
+ try:
+ filedata = urlopen(url)
+ datatowrite = filedata.read()
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with open('redirects.txt', 'wb') as f:
+ f.write(datatowrite)
+ except URLError as e:
+ log.warning(e)
Review Comment:
(I think what is going to happen with this version is that will keep on using the redirects.txt retrieved from previous successfully downloaded redirect.txt ? I guess it would be great to do two things:
1) make sure that the redirects.txt is named differently depending on a provider (just in case of programming mistakes)
2) store them somewhere where they will be deleted (tmp dir)
3) if download fails, skip the whole `generate_back_reference`
--
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
[GitHub] [airflow-site] potiuk commented on pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #799:
URL: https://github.com/apache/airflow-site/pull/799#issuecomment-1590067514
Update steps t follow in in https://github.com/apache/airflow/blob/main/dev/README_RELEASE_PROVIDER_PACKAGES.md
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226194708
##########
post-docs/add-back-references.py:
##########
@@ -22,14 +22,30 @@
from urllib.request import urlopen
import semver
+log = logging.getLogger(__name__)
+
airflow_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/redirects.txt"
helm_redirects_link = "https://raw.githubusercontent.com/apache/airflow/main/docs/helm-chart/redirects.txt"
-providers_redirect_link = "populate-this"
docs_archive_path = "../docs-archive"
airflow_docs_path = docs_archive_path + "/apache-airflow"
helm_docs_path = docs_archive_path + "/helm-chart"
-providers_docs_path = docs_archive_path + "/apache-airflow-providers"
+
+# if any new provider is added with redirects, add it to this list
Review Comment:
No need. Just list those in `docs-archive` and filter by `providers`
--
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
[GitHub] [airflow-site] potiuk commented on a diff in pull request #799: Extending the back reference script to support providers
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #799:
URL: https://github.com/apache/airflow-site/pull/799#discussion_r1226347887
##########
post-docs/add-back-references.py:
##########
@@ -40,11 +41,14 @@ class GenerationType(enum.Enum):
def download_file(url):
- filedata = urlopen(url)
- datatowrite = filedata.read()
+ try:
+ filedata = urlopen(url)
+ datatowrite = filedata.read()
- with open('redirects.txt', 'wb') as f:
- f.write(datatowrite)
+ with open('redirects.txt', 'wb') as f:
+ f.write(datatowrite)
+ except URLError as e:
+ log.warning(e)
Review Comment:
(I think what is going to happen with this version is that will keep on using the redirects.txt retrieved from previous successfully downloaded redirect.txt ? I guess it would be great to do two things:
1) make sure that the redirects.txt is named differently depending on a provider (just in case of programming mistakes)
2) store them somewhere where they will be deleted (tmp dir)
3) if download fails, skip the whole `generate`
--
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
[GitHub] [airflow-site] amoghrajesh commented on pull request #799: Extending the back reference script to support providers
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #799:
URL: https://github.com/apache/airflow-site/pull/799#issuecomment-1589205585
Nice. How do we do that?
--
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