Skip to content

Commit 2049fc7

Browse files
committed
create a typed dict
1 parent 4a02e27 commit 2049fc7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/dask-task-models-library/src/dask_task_models_library/resource_constraints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
from typing import Any, TypeAlias
1+
from typing import Literal, TypedDict
22

33
from .constants import DASK_TASK_EC2_RESOURCE_RESTRICTION_KEY
44

5-
DaskTaskResources: TypeAlias = dict[str, Any]
5+
6+
class DaskTaskResources(TypedDict):
7+
CPU: float
8+
RAM: int # in bytes
9+
# threads is a constant of 1 (enforced by static type checkers via Literal)
10+
threads: Literal[1]
611

712

813
def create_ec2_resource_constraint_key(ec2_instance_type: str) -> str:

0 commit comments

Comments
 (0)