Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions shuffle_sdk/shuffle_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,15 @@ def url_decode(base):
###
###

pastAppExecutions = []

class AppBase:
__version__ = None
app_name = None

def __init__(self, redis=None, logger=None, console_logger=None):#, docker_client=None):
self.logger = logger if logger is not None else logging.getLogger("AppBaseLogger")
global pastAppExecutions

if not os.getenv("SHUFFLE_LOGS_DISABLED") == "true":
self.log_capture_string = StringBuffer()
Expand All @@ -361,6 +363,21 @@ def __init__(self, redis=None, logger=None, console_logger=None):#, docker_clien

# Make start time with milliseconds
self.start_time = int(time.time_ns())
try:
if isinstance(self.action, str):
self.action = json.loads(self.action)

action_id = self.action.get("id")
fullKey = str(self.current_execution_id) + "-" + str(action_id)
if fullKey in pastAppExecutions:
self.logger.error(f"[ERROR] Duplicate execution detected for execution id - {self.current_execution_id} and action - {str(action_id)}")
return

pastAppExecutions.append(fullKey)
if len(pastAppExecutions) > 50:
pastAppExecutions[:] = pastAppExecutions[-50:]
except Exception as e:
self.logger.info(f"[ERROR] Failed to access action ID in the execution({self.current_execution_id}): {e}")

self.init_singul()

Expand Down