Skip to content

Commit

Permalink
move to dataset_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ivukotic committed May 10, 2023
1 parent de0e8cd commit 7719cfd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/servicex_did_finder_lib/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,20 @@ def rabbit_mq_callback(
body ([type]): The body (json for us) of the message
file_prefix([str]): Prefix to put in front of file paths to enable use of Cache service
"""
request_id = None # set this in case we get an exception while loading request
dataset_id = None # set this in case we get an exception while loading request
try:
# Unpack the message. Really bad if we fail up here!
did_request = json.loads(body)
did = did_request["did"]
request_id = did_request["request_id"]
dataset_id = did_request["dataset_id"]
__logging.info(
f"Received DID request {did_request}", extra={"requestId": request_id}
f"Received DID request {did_request}", extra={"dataset_id": dataset_id}
)
servicex = ServiceXAdapter(did_request["service-endpoint"], file_prefix)
servicex.post_status_update("DID Request received")

info = {
"request-id": request_id,
"dataset-id": dataset_id,
}

# Process the request and resolve the DID
Expand All @@ -152,16 +152,16 @@ def rabbit_mq_callback(

except Exception as e:
_, exec_value, _ = sys.exc_info()
__logging.exception("DID Request Failed", extra={"requestId": request_id})
__logging.exception("DID Request Failed", extra={"dataset_id": dataset_id})
servicex.post_status_update(
f"DID Request Failed for id {request_id}: " f"{str(e)} - {exec_value}",
f"DID Request Failed for id {dataset_id}: " f"{str(e)} - {exec_value}",
severity="fatal",
)
raise

except Exception as e:
__logging.exception(
f"DID request failed {str(e)}", extra={"requestId": request_id}
f"DID request failed {str(e)}", extra={"dataset_id": dataset_id}
)

finally:
Expand Down
5 changes: 5 additions & 0 deletions src/servicex_did_finder_lib/servicex_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def post_status_update(self, status_msg, severity="info"):
self.logger.error(f'After {attempts} tries, failed to send ServiceX App a status '
f'message: {str(status_msg)} - Ignoring error.')

# not needed anymore
# ????
def _prefix_file(self, file_path):
return file_path if not self.file_prefix else self.file_prefix+file_path

Expand Down Expand Up @@ -114,6 +116,9 @@ def put_file_add_bulk(self, file_list, chunk_length=30):
self.logger.error(f'After {attempts} tries, failed to send ServiceX App '
f'a put_file_bulk message: {mesg} - Ignoring error.')

# should be removed...
# transforms can start as soon as request has been made. No need to wait for this.
# whole endpoint '/start' is not needed.
def post_transform_start(self):
success = False
attempts = 0
Expand Down

0 comments on commit 7719cfd

Please sign in to comment.