Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check_operation_status script #4

Merged
merged 11 commits into from
Dec 11, 2023
Merged

Conversation

SteveLasker
Copy link
Contributor

The current script can take a while for the statement to get anchored. Rather than continually run the curl, a check_operation_status.py script allows the user to run and wait for it to complete.

Signed-off-by: steve lasker <[email protected]>
Signed-off-by: steve lasker <[email protected]>
Signed-off-by: steve lasker <[email protected]>
scitt/check_operation_status.py Outdated Show resolved Hide resolved
scitt/check_operation_status.py Outdated Show resolved Hide resolved
@SteveLasker
Copy link
Contributor Author

See datatrails/datatrails-docs#726 for doc updates

@honourfish
Copy link
Contributor

Updated to use requests.get(), here is an example failed call:

$ python3 scitt/check_operation_status.py --operation-id assets_4ed3006e-e674-4847-b90f-b513b5ddfda5_events_96688419-b477-4c67-a6f3-e0fe952572a3
Traceback (most recent call last):
  File "scitt/check_operation_status.py", line 104, in <module>
    main()
  File "scitt/check_operation_status.py", line 99, in main
    entry_id = poll_operation_status(args.operation_id, headers)
  File "scitt/check_operation_status.py", line 52, in poll_operation_status
    operation_status = get_operation_status(operation_id, headers)
  File "scitt/check_operation_status.py", line 38, in get_operation_status
    response.raise_for_status()
  File "/home/jgough/.local/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://app.datatrails.ai/archivist/v1/publicscitt/operations/assets_4ed3006e-e674-4847-b90f-b513b5ddfda5_events_96688419-b477-4c67-a6f3-e0fe952572a3

Here is a succesful call:

$ python3 scitt/check_operation_status.py --operation-id assets_4ed3006e-e674-4847-b90f-b513b5ddfda5_events_96688419-b477-4c67-a6f3-e0fe952572a3
assets_4ed3006e-e674-4847-b90f-b513b5ddfda5_events_96688419-b477-4c67-a6f3-e0fe952572a3

SteveLasker added a commit to datatrails/datatrails-docs that referenced this pull request Dec 8, 2023
@SteveLasker SteveLasker merged commit cfc1fcd into main Dec 11, 2023
10 checks passed
@SteveLasker SteveLasker deleted the steve/scitt-updates branch December 11, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants