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(tools): location_mappings support for packageddb #8141

Closed
wants to merge 1 commit into from

Conversation

moxw
Copy link
Contributor

@moxw moxw commented Jun 21, 2024

The main.py script now fetches the latest location asset mappings and applies them using the RotkiDataUpdater.

The `main.py` script now fetches the latest location
asset mappings and applies them using the `RotkiDataUpdater`.
@moxw moxw force-pushed the location-mappings-consistency branch from d3917a1 to 687ec8b Compare June 21, 2024 18:44
@moxw moxw added the ready for peer review Backend PR ready to be reviewed by colleagues label Jun 21, 2024
@moxw moxw requested a review from yabirgb June 21, 2024 18:57
Copy link

codecov bot commented Jun 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.36%. Comparing base (cde29fe) to head (687ec8b).
Report is 8 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8141      +/-   ##
===========================================
- Coverage    80.41%   80.36%   -0.05%     
===========================================
  Files         1225     1245      +20     
  Lines       107856   109070    +1214     
  Branches     13130    13323     +193     
===========================================
+ Hits         86731    87659     +928     
- Misses       18812    19031     +219     
- Partials      2313     2380      +67     
Flag Coverage Δ
backend 80.62% <100.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@yabirgb yabirgb left a comment

Choose a reason for hiding this comment

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

The approach is not correct, please check the link that I provide in the comment for how to do it

Comment on lines +117 to +122
for version in range(1, latest_version + 1):
data_url = DATA_UPDATES_URL.format(branch='develop', data=key, version=latest_version)
data_file = query_file(url=data_url, is_json=True)
updates[version] = {
UpdateType.LOCATION_ASSET_MAPPINGS: data_file,
}
Copy link
Member

Choose a reason for hiding this comment

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

You are re-inventing the wheel here. We already have this logic in the app. Here is an example of how to implement it https://github.com/rotki/rotki/pull/7827/files#diff-36b9d1f1d98f8ba05186a958ba992ba8f6a6d8d82f4f9597578bc8b946f31f23R27

Comment on lines +176 to +185
infojson = get_remote_info_json()
updates = _retrieve_data_files(
infojson=infojson,
)
for version, _updates in updates.items():
updated_data = _updates.get(UpdateType.LOCATION_ASSET_MAPPINGS)
if updated_data is None:
print('Remote update invalid')
continue # perhaps broken file? Skipping
RotkiDataUpdater.update_location_asset_mappings(updated_data, version)
Copy link
Member

Choose a reason for hiding this comment

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

we already have this logic

Comment on lines +127 to +130
def get_remote_info_json() -> dict[str, Any]:
"""Retrieve remote file with information for different updates

May raise RemoteError if anything is wrong contacting github
Copy link
Member

Choose a reason for hiding this comment

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

we already have this logic


add_logging_level('TRACE', TRACE)
DATA_UPDATES_URL = 'https://raw.githubusercontent.com/rotki/data/{branch}/updates/{data}/v{version}.json'
Copy link
Member

Choose a reason for hiding this comment

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

you don't need to re-difine it. We already have it in update_single

@moxw moxw closed this by deleting the head repository Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for peer review Backend PR ready to be reviewed by colleagues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants