chalk-remote-call-python 1.10.13__tar.gz → 1.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. {chalk_remote_call_python-1.10.13/chalk_remote_call_python.egg-info → chalk_remote_call_python-1.11.0}/PKG-INFO +1 -1
  2. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/Cargo.lock +2 -1
  3. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.rs +10 -1
  4. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/descriptor.bin +0 -0
  5. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml +2 -1
  6. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/fnq_client.rs +39 -15
  7. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/self_consumer.rs +263 -147
  8. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/server.rs +31 -6
  9. chalk_remote_call_python-1.11.0/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2.py +52 -0
  10. chalk_remote_call_python-1.11.0/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2.py +103 -0
  11. chalk_remote_call_python-1.11.0/chalk_remote_call/_version.py +1 -0
  12. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/servicer.py +7 -1
  13. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/tracing.py +45 -0
  14. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0/chalk_remote_call_python.egg-info}/PKG-INFO +1 -1
  15. chalk_remote_call_python-1.10.13/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2.py +0 -53
  16. chalk_remote_call_python-1.10.13/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2.py +0 -104
  17. chalk_remote_call_python-1.10.13/chalk_remote_call/_version.py +0 -1
  18. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/MANIFEST.in +0 -0
  19. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/README.md +0 -0
  20. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/Cargo.toml +0 -0
  21. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/Cargo.toml +0 -0
  22. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.auth.v1.rs +0 -0
  23. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.common.v1.rs +0 -0
  24. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.tonic.rs +0 -0
  25. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.utils.v1.rs +0 -0
  26. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-proto/src/lib.rs +0 -0
  27. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/build.rs +0 -0
  28. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/async_service.rs +0 -0
  29. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/coalesce.rs +0 -0
  30. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/lib.rs +0 -0
  31. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/metrics.rs +0 -0
  32. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/python_bridge.rs +0 -0
  33. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/chalk-remote-call-server/src/service.rs +0 -0
  34. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk-remote-call-rs/rust-toolchain.toml +0 -0
  35. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/__init__.py +0 -0
  36. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/__main__.py +0 -0
  37. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/__init__.py +0 -0
  38. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/__init__.py +0 -0
  39. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/auth/__init__.py +0 -0
  40. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/auth/v1/__init__.py +0 -0
  41. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2.py +0 -0
  42. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2_grpc.py +0 -0
  43. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/common/__init__.py +0 -0
  44. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/common/v1/__init__.py +0 -0
  45. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2.py +0 -0
  46. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2_grpc.py +0 -0
  47. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/runtime/__init__.py +0 -0
  48. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/runtime/v1/__init__.py +0 -0
  49. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2_grpc.py +0 -0
  50. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2_grpc.py +0 -0
  51. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/__init__.py +0 -0
  52. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/__init__.py +0 -0
  53. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2.py +0 -0
  54. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2_grpc.py +0 -0
  55. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2.py +0 -0
  56. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2_grpc.py +0 -0
  57. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/large_pb2.py +0 -0
  58. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/large_pb2_grpc.py +0 -0
  59. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2.py +0 -0
  60. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2_grpc.py +0 -0
  61. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/_native.pyi +0 -0
  62. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/arrow_utils.py +0 -0
  63. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/cli.py +0 -0
  64. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/errors.py +0 -0
  65. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/handler_loader.py +0 -0
  66. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/input_transform.py +0 -0
  67. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/logging.py +0 -0
  68. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call/server.py +0 -0
  69. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call_python.egg-info/SOURCES.txt +0 -0
  70. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call_python.egg-info/dependency_links.txt +0 -0
  71. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call_python.egg-info/entry_points.txt +0 -0
  72. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call_python.egg-info/requires.txt +0 -0
  73. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/chalk_remote_call_python.egg-info/top_level.txt +0 -0
  74. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/pyproject.toml +0 -0
  75. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/setup.cfg +0 -0
  76. {chalk_remote_call_python-1.10.13 → chalk_remote_call_python-1.11.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalk-remote-call-python
3
- Version: 1.10.13
3
+ Version: 1.11.0
4
4
  Summary: Chalk remote call Python runtime interface client
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -511,7 +511,7 @@ dependencies = [
511
511
  [[package]]
512
512
  name = "chalk-queue"
513
513
  version = "0.0.0"
514
- source = "git+https://github.com/chalk-ai/chalk-private.git?rev=61b67cc862036cfee5346807de1f24415a5fbfba#61b67cc862036cfee5346807de1f24415a5fbfba"
514
+ source = "git+https://github.com/chalk-ai/chalk-private.git?rev=31fb37c162671d3a838a7c33e717a0a425466790#31fb37c162671d3a838a7c33e717a0a425466790"
515
515
  dependencies = [
516
516
  "base64 0.22.1",
517
517
  "redis",
@@ -547,6 +547,7 @@ dependencies = [
547
547
  "dashmap 5.5.3",
548
548
  "futures-util",
549
549
  "prost 0.13.5",
550
+ "prost-types 0.13.5",
550
551
  "pyo3",
551
552
  "pyo3-build-config",
552
553
  "redis",
@@ -309,6 +309,12 @@ pub struct FunctionCallInfo {
309
309
  /// When the latest authorized attempt was dispatched to a worker.
310
310
  #[prost(message, optional, tag="9")]
311
311
  pub last_attempt_at: ::core::option::Option<::prost_types::Timestamp>,
312
+ /// Initial Stream queue wait; absent before delivery or when unavailable.
313
+ #[prost(message, optional, tag="11")]
314
+ pub queue_duration: ::core::option::Option<::prost_types::Duration>,
315
+ /// Final-attempt worker processing time, including batching wait; matches the call duration metric.
316
+ #[prost(message, optional, tag="12")]
317
+ pub call_duration: ::core::option::Option<::prost_types::Duration>,
312
318
  }
313
319
  /// Request the most recent calls to a given function.
314
320
  #[allow(clippy::derive_partial_eq_without_eq)]
@@ -494,6 +500,9 @@ pub struct ReportResultsRequest {
494
500
  /// Links this execution's trace to the call's history.
495
501
  #[prost(string, tag="3")]
496
502
  pub processing_trace_id: ::prost::alloc::string::String,
503
+ /// Worker-measured call duration; present only on terminal end/error reports.
504
+ #[prost(message, optional, tag="8")]
505
+ pub call_duration: ::core::option::Option<::prost_types::Duration>,
497
506
  #[prost(oneof="report_results_request::Result", tags="4, 5, 6, 7")]
498
507
  pub result: ::core::option::Option<report_results_request::Result>,
499
508
  }
@@ -521,4 +530,4 @@ pub mod report_results_request {
521
530
  pub struct ReportResultsResponse {
522
531
  }
523
532
  include!("chalk.runtime.v1.tonic.rs");
524
- // @@protoc_insertion_point(module)
533
+ // @@protoc_insertion_point(module)
@@ -22,6 +22,7 @@ tonic = { version = "0.12", features = ["tls", "tls-native-roots"] }
22
22
  tonic-health = "0.12"
23
23
  tonic-reflection = "0.12"
24
24
  prost = "0.13"
25
+ prost-types = "0.13"
25
26
  tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "signal", "time", "fs"] }
26
27
  tokio-stream = "0.1"
27
28
  arrow = { version = "54", default-features = false, features = ["ipc"] }
@@ -45,7 +46,7 @@ futures-util = "0.3"
45
46
  # `[patch.crates-io]` here it builds against vanilla crates.io redis (it only
46
47
  # uses standard APIs). Metrics and StatsD share a revision so their client types agree.
47
48
  [target.'cfg(target_os = "linux")'.dependencies]
48
- chalk-queue = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "61b67cc862036cfee5346807de1f24415a5fbfba" }
49
+ chalk-queue = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "31fb37c162671d3a838a7c33e717a0a425466790" }
49
50
  chalk_metrics = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "a0f8932ec10d3b8340af3e98cf63b800d60b4926" }
