Skip to content

Commit

Permalink
Fix cli create git fail (#3267)
Browse files Browse the repository at this point in the history
* Fix issue of infinite loop due to incorrect status comparison.

* Update CHANGELOG.md

* Fix PEP8.

* Update failure case to break from infinite loop.

* Update utils/cli/core/core.py

Co-authored-by: Boris Sekachev <boris.sekachev@intel.com>

* Add check for unknown failure.

* Fix logging in failure case.

* Update CHANGELOG.md

Co-authored-by: Boris Sekachev <boris.sekachev@intel.com>
Co-authored-by: André Aquilina <andre.aquilina@dysismedical.com>
  • Loading branch information
3 people authored Jun 4, 2021
1 parent 5168ca6 commit 140489d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<https://github.com/openvinotoolkit/cvat/pull/3223>)
- Fixed Python 3.6 support (<https://github.com/openvinotoolkit/cvat/pull/3258>)
- Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>)
- Fix CLI create an infinite loop if git repository responds with failure (<https://github.com/openvinotoolkit/cvat/pull/3267>)

### Security

Expand Down
10 changes: 6 additions & 4 deletions utils/cli/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}.")

Expand Down

0 comments on commit 140489d

Please sign in to comment.