Skip to content

Commit

Permalink
lib.scheduler: Initializing 'caller' (fixed bug) is only performed, i…
Browse files Browse the repository at this point in the history
…f the task-method which is to be called has a parameter 'caller'
  • Loading branch information
msinn committed Sep 14, 2023
1 parent b1d0df0 commit fc4922a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,12 @@ def _task(self, name, obj, by, source, dest, value):
if value is None:
obj()
else:
logger.debug(f"_task: name={name}, value={value}, by={by}, source={source}")
if isinstance(value, dict):
caller = value.get('caller', None)
if caller is None:
value['caller'] = by
if 'caller' in inspect.getfullargspec(obj).args:
logger.debug(f"_task: name={name}, value={value}, by={by}, source={source} - args of task-obj={inspect.getfullargspec(obj).args}")
if isinstance(value, dict):
caller = value.get('caller', None)
if caller is None:
value['caller'] = by
obj(**value)
except Exception as e:
tasks_logger.exception(f"Method {name} exception: {e}")
Expand Down

0 comments on commit fc4922a

Please sign in to comment.