Skip to content

Commit e18982e

Browse files
authored
Fix missing info on slot reservation context (#900)
1 parent 69c513c commit e18982e

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

core-api/src/worker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ pub trait SlotReservationContext: Send + Sync {
331331
/// Returns the identity of the worker
332332
fn worker_identity(&self) -> &str;
333333

334+
/// Returns the deployment version of the worker, if one is set.
335+
fn worker_deployment_version(&self) -> &Option<WorkerDeploymentVersion>;
336+
334337
/// Returns the number of currently outstanding slot permits, whether used or un-used.
335338
fn num_issued_slots(&self) -> usize;
336339

core/src/abstractions.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
};
1313
use temporal_sdk_core_api::worker::{
1414
SlotKind, SlotMarkUsedContext, SlotReleaseContext, SlotReservationContext, SlotSupplier,
15-
SlotSupplierPermit, WorkflowSlotKind,
15+
SlotSupplierPermit, WorkerDeploymentVersion, WorkflowSlotKind,
1616
};
1717
use tokio::sync::watch;
1818
use tokio_util::sync::CancellationToken;
@@ -47,6 +47,7 @@ pub(crate) struct MeteredPermitDealer<SK: SlotKind> {
4747
pub(crate) struct PermitDealerContextData {
4848
pub(crate) task_queue: String,
4949
pub(crate) worker_identity: String,
50+
pub(crate) worker_deployment_version: Option<WorkerDeploymentVersion>,
5051
}
5152

5253
impl<SK> MeteredPermitDealer<SK>
@@ -170,6 +171,10 @@ impl<SK: SlotKind> SlotReservationContext for MeteredPermitDealer<SK> {
170171
&self.context_data.worker_identity
171172
}
172173

174+
fn worker_deployment_version(&self) -> &Option<WorkerDeploymentVersion> {
175+
&self.context_data.worker_deployment_version
176+
}
177+
173178
fn num_issued_slots(&self) -> usize {
174179
*self.extant_permits.1.borrow()
175180
}

core/src/worker/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ impl Worker {
325325
let slot_context_data = Arc::new(PermitDealerContextData {
326326
task_queue: config.task_queue.clone(),
327327
worker_identity: config.client_identity_override.clone().unwrap_or_default(),
328+
worker_deployment_version: config.computed_deployment_version(),
328329
});
329330
let wft_slots = MeteredPermitDealer::new(
330331
tuner.workflow_task_slot_supplier(),

0 commit comments

Comments
 (0)