Sega76 commented on a change in pull request #9142:
URL: https://github.com/apache/ignite/pull/9142#discussion_r656135152



##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance/util.py
##########
@@ -0,0 +1,290 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Utils for rebalanced tests.
+"""
+
+import sys
+from enum import IntEnum
+from typing import NamedTuple
+
+# pylint: disable=W0622
+from ducktape.errors import TimeoutError
+
+# pylint: disable=too-many-arguments
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import 
IgniteConfiguration, DataStorageConfiguration
+from ignitetest.services.utils.ignite_configuration.data_storage import 
DataRegionConfiguration
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.version import IgniteVersion
+
+NUM_NODES = 4
+DEFAULT_DATA_REGION_SZ = 1 << 30
+
+
+@constructible
+class TriggerEvent(IntEnum):
+    """
+    Rebalance trigger event.
+    """
+    NODE_JOIN = 0
+    NODE_LEFT = 1
+
+
+# pylint: disable=R0914
+def preload_data(context, config, preloaders, backups, cache_count, 
entry_count, entry_size, timeout=3600):
+    """
+    Puts entry_count of key-value pairs of entry_size bytes to cache_count 
caches.
+    :param context: Test context.
+    :param config: Ignite configuration.
+    :param preloaders: Preload client nodes count.
+    :param backups: Cache backups count.
+    :param cache_count: Cache count.
+    :param entry_count: Cache entry count.
+    :param entry_size: Entry size in bytes.
+    :param timeout: Timeout in seconds for application finished.
+    :return: Time taken for data preloading.
+    """
+    assert preloaders > 0
+    assert cache_count > 0
+    assert entry_count > 0
+    assert entry_size > 0
+
+    apps = []
+
+    def start_app(from_, to_):
+        app0 = IgniteApplicationService(
+            context,
+            config=config,
+            
java_class_name="org.apache.ignite.internal.ducktest.tests.rebalance.DataGenerationApplication",
+            params={
+                "backups": backups,
+                "cacheCount": cache_count,
+                "entrySize": entry_size,
+                "from": from_,
+                "to": to_
+            },
+            shutdown_timeout_sec=timeout)
+        app0.start_async()
+
+        apps.append(app0)
+
+    count = int(entry_count / preloaders)
+    _from = 0

Review comment:
       fixed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to