Skip to content

Commit

Permalink
temporarily use the old suuid locally to avoid depreacation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetretto committed Mar 4, 2024
1 parent 7879f54 commit 555ede5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/jobflow_remote/jobs/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pathlib import Path
from typing import TYPE_CHECKING

from jobflow.utils import suuid
from monty.json import MontyDecoder
from monty.os import makedirs_p
from qtoolkit.core.data_objects import QState, SubmissionStatus
Expand All @@ -41,6 +40,7 @@
)
from jobflow_remote.remote.host import BaseHost
from jobflow_remote.remote.queue import ERR_FNAME, OUT_FNAME, QueueManager, set_name_out
from jobflow_remote.utils.data import suuid
from jobflow_remote.utils.log import initialize_runner_logger
from jobflow_remote.utils.schedule import SafeScheduler

Expand Down
18 changes: 18 additions & 0 deletions src/jobflow_remote/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,21 @@ def convert_utc_time(datetime_value: datetime) -> datetime:
The datetime in the zone of the current system
"""
return datetime_value.replace(tzinfo=timezone.utc).astimezone(tz=None)


# TODO imported this from jobflow remote for backward compatibility.
# remote this in favor of suid in the next release
def suuid() -> str:
"""
Generate a string UUID (universally unique identifier).
Uses the UUID4 specification.
Returns
-------
str
A UUID.
"""
from uuid import uuid4

return str(uuid4())
3 changes: 1 addition & 2 deletions src/jobflow_remote/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
from datetime import datetime
from typing import TYPE_CHECKING, Any

from jobflow.utils import suuid
from pymongo import ReturnDocument

from jobflow_remote.utils.data import deep_merge_dict
from jobflow_remote.utils.data import deep_merge_dict, suuid

if TYPE_CHECKING:
from pymongo.collection import Collection
Expand Down

0 comments on commit 555ede5

Please sign in to comment.