Skip to content

Commit

Permalink
Code reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
renan-souza committed Dec 18, 2024
1 parent 3e74494 commit badb390
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/flowcept/commons/daos/docdb_dao/docdb_dao_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_instance(*args, **kwargs) -> "DocumentDBDAO":

DocumentDBDAO._instance = LMDBDAO()
else:
raise NotImplementedError
raise Exception("All dbs are disabled. You can't use this.")
# TODO: revise, this below may be better in subclasses
DocumentDBDAO._instance._initialized = True
return DocumentDBDAO._instance
Expand Down
4 changes: 4 additions & 0 deletions src/flowcept/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
else:
LMDB_ENABLED = _lmdb_settings.get("enabled", False)

if not LMDB_ENABLED and not MONGO_ENABLED:
# At least one of these variables need to be enabled.
LMDB_ENABLED = True

##########################
# Buffer Settings #
##########################
Expand Down
4 changes: 3 additions & 1 deletion src/flowcept/instrumentation/flowcept_task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Task module."""

import threading
from time import time
from functools import wraps
Expand All @@ -18,6 +19,7 @@

_thread_local = threading.local()


# TODO: :code-reorg: consider moving it to utils and reusing it in dask interceptor
def default_args_handler(task_message: TaskObject, *args, **kwargs):
"""Get default arguments."""
Expand Down Expand Up @@ -157,4 +159,4 @@ def wrapper(*args, **kwargs):

def get_current_context_task_id():
"""Retrieve the current task object from thread-local storage."""
return getattr(_thread_local, '_flowcept_current_context_task_id', None)
return getattr(_thread_local, "_flowcept_current_context_task_id", None)
4 changes: 3 additions & 1 deletion src/flowcept/instrumentation/flowcept_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def __init__(self, *args, **kwargs):
self._parent_task_id = kwargs.get(
"parent_task_id", get_current_context_task_id()
) # to be used by forward layers
self._parent_workflow_id = kwargs.get("parent_workflow_id", Flowcept.current_workflow_id)
self._parent_workflow_id = kwargs.get(
"parent_workflow_id", Flowcept.current_workflow_id
)
self._campaign_id = kwargs.get("campaign_id", Flowcept.campaign_id)
if kwargs.get("save_workflow", True):
self._workflow_id = self._register_as_workflow()
Expand Down

0 comments on commit badb390

Please sign in to comment.