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

EVA-3590 update initial check for validation required or not #40

Merged
merged 4 commits into from
Jun 17, 2024

Conversation

nitin-ebi
Copy link
Collaborator

No description provided.

@nitin-ebi nitin-ebi self-assigned this Jun 10, 2024
Copy link
Contributor

@apriltuesday apriltuesday left a comment

Choose a reason for hiding this comment

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

I've put some suggestions but overall this looks fine.

eva_sub_cli/main.py Show resolved Hide resolved
return False
except requests.HTTPError as ex:
logger.error(f'Error occurred while getting status of the submission with ID {submission_id}: {ex.response.status_code} {ex.response.text}')
raise
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should not raise anything here and return true/false depending on the status code and what's safe to do (i.e. 404 should behave like no ID found I guess). Otherwise we need to clearly convey what the user should do when this crashes - try again later? Email helpdesk?

Copy link
Member

Choose a reason for hiding this comment

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

I see two options:

  • Have a sensible default when the API fails to respond ie submission does not exist
  • Raising an error that should be caught and exit gracefully with a clear error message

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

raising and existing gracefully with msg

eva_sub_cli/api_utils.py Outdated Show resolved Hide resolved
Copy link
Member

@tcezard tcezard left a comment

Choose a reason for hiding this comment

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

Approach looks good to me.
Couple of cosmetic points

if SUBMIT in tasks:
if not sub_config.get(READY_FOR_SUBMISSION_TO_EVA, False):
return True
else:
Copy link
Member

Choose a reason for hiding this comment

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

else: is unnecessary since you return in the if

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

except requests.HTTPError as ex:
logger.error(f'Error occurred while getting status of the submission with ID {submission_id}: {ex.response.status_code} {ex.response.text}')
raise
else:
Copy link
Member

Choose a reason for hiding this comment

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

Again else: is not necessary

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

return False
except requests.HTTPError as ex:
logger.error(f'Error occurred while getting status of the submission with ID {submission_id}: {ex.response.status_code} {ex.response.text}')
raise
Copy link
Member

Choose a reason for hiding this comment

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

I see two options:

  • Have a sensible default when the API fails to respond ie submission does not exist
  • Raising an error that should be caught and exit gracefully with a clear error message

@@ -83,3 +86,7 @@ def get_version():
main.orchestrate_process(**args.__dict__)
except FileNotFoundError as fne:
print(fne)
except SubmissionNotFoundException as snfe:
print(f'{snfe}. Retry with correct submission id. If the problem persists, please contact EVA Helpdesk')
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure the user will know the submission ID since it's just stored in the config, there's not a command line option to set it or anything. Since this is just when it's not found in the WS maybe just contact helpdesk in this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated


@property
def _submission_ws_url(self):
"""Retrieve the base URL for the submission web services. In order of preference from the user of this class,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"""Retrieve the base URL for the submission web services. In order of preference from the user of this class,
"""Retrieve the base URL for the submission web services. In order of preference from

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

eva_sub_cli/api_utils.py Outdated Show resolved Hide resolved
@nitin-ebi nitin-ebi merged commit 0233459 into EBIvariation:main Jun 17, 2024
1 check passed
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