Browse Source

Fix exit statuses of ia-upload-stream and ia-wait-item-tasks

master
JustAnotherArchivist 1 year ago
parent
commit
67b12f645f
2 changed files with 11 additions and 1 deletions
  1. +3
    -0
      ia-upload-stream
  2. +8
    -1
      ia-wait-item-tasks

+ 3
- 0
ia-upload-stream View File

@@ -417,9 +417,11 @@ def main():
except (RuntimeError, UploadError) as e:
if isinstance(e, PreventCompletionError):
level = logging.INFO
status = 0
else:
logger.exception('Unhandled exception raised')
level = logging.WARNING
status = 1
if isinstance(e, UploadError):
if e.r is not None:
logger.info(pprint.pformat(vars(e.r.request)), exc_info = False)
@@ -428,6 +430,7 @@ def main():
logger.log(level, f'Upload ID for resumption or abortion: {e.uploadId}', exc_info = False)
parts = base64.b64encode(json.dumps(e.parts, separators = (',', ':')).encode('ascii')).decode('ascii')
logger.log(level, f'Previous parts data for resumption: {parts}', exc_info = False)
sys.exit(status)


if __name__ == '__main__':


+ 8
- 1
ia-wait-item-tasks View File

@@ -7,7 +7,14 @@ then
exit 1
fi

while ia tasks "$1" | grep -Fvq ' "finished": '
set -e

while :
do
out="$(ia tasks "$1")"
if ! grep -Fvq ' "finished": ' <<<"${out}"
then
break
fi
sleep 60
done

Loading…
Cancel
Save