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

feat: Download session headers #1429

Merged
merged 2 commits into from
Apr 20, 2021
Merged

feat: Download session headers #1429

merged 2 commits into from
Apr 20, 2021

Conversation

IgnatovFedor
Copy link
Collaborator

No description provided.

@IgnatovFedor IgnatovFedor requested a review from kudep April 7, 2021 13:50
Copy link
Contributor

@oserikov oserikov left a comment

Choose a reason for hiding this comment

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

мне ок, как я понял чисто ради поддержки версионирования добавили хедерс.

headers = {
'dp-token': get_download_token(),
'dp-session': session_id,
'dp-file-id': str(last_id - file_id),
Copy link
Contributor

Choose a reason for hiding this comment

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

last_id - file_id
вау а что это за математика?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

В рамках одной сессии скачивания моделей мы имеей N файлов. last_id-file_id нужно чтобы нумеровать эти файлы от N-1 до 0. Получив dp-file-id == 0 мы понимаем, что это был последний файл в рамках данной сессии. С тем же успехом можно было добавить какой-нибудь хэдер вроде dp-last-session-file для последнего файла, но сделал обратный отсчёт.

Copy link
Contributor

Choose a reason for hiding this comment

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

ок, но я бы вынес в отдельную переменную, а то с ума сойдём потом

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Т.е. добавить dp_file_id = last_id - file_id, а в дикте 'dp-file-id': str(dp_file_id)? Не вижу смысла. Или ты про другую отдельную переменную?

Copy link
Contributor

Choose a reason for hiding this comment

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

смысл был только в том, чтобы было понятное название у этой разности, но и так нормас

deeppavlov/core/data/utils.py Show resolved Hide resolved
deeppavlov/core/data/utils.py Show resolved Hide resolved
@oserikov
Copy link
Contributor

oserikov commented Apr 8, 2021

но ответь плиз на комменты

@IgnatovFedor IgnatovFedor merged commit e3283fd into dev Apr 20, 2021
@IgnatovFedor IgnatovFedor deleted the feat/statistics branch April 20, 2021 16:11
surkovv pushed a commit to surkovv/DeepPavlov that referenced this pull request Aug 24, 2022
* feat: some changes to provide more precise statistics

* feat: update headers for proper stats
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.

2 participants