Skip to content

Commit

Permalink
Code linting for black new version
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Carrogu <[email protected]>
  • Loading branch information
lukeseawalker committed Feb 5, 2024
1 parent 7a6c5cd commit 46a171b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/slurm_plugin/capacity_block_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def _update_capacity_blocks_info_from_ec2(self, capacity_blocks: Dict[str, Capac
capacity_block_ids = list(capacity_blocks.keys())
logger.info("Retrieving Capacity Blocks information from EC2 for %s", ",".join(capacity_block_ids))
try:
capacity_block_reservations_info: List[
CapacityReservationInfo
] = self.ec2_client.describe_capacity_reservations(capacity_block_ids)
capacity_block_reservations_info: List[CapacityReservationInfo] = (
self.ec2_client.describe_capacity_reservations(capacity_block_ids)
)

for capacity_block_reservation_info in capacity_block_reservations_info:
capacity_block_id = capacity_block_reservation_info.capacity_reservation_id()
Expand Down
14 changes: 8 additions & 6 deletions src/slurm_plugin/cluster_event_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ def _describe_node(node: SlurmNode):
"queue-name": node.queue_name,
"compute-resource": node.compute_resource_name,
"last-busy-time": node.lastbusytime.isoformat(timespec="milliseconds") if node.lastbusytime else None,
"slurm-started-time": node.slurmdstarttime.isoformat(timespec="milliseconds")
if node.slurmdstarttime
else None,
"slurm-started-time": (
node.slurmdstarttime.isoformat(timespec="milliseconds") if node.slurmdstarttime else None
),
}
if node
else None
Expand All @@ -772,9 +772,11 @@ def _describe_instance(instance):
"id": instance.id,
"private-ip": instance.private_ip,
"hostname": instance.hostname,
"launch-time": instance.launch_time.isoformat(timespec="milliseconds")
if isinstance(instance.launch_time, datetime)
else str(instance.launch_time),
"launch-time": (
instance.launch_time.isoformat(timespec="milliseconds")
if isinstance(instance.launch_time, datetime)
else str(instance.launch_time)
),
}
if instance
else None
Expand Down
8 changes: 5 additions & 3 deletions src/slurm_plugin/task_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def shutdown(self, wait: bool = False, cancel_futures: bool = True) -> None:

# `cancel_futures` parameter does not exist in python pre-3.9
can_cancel = "cancel_futures" in inspect.getfullargspec(self._executor_pool.shutdown).kwonlyargs
self._executor_pool.shutdown(
wait=wait, cancel_futures=cancel_futures
) if can_cancel else self._executor_pool.shutdown(wait=False)
(
self._executor_pool.shutdown(wait=wait, cancel_futures=cancel_futures)
if can_cancel
else self._executor_pool.shutdown(wait=False)
)
self._executor_pool = None
8 changes: 5 additions & 3 deletions tests/slurm_plugin/test_console_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ def console_callback(name, instance_id, output):
)
ec2_stub.assert_no_pending_responses()

assert_that(task_controller.tasks_queued).is_equal_to(1) if len(compute_instances) > 0 else assert_that(
task_controller.tasks_queued
).is_zero()
(
assert_that(task_controller.tasks_queued).is_equal_to(1)
if len(compute_instances) > 0
else assert_that(task_controller.tasks_queued).is_zero()
)
assert_that(actual_results).is_length(len(mocked_ec2_requests))

for instance, actual_output in actual_results.items():
Expand Down

0 comments on commit 46a171b

Please sign in to comment.