diff --git a/CHANGELOG.md b/CHANGELOG.md index 74f6647a5756..995f0e2e893d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Project page requests took a long time and did many DB queries () - Fixed Python 3.6 support () - Incorrect attribute import in tracks () +- Fix CLI create an infinite loop if git repository responds with failure () ### Security diff --git a/utils/cli/core/core.py b/utils/cli/core/core.py index 5f126a043745..31c12e2736c9 100644 --- a/utils/cli/core/core.py +++ b/utils/cli/core/core.py @@ -124,14 +124,16 @@ def tasks_create(self, name, labels, overlap, segment_size, bug, resource_type, check_url = self.api.git_check(rq_id) response = self.session.get(check_url) response_json = response.json() - log.info('''Awaiting dataset repository for task. Status: {}'''.format( - response_json['status'])) while response_json['status'] != 'finished': + log.info('''Awaiting a dataset repository to be created for the task. Response status: {}'''.format( + response_json['status'])) sleep(git_completion_verification_period) response = self.session.get(check_url) response_json = response.json() - if response_json['status'] == 'Failed': - log.error(f'Dataset repository creation request for task {task_id} failed.') + if response_json['status'] == 'failed' or response_json['status'] == 'unknown': + log.error(f'Dataset repository creation request for task {task_id} failed' + f'with status {response_json["status"]}.') + break log.info(f"Dataset repository creation completed with status: {response_json['status']}.")