Skip to content

Conversation

@shanko07
Copy link
Collaborator

Using this example function, it will automatically retry up to 10 times if anything but a 200 response comes. However, during a test the server took a long time in processing state creating the report. I realized there is a specific response of 412 with a specific error code that indicates the report is still processing. This change would not decrement the retries if this message is received.

@gsnyder2007 gsnyder2007 self-requested a review March 17, 2021 13:35
json.dump(response.json(), f, indent=3)
logging.info("Successfully downloaded json file to {} for report {}".format(
filename, report_id))
elif response.status_code == 412 and response.json()['errorCode'] == '{report.main.read.unfinished.report.contents}':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement. I'm testing the change on my server and seeing a different error code, so I've put a list of error codes in the cover that and will push that adaptation shortly (once the test is completed).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this original one back to the list as well? I pulled down the newest version with the list and mine seems to be reverting back to the original mechanism. Which server are you testing against? I'm going against testing.blackduck which on on 2021.2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original error code you had is still there. I copied it to the list of error codes and added another error code which I got from my v2020.10.1 server which I used to test the solution.

I've tested this version now against v2020.10.1 and v2021.2.0 and it works on both, i.e. it recognizes the 412 download error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it is kind of there. Originally it was this: '{report.main.read.unfinished.report.contents}' but I think you accidentally copy pasted it to this: '{report.main.read.unfinished.report}'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I already merged, sorry; I'll fix on main/master branch and let you know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Try it now and let me know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

…2021.2 server was different than the one in the PR
Copy link
Contributor

@gsnyder2007 gsnyder2007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement.

I'm testing it on my server and found a different error code so I'm creating a list of error codes. Once I've test it I'll push the adaptation.

@gsnyder2007 gsnyder2007 merged commit 1f27bf2 into master Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants