Skip to content
Snippets Groups Projects
Verified Commit 9847cad5 authored by Konrad Botor's avatar Konrad Botor
Browse files

Updated HAF submodule and cleanup jobs.

parent 38a2d541
No related branches found
No related tags found
2 merge requests!827Merge develop changes to master,!696Updated HAF submodule and cleanup jobs.
...@@ -33,8 +33,11 @@ variables: ...@@ -33,8 +33,11 @@ variables:
include: include:
- template: Workflows/Branch-Pipelines.gitlab-ci.yml - template: Workflows/Branch-Pipelines.gitlab-ci.yml
- project: hive/haf - project: hive/haf
ref: 7bb7aab44a7083994c36f040e84d501c11afc159 # develop ref: e9d964849997e0cb18903f0910c4bdb293997195 # develop
file: /scripts/ci-helpers/prepare_data_image_job.yml # implicitly pulls base.gitlab-ci.yml from common-ci-configuration file: /scripts/ci-helpers/prepare_data_image_job.yml # implicitly pulls base.gitlab-ci.yml from common-ci-configuration
- project: hive/common-ci-configuration
ref: 91d072682e22869aea3acd7affa20db0f6a7a2c8
file: /templates/cache_cleanup.gitlab-ci.yml
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| ANCHORS |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| ANCHORS |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
...@@ -293,22 +296,20 @@ prepare_hivemind_image: ...@@ -293,22 +296,20 @@ prepare_hivemind_image:
tags: *shared_tags tags: *shared_tags
cleanup_hivemind_haf_cache_manual: cleanup_hivemind_haf_cache_manual:
extends: .cleanup_cache_manual extends: .cleanup_cache_manual_template
stage: cleanup stage: cleanup
variables: variables:
CLEANUP_PATH_PATTERN: "/cache/replay_data_hivemind_*" CLEANUP_PATH_PATTERN: "/cache/replay_data_hivemind_*"
resource_group: ${CI_COMMIT_SHA}
tags: tags:
- data-cache-storage - data-cache-storage
# This job cleans up both Hivemind-specific cache and cache shared between projects, so it should be used in emergencies only. # This job cleans up both Hivemind-specific cache and cache shared between projects, so it should be used in emergencies only.
# For example, if prepare_haf_data job fails in the same way in Hivemind and HAfAH. # For example, if prepare_haf_data job fails in the same way in Hivemind and HAfAH.
cleanup_haf_cache_manual: cleanup_haf_cache_manual:
extends: .cleanup_cache_manual extends: .cleanup_cache_manual_template
stage: cleanup stage: cleanup
variables: variables:
CLEANUP_PATH_PATTERN: "/cache/replay_data_hivemind_* /cache/replay_data_haf_*" CLEANUP_PATH_PATTERN: "/cache/replay_data_hivemind_* /cache/replay_data_haf_*"
resource_group: ${CI_COMMIT_SHA}
tags: tags:
- data-cache-storage - data-cache-storage
......
Subproject commit 7bb7aab44a7083994c36f040e84d501c11afc159 Subproject commit e9d964849997e0cb18903f0910c4bdb293997195
...@@ -2,7 +2,7 @@ DROP TYPE IF EXISTS hivemind_app.hive_api_operation CASCADE; ...@@ -2,7 +2,7 @@ DROP TYPE IF EXISTS hivemind_app.hive_api_operation CASCADE;
CREATE TYPE hivemind_app.hive_api_operation AS ( CREATE TYPE hivemind_app.hive_api_operation AS (
id BIGINT, id BIGINT,
block_num INT, block_num INT,
operation_type_id SMALLINT, operation_type_id INTEGER,
is_virtual BOOLEAN, is_virtual BOOLEAN,
body VARCHAR body VARCHAR
); );
......
...@@ -59,6 +59,7 @@ VALUES ...@@ -59,6 +59,7 @@ VALUES
class OperationBase: class OperationBase:
operation_id: Optional[int] = None operation_id: Optional[int] = None
pos_in_block: Optional[int] = 1
def __init__(self, block_number: int, body: dict): def __init__(self, block_number: int, body: dict):
self._block_number = block_number self._block_number = block_number
...@@ -85,11 +86,17 @@ class OperationBase: ...@@ -85,11 +86,17 @@ class OperationBase:
def push(self) -> None: def push(self) -> None:
sql = """ sql = """
INSERT INTO INSERT INTO
hive.operations (id, block_num, trx_in_block, op_pos, op_type_id, timestamp, body_binary) hive.operations (id, trx_in_block, op_pos, timestamp, body_binary)
VALUES VALUES
(:id, :block_num, -2, -2, :op_type_id, now(), :body :: jsonb :: hive.operation); (:id, -2, -2, now(), :body :: jsonb :: hive.operation);
""" """
OperationBase.operation_id += 1 OperationBase.pos_in_block += 1
OperationBase.operation_id = Db.instance().query_one(sql='SELECT operation_id FROM hive.operation_id(:block_num, :op_type_id, :pos_in_block);',
block_num=self.block_number,
op_type_id=self.type.value,
pos_in_block=OperationBase.pos_in_block,
)
log.info( log.info(
f'Attempting to push mocked {self.__class__.__name__} - type: {self.type} id: {OperationBase.operation_id}' f'Attempting to push mocked {self.__class__.__name__} - type: {self.type} id: {OperationBase.operation_id}'
...@@ -98,8 +105,6 @@ VALUES ...@@ -98,8 +105,6 @@ VALUES
Db.instance().query( Db.instance().query(
sql=sql, sql=sql,
id=OperationBase.operation_id, id=OperationBase.operation_id,
block_num=self.block_number,
op_type_id=self.type.value,
body=json.dumps(self.body), body=json.dumps(self.body),
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment