Skip to content

Commit

Permalink
feat(hydroflow): Re-introduced poll_futures as resolve_futures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Alameddine committed Feb 25, 2025
1 parent 0312da2 commit 62985b9
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 89 deletions.
4 changes: 2 additions & 2 deletions benches/benches/futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn benchmark_immediately_available(c: &mut Criterion) {
x
})
-> defer_tick()
-> poll_futures()
-> resolve_futures()
-> for_each(|_| {});
};

Expand Down Expand Up @@ -85,7 +85,7 @@ fn benchmark_delayed(c: &mut Criterion) {
let df = {
dfir_syntax! {
source_iter(futs)
-> poll_futures()
-> resolve_futures()
-> for_each(|_| {});
}
};
Expand Down
10 changes: 5 additions & 5 deletions dfir_lang/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N

### Reverted

- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183
This reverts commit 997d90a76db9a4e05dbac35073a09548750ce342.

We have been trying to figure out the semantics a bit, and want to give
Expand Down Expand Up @@ -415,9 +415,9 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N
<details><summary>view details</summary>

* **[#1143](https://github.com/hydro-project/hydroflow/issues/1143)**
- "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
- "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
* **[#1216](https://github.com/hydro-project/hydroflow/issues/1216)**
- "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
- "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
* **[#1260](https://github.com/hydro-project/hydroflow/issues/1260)**
- Test code snipets, generate output for `surface_flows`, fix #814 ([`2a4881d`](https://github.com/hydro-project/hydroflow/commit/2a4881d7c981bdf8f4deae9902e7d305f36c4203))
* **[#1266](https://github.com/hydro-project/hydroflow/issues/1266)**
Expand Down Expand Up @@ -472,7 +472,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N
- <csr-id-f184ea145f0c7c3072d7d0f94d42fcda717ac8d9/> insert `persist()` before singleton referencers to enable replay
- <csr-id-4ca8ce43c0998296e2d86bd74800585ebb24123a/> allow `defer_tick()`, `next_stratum()` to have a type hint arg
- <csr-id-9df9c6251526903dbe7288e2fd9a532c63a9412c/> error on unused ports, fix #1108
- <csr-id-997d90a76db9a4e05dbac35073a09548750ce342/> Added poll_futures and poll_futures_async operators.
- <csr-id-997d90a76db9a4e05dbac35073a09548750ce342/> Added resolve_futures and resolve_futures_async operators.
- <csr-id-29a263fb564c5ce4bc495ea4e9d20b8b2621b645/> add support for collecting counts and running perf

### Bug Fixes
Expand Down Expand Up @@ -523,7 +523,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N
<details><summary>view details</summary>

* **[#1143](https://github.com/hydro-project/hydroflow/issues/1143)**
- Added poll_futures and poll_futures_async operators. ([`997d90a`](https://github.com/hydro-project/hydroflow/commit/997d90a76db9a4e05dbac35073a09548750ce342))
- Added resolve_futures and resolve_futures_async operators. ([`997d90a`](https://github.com/hydro-project/hydroflow/commit/997d90a76db9a4e05dbac35073a09548750ce342))
* **[#1152](https://github.com/hydro-project/hydroflow/issues/1152)**
- Update some compile-fail outputs caused by rustc regression ([`d2427e2`](https://github.com/hydro-project/hydroflow/commit/d2427e2cc901c4174830d41b4a1dfc52fd4f19ce))
- Update pyo3, silence warnings in generated code ([`1801502`](https://github.com/hydro-project/hydroflow/commit/18015029a725b068696ed9edefd1097583c858a6))
Expand Down
4 changes: 2 additions & 2 deletions dfir_lang/src/graph/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ declare_ops![
persist_mut::PERSIST_MUT,
persist_mut_keyed::PERSIST_MUT_KEYED,
prefix::PREFIX,
poll_futures::POLL_FUTURES,
poll_futures_ordered::POLL_FUTURES_ORDERED,
resolve_futures::RESOLVE_FUTURES,
resolve_futures_ordered::RESOLVE_FUTURES_ORDERED,
py_udf::PY_UDF,
reduce::REDUCE,
spin::SPIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use super::{
OperatorCategory, OperatorConstraints, OperatorWriteOutput, WriteContextArgs, RANGE_0, RANGE_1
};

pub const POLL_FUTURES: OperatorConstraints = OperatorConstraints {
name: "poll_futures",
pub const RESOLVE_FUTURES: OperatorConstraints = OperatorConstraints {
name: "resolve_futures",
categories: &[OperatorCategory::Map],
hard_range_inn: RANGE_1,
soft_range_inn: RANGE_1,
Expand All @@ -21,13 +21,13 @@ pub const POLL_FUTURES: OperatorConstraints = OperatorConstraints {
ports_inn: None,
ports_out: None,
input_delaytype_fn: |_| None,
write_fn: move |wc, _| poll_futures_writer(
write_fn: move |wc, _| resolve_futures_writer(
Ident::new("FuturesUnordered", wc.op_span),
Ident::new("push", wc.op_span),
wc)
};

pub fn poll_futures_writer(future_type: Ident, push_fn: Ident, wc @ &WriteContextArgs {
pub fn resolve_futures_writer(future_type: Ident, push_fn: Ident, wc @ &WriteContextArgs {
root,
context,
op_span,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use syn::Ident;

use super::{
poll_futures::poll_futures_writer, OperatorCategory, OperatorConstraints, RANGE_0, RANGE_1
resolve_futures::resolve_futures_writer, OperatorCategory, OperatorConstraints, RANGE_0, RANGE_1
};

pub const POLL_FUTURES_ORDERED: OperatorConstraints = OperatorConstraints {
name: "poll_futures_ordered",
pub const RESOLVE_FUTURES_ORDERED: OperatorConstraints = OperatorConstraints {
name: "resolve_futures_ordered",
categories: &[OperatorCategory::Map],
hard_range_inn: RANGE_1,
soft_range_inn: RANGE_1,
Expand All @@ -20,7 +20,7 @@ pub const POLL_FUTURES_ORDERED: OperatorConstraints = OperatorConstraints {
ports_inn: None,
ports_out: None,
input_delaytype_fn: |_| None,
write_fn: move |wc, _| poll_futures_writer(Ident::new("FuturesOrdered", wc.op_span),
write_fn: move |wc, _| resolve_futures_writer(Ident::new("FuturesOrdered", wc.op_span),
Ident::new("push_back", wc.op_span),
wc)
};
10 changes: 5 additions & 5 deletions dfir_rs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N

### Reverted

- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183
This reverts commit 997d90a76db9a4e05dbac35073a09548750ce342.

We have been trying to figure out the semantics a bit, and want to give
Expand Down Expand Up @@ -479,9 +479,9 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N
<details><summary>view details</summary>

* **[#1143](https://github.com/hydro-project/hydroflow/issues/1143)**
- "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
- "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
* **[#1216](https://github.com/hydro-project/hydroflow/issues/1216)**
- "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
- "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
* **[#1244](https://github.com/hydro-project/hydroflow/issues/1244)**
- Make inner for `WithTop` & `WithBot` private ([`1ad690b`](https://github.com/hydro-project/hydroflow/commit/1ad690b993f38ac6a03667fdce56e6603076b1d2))
* **[#1260](https://github.com/hydro-project/hydroflow/issues/1260)**
Expand Down Expand Up @@ -553,7 +553,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N
- <csr-id-f184ea145f0c7c3072d7d0f94d42fcda717ac8d9/> insert `persist()` before singleton referencers to enable replay
- <csr-id-4ca8ce43c0998296e2d86bd74800585ebb24123a/> allow `defer_tick()`, `next_stratum()` to have a type hint arg
- <csr-id-9df9c6251526903dbe7288e2fd9a532c63a9412c/> error on unused ports, fix #1108
- <csr-id-997d90a76db9a4e05dbac35073a09548750ce342/> Added poll_futures and poll_futures_async operators.
- <csr-id-997d90a76db9a4e05dbac35073a09548750ce342/> Added resolve_futures and resolve_futures_async operators.

### Bug Fixes

Expand Down Expand Up @@ -611,7 +611,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N
* **[#1120](https://github.com/hydro-project/hydroflow/issues/1120)**
- Extend Chat Example w/ Gossip Based Backend ([`55051e1`](https://github.com/hydro-project/hydroflow/commit/55051e1c8db2ba8e36c6b6ed0e888996e9501f3f))
* **[#1143](https://github.com/hydro-project/hydroflow/issues/1143)**
- Added poll_futures and poll_futures_async operators. ([`997d90a`](https://github.com/hydro-project/hydroflow/commit/997d90a76db9a4e05dbac35073a09548750ce342))
- Added resolve_futures and resolve_futures_async operators. ([`997d90a`](https://github.com/hydro-project/hydroflow/commit/997d90a76db9a4e05dbac35073a09548750ce342))
* **[#1152](https://github.com/hydro-project/hydroflow/issues/1152)**
- Update some compile-fail outputs caused by rustc regression ([`d2427e2`](https://github.com/hydro-project/hydroflow/commit/d2427e2cc901c4174830d41b4a1dfc52fd4f19ce))
- Update pyo3, silence warnings in generated code ([`1801502`](https://github.com/hydro-project/hydroflow/commit/18015029a725b068696ed9edefd1097583c858a6))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn single_batch_test() {
sleep(Duration::from_millis(100)).await;
x
})
-> poll_futures()
-> resolve_futures()
-> for_each(|x| result_send.send(x).unwrap());
};

Expand Down Expand Up @@ -44,7 +44,7 @@ async fn multi_batch_test() {
sleep(Duration::from_millis(10*x)).await;
x
})
-> poll_futures()
-> resolve_futures()
-> for_each(|x| result_send.send(x).unwrap());
};

Expand Down Expand Up @@ -75,7 +75,7 @@ async fn pusherator_test() {
ins -> map(|x| async move {
sleep(Duration::from_millis(10*x)).await;
x
}) -> poll_futures() -> for_each(|x| result_send.send(x).unwrap());
}) -> resolve_futures() -> for_each(|x| result_send.send(x).unwrap());
};

let handle = tokio::task::spawn(async move {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn single_batch_test() {
sleep(Duration::from_millis(100)).await;
x
})
-> poll_futures_ordered()
-> resolve_futures_ordered()
-> for_each(|x| result_send.send(x).unwrap());
};

Expand Down Expand Up @@ -44,7 +44,7 @@ async fn multi_batch_test() {
sleep(Duration::from_millis(10*x)).await;
x
})
-> poll_futures_ordered()
-> resolve_futures_ordered()
-> for_each(|x| result_send.send(x).unwrap());
};

Expand Down Expand Up @@ -75,7 +75,7 @@ async fn pusherator_test() {
ins -> map(|x| async move {
sleep(Duration::from_millis(10*x)).await;
x
}) -> poll_futures_ordered() -> for_each(|x| result_send.send(x).unwrap());
}) -> resolve_futures_ordered() -> for_each(|x| result_send.send(x).unwrap());
};

let handle = tokio::task::spawn(async move {
Expand Down
10 changes: 5 additions & 5 deletions hydro_lang/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Reverted

- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183
This reverts commit 997d90a76db9a4e05dbac35073a09548750ce342.

We have been trying to figure out the semantics a bit, and want to give
Expand Down Expand Up @@ -1170,9 +1170,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary>

* **[#1143](https://github.com/hydro-project/hydroflow/issues/1143)**
- "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
- "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
* **[#1216](https://github.com/hydro-project/hydroflow/issues/1216)**
- "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
- "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 ([`256779a`](https://github.com/hydro-project/hydroflow/commit/256779abece03bee662b351430d27141d10bd5ef))
* **[#1295](https://github.com/hydro-project/hydroflow/issues/1295)**
- Require lifetime on `perist*()` operators ([`67c0e51`](https://github.com/hydro-project/hydroflow/commit/67c0e51fb25ea1a2e3aae197c1984920b46759fa))
* **Uncategorized**
Expand All @@ -1191,7 +1191,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- <csr-id-6e571726ff40818fbe9bbe9923511877c20fb243/> add API to get the cluster ID of the current node
feat(hydroflow_plus): add API to get the cluster ID of the current node
- <csr-id-997d90a76db9a4e05dbac35073a09548750ce342/> Added poll_futures and poll_futures_async operators.
- <csr-id-997d90a76db9a4e05dbac35073a09548750ce342/> Added resolve_futures and resolve_futures_async operators.
- <csr-id-c3f5a37ff746401a2383a900f9004e33072d5b1a/> add prototype of tagging algebraic properties
- <csr-id-29a263fb564c5ce4bc495ea4e9d20b8b2621b645/> add support for collecting counts and running perf

Expand All @@ -1216,7 +1216,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary>

* **[#1143](https://github.com/hydro-project/hydroflow/issues/1143)**
- Added poll_futures and poll_futures_async operators. ([`997d90a`](https://github.com/hydro-project/hydroflow/commit/997d90a76db9a4e05dbac35073a09548750ce342))
- Added resolve_futures and resolve_futures_async operators. ([`997d90a`](https://github.com/hydro-project/hydroflow/commit/997d90a76db9a4e05dbac35073a09548750ce342))
* **[#1151](https://github.com/hydro-project/hydroflow/issues/1151)**
- Handle send_bincode with local structs ([`0cafbdb`](https://github.com/hydro-project/hydroflow/commit/0cafbdb74a665412a83aa900b4eb10c00e2498dd))
* **[#1156](https://github.com/hydro-project/hydroflow/issues/1156)**
Expand Down
Loading

0 comments on commit 62985b9

Please sign in to comment.