Skip to content

Commit

Permalink
Add some logging to cloudauthz and cloud download api.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Oct 11, 2018
1 parent be34b75 commit bd4023f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/galaxy/authnz/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def get_cloud_access_credentials(self, cloudauthz, sa_session, user_id, request=
config = self._extend_cloudauthz_config(cloudauthz, request, sa_session, user_id)
try:
ca = CloudAuthz()
log.info("Requesting credentials using CloudAuthz with config id `{}` on be half of user `{}`.".format(
cloudauthz.id, user_id))
return ca.authorize(cloudauthz.provider, config)
except CloudAuthzBaseException as e:
log.exception(e.message)
Expand Down Expand Up @@ -305,6 +307,8 @@ def get_cloud_access_credentials_in_file(self, new_file_path, cloudauthz, sa_ses
"cd_" + ''.join(random.SystemRandom().choice(
string.ascii_uppercase + string.digits) for _ in range(11))))
credentials = self.get_cloud_access_credentials(cloudauthz, sa_session, user_id, request)
log.info("Writting credentials generated using CloudAuthz with config id `{}` to the following file: `{}`"
"".format(cloudauthz.id, filename))
with open(filename, "w") as f:
f.write(json.dumps(credentials))
return filename
5 changes: 5 additions & 0 deletions lib/galaxy/webapps/galaxy/api/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ def download(self, trans, payload, **kwargs):
raise ActionInputError("The following provided dataset IDs are invalid, please correct them and retry. "
"{}".format(invalid_dataset_ids))

log.info(msg="Received api/download request for `{}` datasets using authnz with id `{}`, and history `{}`."
"".format("all the dataset in the given history" if not dataset_ids else len(dataset_ids),
authz_id,
history_id))

downloaded, failed = self.cloud_manager.download(trans=trans,
history_id=history_id,
bucket_name=bucket,
Expand Down

0 comments on commit bd4023f

Please sign in to comment.