Skip to content

Commit

Permalink
Improved output of dispatcher module
Browse files Browse the repository at this point in the history
  • Loading branch information
tblock79 committed Mar 8, 2022
1 parent 6134a99 commit 1dd7828
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0-beta.6
0.2.0-beta.7
14 changes: 7 additions & 7 deletions dispatch/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def execute(
delay = target_info.next_retry_at

if target_info and time.time() >= delay:
logger.info(f"Folder {source_folder} is ready for sending")

uid = task_info.get("uid", "uid-missing")
target_name: str = target_info.get("target_name", "target_name-missing")

Expand All @@ -124,13 +122,11 @@ def execute(
# Create a .processing file to indicate that this folder is being sent,
# otherwise another dispatcher instance would pick it up again
lock_file = Path(source_folder) / mercure_names.PROCESSING

# Double check that the case has not been picked up by another instance already
if lock_file.exists():
logger.info(f"Case {source_folder} already processed by other instance")
return
try:
lock_file.touch(exist_ok=False)
except FileExistsError:
# Return if the case has already been locked by another instance in the meantime
return
except:
# TODO: Put a limit on these error messages -- log will run full at some point
send_event(m_events.PROCESSING, severity.ERROR, f"Error sending {uid} to {target_name}")
Expand All @@ -139,6 +135,9 @@ def execute(
logger.exception(error_message)
return

logger.info("---------")
logger.info(f"Folder {source_folder} is ready for sending")

# Compose the command for dispatching the results
command, opts, needs_splitting = _create_command(target_info, source_folder)

Expand Down Expand Up @@ -203,6 +202,7 @@ def execute(
send_series_event(s_events.MOVE, uid, 0, error_folder, "")
send_event(m_events.PROCESSING, severity.ERROR, f"Series suspended after reaching max retries")
_trigger_notification(task_content.info, mercure_events.ERROR)
logger.info(f"Done with dispatching folder {source_folder}")
else:
pass
# logger.warning(f"Folder {source_folder} is *not* ready for sending")
Expand Down
1 change: 0 additions & 1 deletion dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def dispatch(args) -> None:

# Now process the folders that are ready for dispatching
if entry.is_dir() and is_ready_for_sending(entry):
logger.info(f"Sending folder {entry}")
execute(Path(entry), success_folder, error_folder, retry_max, retry_delay)

# If termination is requested, stop processing series after the
Expand Down

0 comments on commit 1dd7828

Please sign in to comment.