Skip to content

Commit

Permalink
Simplify command ACK
Browse files Browse the repository at this point in the history
For the time being, YAGNI, and recognize that we never do anything different;
we *always* ACK the message, regardless of the processing outcome.  No need to
worry about "proper handling" later, if it's already done.
  • Loading branch information
khk-globus committed Nov 19, 2023
1 parent e6d040c commit c176483
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ def _event_loop(self):
self.wait_for_children()

try:
_command = self._command_queue.get(timeout=1.0)
d_tag, props, body = _command
d_tag, props, body = self._command_queue.get(timeout=1.0)
self._command.ack(d_tag)
if props.headers and props.headers.get("debug", False):
body_log_b = _redact_url_creds(body, redact_user=False)
log.warning(
Expand Down Expand Up @@ -448,7 +448,6 @@ def _event_loop(self):
f"Unable to deserialize Globus Compute services command."
f" ({e.__class__.__name__}) {e}"
)
self._command.ack(d_tag)
continue

now = round(time.time())
Expand All @@ -461,15 +460,13 @@ def _event_loop(self):
f"\n Command timestamp: {server_cmd_ts:,} ({server_pp_ts})"
f"\n Endpoint timestamp: {now:,} ({endp_pp_ts})"
)
self._command.ack(d_tag)
continue

try:
effective_identity = msg["globus_effective_identity"]
identity_set = msg["globus_identity_set"]
except Exception as e:
log.error(f"Invalid server command. ({e.__class__.__name__}) {e}")
self._command.ack(d_tag)
continue

identity_for_log = (
Expand All @@ -485,13 +482,11 @@ def _event_loop(self):
"Identity failed to map to a local user name."
f" ({e.__class__.__name__}) {e}{identity_for_log}"
)
self._command.ack(d_tag)
continue
except Exception as e:
msg = "Unhandled error attempting to map user."
log.debug(f"{msg}{identity_for_log}", exc_info=e)
log.error(f"{msg} ({e.__class__.__name__}) {e}{identity_for_log}")
self._command.ack(d_tag)
continue

try:
Expand All @@ -503,7 +498,6 @@ def _event_loop(self):
" Identity mapped to a local user name, but local user does not"
f" exist.\n Local user name: {local_username}{identity_for_log}"
)
self._command.ack(d_tag)
continue

try:
Expand All @@ -528,8 +522,6 @@ def _event_loop(self):
f" args: {command_args}\n"
f" kwargs: {command_kwargs}{identity_for_log}"
)
finally:
self._command.ack(d_tag)

def cmd_start_endpoint(
self,
Expand Down

0 comments on commit c176483

Please sign in to comment.