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

Migrate moonworm tasks #919

Merged
merged 10 commits into from
Feb 1, 2024
Merged

Migrate moonworm tasks #919

merged 10 commits into from
Feb 1, 2024

Conversation

Andrei-Dolgolev
Copy link
Contributor

@Andrei-Dolgolev Andrei-Dolgolev commented Sep 4, 2023

Currently we have posibility of dublicate events tasks in moonworm journal because hash deduplicate logic can be broke on different names of variables.
So we adding deduplication on function/event selectors logic.

For be sure what all moonworm tasks have selectors we will add selector tag on each entry

mnstr migrations run --id 20230904 --command upgrade --step fill_missing_selectors_in_moonworm_tasks

Output:

INFO:moonstreamapi.admin.cli:Starting step fill_missing_selectors_in_moonworm_tasks: Get all moonworm jobs from moonworm journal and add selector tag if it not represent
INFO:moonstreamapi.admin.migrations.add_selectors:Found 26 moonworm tasks versions 1.0
INFO:moonstreamapi.admin.migrations.add_selectors:Found 0 missing selectors in batch 26 tasks

For chek if we have duplicates in moonworm tasks journal for some of abi and selector for particular address we will run deuplication migration.

mnstr migrations run --id 20230904 --command upgrade --step deduplicate_moonworm_tasks

Output:

INFO:moonstreamapi.admin.migrations.add_selectors:Found 53 moonworm tasks versions 2.0
INFO:moonstreamapi.admin.migrations.add_selectors:Found 3 addresses
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 tasks with selector 0x0e7afec5
INFO:moonstreamapi.admin.migrations.add_selectors:Deleted entry: 2249cfdd-ddfc-4233-8ede-e423374312e8
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 tasks with selector 0x862440e2
INFO:moonstreamapi.admin.migrations.add_selectors:Deleted entry: 35d9b53c-84f8-4b9f-bb38-80a71ddfb799
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 tasks with selector 0xc3d58168
INFO:moonstreamapi.admin.migrations.add_selectors:Deleted entry: 3c504088-94f2-415f-b0a9-48f8370cc34f
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 tasks with selector 0x4a39dc06
INFO:moonstreamapi.admin.migrations.add_selectors:Deleted entry: f043590c-80cb-4f9c-bab9-f207444689e2

command:

mnstr migrations run id 20230904 -c upgrade

Output:

INFO:moonstreamapi.admin.cli:Starting step fill_missing_selectors_in_moonworm_tasks: Get all moonworm jobs from moonworm journal and add selector tag if it not represent
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 moonworm tasks versions 1.0
INFO:moonstreamapi.admin.migrations.add_selectors:Found 0 missing selectors in batch 2 tasks
INFO:moonstreamapi.admin.cli:Starting step deduplicate_moonworm_tasks: Deduplicate moonworm tasks by selector
INFO:moonstreamapi.admin.migrations.add_selectors:Found 29 moonworm tasks versions 2.0
INFO:moonstreamapi.admin.migrations.add_selectors:Found 27 selectors
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 tasks with selector abi_selector:0x862440e2
INFO:moonstreamapi.admin.migrations.add_selectors:Deleted entry: 3d7c3a65-6670-4da5-a748-6ce38b5078d1
INFO:moonstreamapi.admin.migrations.add_selectors:Found 2 tasks with selector abi_selector:0x0e7afec5
INFO:moonstreamapi.admin.migrations.add_selectors:Deleted entry: 27ab45e1-91b5-4236-be79-665b71158c6b


entries_tags.append(
{
"entry_id": task.entry_url.split("/")[-1], ## 😭
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need entry id in tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It request for https://github.com/bugout-dev/spire/blob/171b6eb0f8ce9656308a4112deab76af59f662ea/spire/journal/api.py#L1772 that endpoint which get entries_ids and tags as array.

Copy link
Contributor

@kompotkot kompotkot left a comment

Choose a reason for hiding this comment

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

lg

@Andrei-Dolgolev Andrei-Dolgolev merged commit 38947e1 into main Feb 1, 2024
1 check failed
@kompotkot kompotkot deleted the migrate-moonworm-tasks branch February 1, 2024 10:37
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