Skip to content

Commit a059aa0

Browse files
committed
Fixed benchmarks & formatting
1 parent 8172af7 commit a059aa0

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed

crates/hyperqueue/src/client/commands/autoalloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ wasted allocation duration."
369369
]);
370370
}
371371
if let Some(arg) = coupling {
372-
worker_args.extend(["--coupling".to_string(), format!("\"{}\"", arg)])
372+
worker_args.extend(["--coupling".to_string(), format!("\"{arg}\"")])
373373
}
374374
if let Some(group) = group {
375375
worker_args.extend(["--group".to_string(), group]);

crates/hyperqueue/src/server/event/streamer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ impl EventStreamer {
413413
let inner = self.inner.get();
414414
if let Some(ref streamer) = inner.storage_sender
415415
&& streamer
416-
.send(EventStreamMessage::ReplayJournal(history_sender))
417-
.is_err()
416+
.send(EventStreamMessage::ReplayJournal(history_sender))
417+
.is_err()
418418
{
419419
log::error!("Event streaming queue has been closed.");
420420
}

crates/tako/benches/benchmarks/worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn create_resource_queue(num_cpus: u32) -> ResourceWaitQueue {
183183
kind: ResourceDescriptorKind::simple_indices(8),
184184
},
185185
],
186-
None,
186+
Default::default(),
187187
);
188188
ResourceWaitQueue::new(res_allocator_from_descriptor(descriptor))
189189
}

crates/tako/benches/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn create_worker(id: u64) -> Worker {
3838
name: CPU_RESOURCE_NAME.to_string(),
3939
kind: ResourceDescriptorKind::simple_indices(1),
4040
}],
41-
None,
41+
Default::default(),
4242
),
4343
listen_address: "".to_string(),
4444
hostname: "".to_string(),

crates/tako/src/internal/worker/resources/allocator.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl ResourceAllocator {
155155
pools: &[ResourcePool],
156156
free: &ConciseFreeResources,
157157
request: &ResourceRequest,
158-
running: impl Iterator<Item=&'b Rc<Allocation>>,
158+
running: impl Iterator<Item = &'b Rc<Allocation>>,
159159
static_info: &AllocatorStaticInfo,
160160
) -> Option<ConciseFreeResources> {
161161
let mut free = free.clone();
@@ -217,7 +217,7 @@ impl ResourceAllocator {
217217
&coupling,
218218
&static_info.coupling_weights,
219219
)
220-
.unwrap();
220+
.unwrap();
221221
cost -= 0.1;
222222
optimal_costs.insert(request.clone(), cost);
223223
cost
@@ -329,7 +329,7 @@ impl ResourceAllocator {
329329
&coupling,
330330
&self.static_info.coupling_weights,
331331
)
332-
.unwrap();
332+
.unwrap();
333333
for (entry, group_set) in coupling.into_iter().zip(groups.into_iter()) {
334334
allocation.add_resource_allocation(
335335
self.pools[entry.resource_id].claim_resources_with_group_mask(
@@ -393,10 +393,10 @@ impl ResourceAllocator {
393393
amount.total_fractions() as f32 / size.total_fractions() as f32
394394
}
395395
AllocationRequest::ForceCompact(amount) | AllocationRequest::ForceTight(amount)
396-
if self.pools[entry.resource_id].n_groups() == 1 =>
397-
{
398-
amount.total_fractions() as f32 / size.total_fractions() as f32
399-
}
396+
if self.pools[entry.resource_id].n_groups() == 1 =>
397+
{
398+
amount.total_fractions() as f32 / size.total_fractions() as f32
399+
}
400400
AllocationRequest::ForceCompact(amount) | AllocationRequest::ForceTight(amount) => {
401401
(amount.total_fractions() * 2) as f32 / size.total_fractions() as f32
402402
}

crates/tako/src/internal/worker/resources/test_allocator.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::internal::common::resources::descriptor::{ResourceDescriptor, ResourceDescriptorKind};
22
use crate::internal::common::resources::{Allocation, ResourceId, ResourceRequestVariants};
3-
use crate::internal::tests::utils::resources::{cpus_compact, ResBuilder};
3+
use crate::internal::tests::utils::resources::{ResBuilder, cpus_compact};
44
use crate::internal::tests::utils::shared::res_allocator_from_descriptor;
55
use crate::internal::tests::utils::sorted_vec;
66
use crate::internal::worker::resources::allocator::{AllocatorStaticInfo, ResourceAllocator};
@@ -143,14 +143,16 @@ fn test_compute_blocking_level() {
143143
let rq = ResBuilder::default().add(0, 3).add(1, 1).finish();
144144
let sinfo = test_static_info(free.clone());
145145
assert!(ResourceAllocator::compute_witness(&pools, &free, &rq, [].iter(), &sinfo).is_none());
146-
assert!(ResourceAllocator::compute_witness(
147-
&pools,
148-
&free,
149-
&rq,
150-
[Rc::new(Allocation::new_simple(&[1]))].iter(),
151-
&sinfo,
152-
)
153-
.is_none());
146+
assert!(
147+
ResourceAllocator::compute_witness(
148+
&pools,
149+
&free,
150+
&rq,
151+
[Rc::new(Allocation::new_simple(&[1]))].iter(),
152+
&sinfo,
153+
)
154+
.is_none()
155+
);
154156
assert_eq!(
155157
ResourceAllocator::compute_witness(
156158
&pools,

0 commit comments

Comments
 (0)