50
51
  chalk_statsd = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "a0f8932ec10d3b8340af3e98cf63b800d60b4926" }
51
52
 
@@ -9,6 +9,7 @@ use chalk_remote_call_proto::chalk::runtime::v1::fnq_consumer_service_client::Fn
9
9
  use chalk_remote_call_proto::chalk::runtime::v1::{
10
10
  AcquireWorkRequest, FnqWork, RenewWorkRequest, ReportResultsRequest,
11
11
  };
12
+ use tokio::sync::watch;
12
13
  use tonic::transport::{Channel, ClientTlsConfig, Endpoint};
13
14
  use tonic::{Request, Status};
14
15
 
@@ -62,6 +63,7 @@ impl FnqClient {
62
63
  pub async fn acquire(
63
64
  &self,
64
65
  request: AcquireWorkRequest,
66
+ shutdown: &mut watch::Receiver<bool>,
65
67
  mut dispatch: impl FnMut(FnqWork),
66
68
  ) -> Result<usize, Status> {
67
69
  let started = Instant::now();
@@ -69,33 +71,51 @@ impl FnqClient {
69
71
  let mut delivered = HashSet::new();
70
72
  let mut backoff = Duration::from_millis(200);
71
73
  loop {
74
+ if *shutdown.borrow() {
75
+ return Ok(delivered.len());
76
+ }
72
77
  if started.elapsed() >= retry_window {
73
78
  return Err(Status::failed_precondition(
74
79
  "Fnq acquisition replay window expired",
75
80
  ));
76
81
  }
77
82
  let result = async {
78
- let mut stream = self
79
- .client
80
- .clone()
81
- .acquire_work(self.request(request.clone()).await?)
82
- .await?
83
- .into_inner();
83
+ let response = tokio::select! {
84
+ biased;
85
+ _ = shutdown.changed() => return Ok(delivered.len()),
86
+ response = async {
87
+ self.client
88
+ .clone()
89
+ .acquire_work(self.request(request.clone()).await?)
90
+ .await
91
+ } => response?,
92
+ };
93
+ let mut stream = response.into_inner();
84
94
 
85
- while let Some(response) =
86
- tokio::time::timeout(Duration::from_secs(5), stream.message())
87
- .await
88
- .map_err(|_| {
89
- Status::deadline_exceeded("Fnq acquisition stream stalled")
90
- })??
91
- {
95
+ loop {
96
+ if *shutdown.borrow() {
97
+ return Ok(delivered.len());
98
+ }
99
+ let response = tokio::select! {
100
+ biased;
101
+ _ = shutdown.changed() => return Ok(delivered.len()),
102
+ response = tokio::time::timeout(Duration::from_secs(5), stream.message()) => {
103
+ response.map_err(|_| {
104
+ Status::deadline_exceeded("Fnq acquisition stream stalled")
105
+ })??
106
+ },
107
+ };
108
+ let Some(mut response) = response else {
109
+ break;
110
+ };
111
+ // Once received, validate and dispatch this delivery before
112
+ // observing shutdown so the caller can drain its work.
92
113
  // Redis's recorded deadline accounts for transit time. Renew
93
114
  // before dispatch if less than half the requested lease remains.
94
115
  let now = std::time::SystemTime::now()
95
116
  .duration_since(std::time::UNIX_EPOCH)
96
117
  .map_err(|_| Status::internal("system clock before Unix epoch"))?
97
118
  .as_millis() as i128;
98
- let mut response = response;
99
119
  if let Some(work) = response
100
120
  .work
101
121
  .as_mut()
@@ -140,7 +160,11 @@ impl FnqClient {
140
160
  ));
141
161
  }
142
162
  tracing::warn!(%error, "Fnq acquisition failed; retrying the same request");
143
- tokio::time::sleep(backoff).await;
163
+ tokio::select! {
164
+ biased;
165
+ _ = shutdown.changed() => return Ok(delivered.len()),
166
+ _ = tokio::time::sleep(backoff) => {},
167
+ }
144
168
  backoff = (backoff * 2).min(Duration::from_secs(2));
145
169
  }
146
170
  Err(error) => return Err(error),