X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/82748dedc1cf53895da24fba2801ab4cf6c52d80..5c1c5e34118a3867fca9e7f0150074ea18623939:/sdk/python/arvados/commands/put.py diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py index 219db5da81..5773cb4f98 100644 --- a/sdk/python/arvados/commands/put.py +++ b/sdk/python/arvados/commands/put.py @@ -1002,6 +1002,9 @@ class ArvPutUploadJob(object): def collection_name(self): return self._my_collection().api_response()['name'] if self._my_collection().api_response() else None + def collection_trash_at(self): + return self._my_collection().get_trash_at() + def manifest_locator(self): return self._my_collection().manifest_locator() @@ -1139,7 +1142,10 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr, utcoffset = -trash_at.utcoffset() else: # Timezone naive datetime provided. Assume is local. - utcoffset = datetime.timedelta(seconds=time.timezone) + if time.daylight: + utcoffset = datetime.timedelta(seconds=time.altzone) + else: + utcoffset = datetime.timedelta(seconds=time.timezone) # Convert to UTC timezone naive datetime. trash_at = trash_at.replace(tzinfo=None) + utcoffset @@ -1310,10 +1316,21 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr, output = ','.join(writer.data_locators()) else: try: + expiration_notice = "" + if writer.collection_trash_at() is not None: + # Get the local timezone-naive version, and log it with timezone information. + if time.daylight: + local_trash_at = writer.collection_trash_at().replace(tzinfo=None) - datetime.timedelta(seconds=time.altzone) + else: + local_trash_at = writer.collection_trash_at().replace(tzinfo=None) - datetime.timedelta(seconds=time.timezone) + expiration_notice = ". It will expire on {} {}.".format( + local_trash_at.strftime("%Y-%m-%d %H:%M:%S"), time.strftime("%z")) if args.update_collection: - logger.info(u"Collection updated: '{}'".format(writer.collection_name())) + logger.info(u"Collection updated: '{}'{}".format( + writer.collection_name(), expiration_notice)) else: - logger.info(u"Collection saved as '{}'".format(writer.collection_name())) + logger.info(u"Collection saved as '{}'{}".format( + writer.collection_name(), expiration_notice)) if args.portable_data_hash: output = writer.portable_data_hash() else: