Skip to content

Commit

Permalink
Create UUIDs for counting loops and add hashing
Browse files Browse the repository at this point in the history
UUIDs are now created when a CountingLoop object is created.
The __hash__ function is implemented, so that the uuid
is used as the unique hash.
  • Loading branch information
maxhoerstr committed Nov 21, 2023
1 parent bd12ada commit 49ad888
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pfdl_scheduler/model/counting_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# standard libraries
from dataclasses import dataclass
from typing import List, Union
import uuid
import hashlib

# 3rd party libraries
from antlr4.ParserRuleContext import ParserRuleContext
Expand Down Expand Up @@ -58,3 +60,7 @@ def __init__(
self.counting_variable: str = counting_variable
self.limit: str = limit
self.parallel: bool = parallel
self.uuid = str(uuid.uuid4())

def __hash__(self) -> int:
return int(uuid.UUID(self.uuid))

0 comments on commit 49ad888

Please sign in to comment.