s3cmd icon indicating copy to clipboard operation
s3cmd copied to clipboard

filter out non-clacier or clacier which already restored

Open wangzhihao opened this issue 9 years ago • 3 comments

Filter out non-GLACIER files and GLACIER files which already start or finish restored in s3cmd restore

wangzhihao avatar Jan 22 '17 02:01 wangzhihao

Thank you for your contribution. The idea is interesting, but isn't it more efficient to simply still send only the "restore" request and ignore based on the error/reply? Maybe the "output" message could be fixed to only say "restore" for files that will in effect be restored. In the python way "ask forgiveness, not permission". As in your PR, you suggest to issue a "get_info" first for each file.

fviard avatar Jan 22 '17 18:01 fviard

Yeah, error-and-reply sounds more graceful. But my main concern is that the error code InvalidObjectState is not clear to indicate non-glacier. Is it safe for us to ignore all InvalidObjectState error?

   if e.code == "InvalidObjectState":
     warning("%s: %s" % (e.message, item['object_uri_str']))

Secondary, to extend this idea, we might let each file to be independent to the others. I.E. We process all files and don't let any error stop the iteration. Do you think is this option safe?

wangzhihao avatar Jan 23 '17 02:01 wangzhihao

Sorry that I forgot to reply since so long, i don't know if you are still looking at this MR, but the reply is yes, skipping all InvalidObjectState looks ok to me. We can probably have a more explicit message prefix in the warning also ("Skipping as not a Glacier object or not in a restorable state:")

fviard avatar Oct 11 '22 22:10 fviard