You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Ma77Ball (via GitHub)" <gi...@apache.org> on 2026/06/13 01:20:38 UTC

[PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Ma77Ball opened a new pull request, #5667:
URL: https://github.com/apache/texera/pull/5667

   ### What changes were proposed in this PR?
   - Route `DatasetFileDocument`'s presigned-URL fetch and file download through a `requests.Session` with a `(10s connect, 60s read)` timeout, so a hung or unreachable file-service fails in bounded time instead of blocking the worker thread forever.
   - Mount a `urllib3` `Retry` policy on the session (3 retries, exponential backoff, retrying on connection errors and 5xx); both calls are idempotent GETs, so retrying is safe.
   ### Any related issues, documentation, discussions?
   Closes: #5666
   ### How was this PR tested?
   - Hardening change with no existing spec for this path; verified manually by loading the module and asserting the retry policy is wired (total=3, backoff=0.5, status_forcelist={500,502,503,504}, GET-only).
   - Confirmed a request to a non-routable host now fails in bounded time (ConnectTimeout) rather than hanging, where the old no-timeout call would block indefinitely.
   - `ruff check` and `ruff format --check` pass on the modified file.
   ### Was this PR authored or co-authored using generative AI tooling?
   Co-authored with Claude Opus 4.8 in compliance with ASF
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "chenlica (via GitHub)" <gi...@apache.org>.
chenlica commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4760873032

   @Yicong-Huang and @bobbai00?


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4753718959

   Good catch, thanks! Updated the description to match the code's `(5s connect, 10s read)` and added a note clarifying the read timeout bounds inactivity between bytes (not total download time), so it's safe for large dataset files.


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang commented on code in PR #5667:
URL: https://github.com/apache/texera/pull/5667#discussion_r3418901133


##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry

Review Comment:
   I checked we did not require `urllib3` as a dependency, it was available due to a transitive dependency from `requests`.
   
   we should not import a transitive dependency directly: if we import something then it is our dependency.
   
   I think there are two ways to go:
   1. we can add `urllib3` to dependency, officially. This actually might be a good idea for the long run.
   2. the retry logic can be quite simple to implement with vanilla  python try catch, we could do it without `urllib3`. 
   
   I would recommend 1 in this case.



##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
 
 
 class DatasetFileDocument:
+    # (connect, read) timeout and retry settings for the file-service GETs below.
+    _CONNECT_TIMEOUT_SECONDS = 10
+    _READ_TIMEOUT_SECONDS = 60
+    _REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+    _MAX_RETRIES = 3
+    _RETRY_BACKOFF_FACTOR = 0.5
+    _RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+    @classmethod
+    def _build_session(cls) -> requests.Session:

Review Comment:
   if you are using this session only for retry, as you mentioned in the doc string, it might be better to rename it `_retry_session()`
   
   and use with 
   
   ```
   with _retry_session() as session:
        // your logic
   ```



##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
 
 
 class DatasetFileDocument:
+    # (connect, read) timeout and retry settings for the file-service GETs below.
+    _CONNECT_TIMEOUT_SECONDS = 10
+    _READ_TIMEOUT_SECONDS = 60

Review Comment:
   I feel generally we can use a shorter timeout. if retry 3 times with 60s each that's already 3 minutes. let's make it a few seconds or shorter?



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4700866890

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/5667?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 52.76%. Comparing base ([`aca41f3`](https://app.codecov.io/gh/apache/texera/commit/aca41f3cb79b3330f4a744504b349b479a645fa2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`df4a363`](https://app.codecov.io/gh/apache/texera/commit/df4a3632170731b108f0b343336bc91386059bbe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main    #5667      +/-   ##
   ============================================
   - Coverage     52.85%   52.76%   -0.09%     
   + Complexity     2620     2506     -114     
   ============================================
     Files          1090     1090              
     Lines         42176    42098      -78     
     Branches       4531     4525       -6     
   ============================================
   - Hits          22293    22214      -79     
   + Misses        18573    18572       -1     
   - Partials       1310     1312       +2     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.42% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.36% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.59% <ø> (-0.28%)` | :arrow_down: | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `1.65% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.71% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.06% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.93% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `90.76% <100.00%> (+0.03%)` | :arrow_up: | |
   | [python](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `90.74% <ø> (-0.01%)` | :arrow_down: | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/5667/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `58.69% <ø> (ø)` | | Carriedforward from [a044287](https://app.codecov.io/gh/apache/texera/commit/a0442876321ede19fe7f33e57c1f7b277c09e3ba?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/5667?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4702304531

   @Yicong-Huang would you be able to review this when you get a chance? It hardens `DatasetFileDocument`'s file-service requests with bounded timeouts, GET-only retries, and uniform `RuntimeError` failures (you authored this module originally, so you have the most context here). Thanks!


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4753722023

   @Yicong-Huang or @bobbai00, can you merge this pr? 


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4762884097

   Backport to [`release/v1.2`](https://github.com/apache/texera/tree/release/v1.2) succeeded as [`50051ad`](https://github.com/apache/texera/commit/50051ad11e30f12dfb31db548c97bb1919bf90ed). [Run](https://github.com/apache/texera/actions/runs/27913396170)


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4696945384

   <!-- texera-benchmarks-comment -->
   ## ⚠️ Benchmark changes need a look
   
   🟢 10 better · 🔴 5 worse · ⚪ 0 noise (<±5%) · 0 without baseline
   
   > CI benchmark results are noisy; treat <±5% as noise unless repeated.
   
   [Dashboard](https://apache.github.io/texera/dev/bench/) · [Run](https://github.com/apache/texera/actions/runs/27452281754)
   
   | | config | throughput | MB/s | latency | max Δ latest / 7d |
   |---|---|---:|---:|---:|---:|
   | 🔴 | bs=10 sw=10 sl=64 | 345 | 0.211 | 28,712/42,848/42,848 us | 🔴 +15.8% / 🔴 +19.0% |
   | 🟢 | bs=100 sw=10 sl=64 | 934 | 0.57 | 106,261/127,204/127,204 us | 🟢 +28.1% / 🟢 -10.6% |
   | 🟢 | bs=1000 sw=10 sl=64 | 1,078 | 0.658 | 926,607/955,061/955,061 us | 🟢 +13.9% / 🟢 -8.7% |
   
   <details><summary>Baseline details</summary>
   
   Latest main `7ae9b35` from 2026-06-13T00:44:28.840Z
   
   | config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
   |---|---|---:|---:|---:|---:|---:|
   | bs=10 sw=10 sl=64 | throughput | 345 tuples/sec | 394.18 tuples/sec | 400.34 tuples/sec | -12.5% | -13.8% |
   | bs=10 sw=10 sl=64 | MB/s | 0.211 MB/s | 0.241 MB/s | 0.244 MB/s | -12.3% | -13.6% |
   | bs=10 sw=10 sl=64 | p50 | 28,712 us | 24,805 us | 24,191 us | +15.8% | +18.7% |
   | bs=10 sw=10 sl=64 | p95 | 42,848 us | 38,345 us | 36,018 us | +11.7% | +19.0% |
   | bs=10 sw=10 sl=64 | p99 | 42,848 us | 38,345 us | 36,018 us | +11.7% | +19.0% |
   | bs=100 sw=10 sl=64 | throughput | 934 tuples/sec | 729.17 tuples/sec | 867.19 tuples/sec | +28.1% | +7.7% |
   | bs=100 sw=10 sl=64 | MB/s | 0.57 MB/s | 0.445 MB/s | 0.529 MB/s | +28.1% | +7.7% |
   | bs=100 sw=10 sl=64 | p50 | 106,261 us | 133,219 us | 114,874 us | -20.2% | -7.5% |
   | bs=100 sw=10 sl=64 | p95 | 127,204 us | 173,178 us | 142,264 us | -26.5% | -10.6% |
   | bs=100 sw=10 sl=64 | p99 | 127,204 us | 173,178 us | 142,264 us | -26.5% | -10.6% |
   | bs=1000 sw=10 sl=64 | throughput | 1,078 tuples/sec | 946.3 tuples/sec | 1,010 tuples/sec | +13.9% | +6.8% |
   | bs=1000 sw=10 sl=64 | MB/s | 0.658 MB/s | 0.578 MB/s | 0.616 MB/s | +13.9% | +6.8% |
   | bs=1000 sw=10 sl=64 | p50 | 926,607 us | 1,059,718 us | 995,071 us | -12.6% | -6.9% |
   | bs=1000 sw=10 sl=64 | p95 | 955,061 us | 1,104,221 us | 1,046,228 us | -13.5% | -8.7% |
   | bs=1000 sw=10 sl=64 | p99 | 955,061 us | 1,104,221 us | 1,046,228 us | -13.5% | -8.7% |
   
   </details>
   
   <details><summary>Raw CSV</summary>
   
   ```csv
   config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
   0,10,10,64,20,579.39,200,128000,345,0.211,28712.36,42847.74,42847.74
   1,100,10,64,20,2140.63,2000,1280000,934,0.570,106260.80,127203.59,127203.59
   2,1000,10,64,20,18560.83,20000,12800000,1078,0.658,926607.17,955060.76,955060.76
   ```
   
   </details>
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on code in PR #5667:
URL: https://github.com/apache/texera/pull/5667#discussion_r3424323473


##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry

Review Comment:
   Done. Added `urllib3==2.7.0` and `requests==2.34.0` to `requirements.txt`, pinned to the lock versions. `requests` was also imported directly but only transitive, so made it explicit too.



##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
 
 
 class DatasetFileDocument:
+    # (connect, read) timeout and retry settings for the file-service GETs below.
+    _CONNECT_TIMEOUT_SECONDS = 10
+    _READ_TIMEOUT_SECONDS = 60
+    _REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+    _MAX_RETRIES = 3
+    _RETRY_BACKOFF_FACTOR = 0.5
+    _RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+    @classmethod
+    def _build_session(cls) -> requests.Session:

Review Comment:
   Done, renamed to `_retry_session()`. Both call sites already use `with self._retry_session() as session:`.



##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
 
 
 class DatasetFileDocument:
+    # (connect, read) timeout and retry settings for the file-service GETs below.
+    _CONNECT_TIMEOUT_SECONDS = 10
+    _READ_TIMEOUT_SECONDS = 60

Review Comment:
   Done. Now connect 5s / read 10s (was 10s/60s); worst case ~48s vs ~3min. Read timeout bounds inactivity between bytes, not total download, so still safe for large files.



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang commented on code in PR #5667:
URL: https://github.com/apache/texera/pull/5667#discussion_r3418836085


##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,6 +19,34 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
+
+# (connect, read) timeout and retry settings for the file-service GETs below.
+_CONNECT_TIMEOUT_SECONDS = 10
+_READ_TIMEOUT_SECONDS = 60
+_REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+_MAX_RETRIES = 3
+_RETRY_BACKOFF_FACTOR = 0.5
+_RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+
+def _build_session() -> requests.Session:
+    """Returns a Session that retries GETs on connection errors and 5xx."""
+    retry = Retry(
+        total=_MAX_RETRIES,
+        connect=_MAX_RETRIES,
+        read=_MAX_RETRIES,
+        backoff_factor=_RETRY_BACKOFF_FACTOR,
+        status_forcelist=_RETRY_STATUS_FORCELIST,
+        allowed_methods=frozenset({"GET"}),
+        raise_on_status=False,
+    )
+    adapter = HTTPAdapter(max_retries=retry)
+    session = requests.Session()
+    session.mount("http://", adapter)
+    session.mount("https://", adapter)
+    return session

Review Comment:
   thanks!



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang commented on code in PR #5667:
URL: https://github.com/apache/texera/pull/5667#discussion_r3448848279


##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,9 +19,37 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry

Review Comment:
   sg, thanks!



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on code in PR #5667:
URL: https://github.com/apache/texera/pull/5667#discussion_r3412650581


##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,6 +19,34 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
+
+# (connect, read) timeout and retry settings for the file-service GETs below.
+_CONNECT_TIMEOUT_SECONDS = 10
+_READ_TIMEOUT_SECONDS = 60
+_REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+_MAX_RETRIES = 3
+_RETRY_BACKOFF_FACTOR = 0.5
+_RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+
+def _build_session() -> requests.Session:
+    """Returns a Session that retries GETs on connection errors and 5xx."""
+    retry = Retry(
+        total=_MAX_RETRIES,
+        connect=_MAX_RETRIES,
+        read=_MAX_RETRIES,
+        backoff_factor=_RETRY_BACKOFF_FACTOR,
+        status_forcelist=_RETRY_STATUS_FORCELIST,
+        allowed_methods=frozenset({"GET"}),
+        raise_on_status=False,
+    )
+    adapter = HTTPAdapter(max_retries=retry)
+    session = requests.Session()
+    session.mount("http://", adapter)
+    session.mount("https://", adapter)
+    return session

Review Comment:
   Done: moved the timeout/retry constants and `_build_session` into `DatasetFileDocument` (class attributes + `@classmethod`), so no module-level state remains.



##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,6 +19,34 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
+
+# (connect, read) timeout and retry settings for the file-service GETs below.
+_CONNECT_TIMEOUT_SECONDS = 10
+_READ_TIMEOUT_SECONDS = 60
+_REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+_MAX_RETRIES = 3
+_RETRY_BACKOFF_FACTOR = 0.5
+_RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+
+def _build_session() -> requests.Session:
+    """Returns a Session that retries GETs on connection errors and 5xx."""
+    retry = Retry(
+        total=_MAX_RETRIES,
+        connect=_MAX_RETRIES,
+        read=_MAX_RETRIES,
+        backoff_factor=_RETRY_BACKOFF_FACTOR,
+        status_forcelist=_RETRY_STATUS_FORCELIST,
+        allowed_methods=frozenset({"GET"}),
+        raise_on_status=False,
+    )
+    adapter = HTTPAdapter(max_retries=retry)
+    session = requests.Session()
+    session.mount("http://", adapter)
+    session.mount("https://", adapter)
+    return session

Review Comment:
   Yes: `requests.get()` has no retry option; urllib3's `Retry` only applies when mounted as an `HTTPAdapter` on a `Session`. The alternative is a manual retry loop. Open to other approaches.



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "bobbai00 (via GitHub)" <gi...@apache.org>.
bobbai00 commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4725941522

   
     The PR description says (10s connect, 60s read), but the code sets (5s connect, 10s read):
     
     _CONNECT_TIMEOUT_SECONDS = 5
     _READ_TIMEOUT_SECONDS = 10
   
     The actual values are reasonable — could you update the description to match? A note that the 10s read timeout bounds inactivity-between-bytes (not total download time) would also help future readers
     understand why it's safe for large dataset files.


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang commented on code in PR #5667:
URL: https://github.com/apache/texera/pull/5667#discussion_r3411501975


##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,6 +19,34 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
+
+# (connect, read) timeout and retry settings for the file-service GETs below.
+_CONNECT_TIMEOUT_SECONDS = 10
+_READ_TIMEOUT_SECONDS = 60
+_REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+_MAX_RETRIES = 3
+_RETRY_BACKOFF_FACTOR = 0.5
+_RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+
+def _build_session() -> requests.Session:
+    """Returns a Session that retries GETs on connection errors and 5xx."""
+    retry = Retry(
+        total=_MAX_RETRIES,
+        connect=_MAX_RETRIES,
+        read=_MAX_RETRIES,
+        backoff_factor=_RETRY_BACKOFF_FACTOR,
+        status_forcelist=_RETRY_STATUS_FORCELIST,
+        allowed_methods=frozenset({"GET"}),
+        raise_on_status=False,
+    )
+    adapter = HTTPAdapter(max_retries=retry)
+    session = requests.Session()
+    session.mount("http://", adapter)
+    session.mount("https://", adapter)
+    return session

Review Comment:
   do we need a session just to do retry?



##########
amber/src/main/python/pytexera/storage/dataset_file_document.py:
##########
@@ -19,6 +19,34 @@
 import os
 import requests
 import urllib.parse
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
+
+# (connect, read) timeout and retry settings for the file-service GETs below.
+_CONNECT_TIMEOUT_SECONDS = 10
+_READ_TIMEOUT_SECONDS = 60
+_REQUEST_TIMEOUT = (_CONNECT_TIMEOUT_SECONDS, _READ_TIMEOUT_SECONDS)
+_MAX_RETRIES = 3
+_RETRY_BACKOFF_FACTOR = 0.5
+_RETRY_STATUS_FORCELIST = (500, 502, 503, 504)
+
+
+def _build_session() -> requests.Session:
+    """Returns a Session that retries GETs on connection errors and 5xx."""
+    retry = Retry(
+        total=_MAX_RETRIES,
+        connect=_MAX_RETRIES,
+        read=_MAX_RETRIES,
+        backoff_factor=_RETRY_BACKOFF_FACTOR,
+        status_forcelist=_RETRY_STATUS_FORCELIST,
+        allowed_methods=frozenset({"GET"}),
+        raise_on_status=False,
+    )
+    adapter = HTTPAdapter(max_retries=retry)
+    session = requests.Session()
+    session.mount("http://", adapter)
+    session.mount("https://", adapter)
+    return session

Review Comment:
   move those into singleton class? I want to avoid global module level instances and methods.



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang merged PR #5667:
URL: https://github.com/apache/texera/pull/5667


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(amber): add timeout and retry to dataset file-service requests [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang commented on PR #5667:
URL: https://github.com/apache/texera/pull/5667#issuecomment-4702342130

   Sure. Adding @bobbai00 as well PTAL


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org