Skip to content

Commit

Permalink
rename directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mski-iksm committed Feb 23, 2024
1 parent a5252c8 commit 66b0361
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion gokart/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
import pandas as pd
from tqdm import tqdm

from gokart.collision_lock.redis_lock import RedisParams, make_redis_params, wrap_with_dump_lock, wrap_with_load_lock, wrap_with_remove_lock, wrap_with_run_lock
from gokart.conflict_prevention_lock.task_conflict_prevention_lock import (
RedisParams,
make_redis_params,
wrap_with_dump_lock,
wrap_with_load_lock,
wrap_with_remove_lock,
wrap_with_run_lock,
)
from gokart.file_processor import FileProcessor, make_file_processor
from gokart.object_storage import ObjectStorage
from gokart.zip_client_util import make_zip_client
Expand Down
2 changes: 1 addition & 1 deletion gokart/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from luigi.parameter import ParameterVisibility

import gokart
from gokart.collision_lock.redis_lock import make_redis_params
from gokart.conflict_prevention_lock.task_conflict_prevention_lock import make_redis_params
from gokart.file_processor import FileProcessor
from gokart.pandas_type_config import PandasTypeConfigMap
from gokart.parameter import ExplicitBoolParameter, ListTaskInstanceParameter, TaskInstanceParameter
Expand Down
36 changes: 18 additions & 18 deletions test/collision_lock/test_redis_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import fakeredis

from gokart.collision_lock.redis_lock import (
from gokart.conflict_prevention_lock.task_conflict_prevention_lock import (
RedisClient,
RedisParams,
make_redis_key,
Expand Down Expand Up @@ -70,7 +70,7 @@ def test_use_redis(self):
redis_port=12345,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
mock_func = MagicMock()
redis_mock.side_effect = fakeredis.FakeRedis
resulted = wrap_with_run_lock(func=mock_func, redis_params=redis_params)(123, b='abc')
Expand All @@ -91,7 +91,7 @@ def test_check_lock_extended(self):
lock_extend_seconds=1,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
resulted = wrap_with_run_lock(func=_sample_long_func, redis_params=redis_params)(123, b='abc')
expected = dict(a=123, b='abc')
Expand All @@ -107,7 +107,7 @@ def test_lock_is_removed_after_func_is_finished(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
mock_func = MagicMock()
resulted = wrap_with_run_lock(func=mock_func, redis_params=redis_params)(123, b='abc')
Expand All @@ -132,7 +132,7 @@ def test_lock_is_removed_after_func_is_finished_with_error(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
try:
wrap_with_run_lock(func=_sample_func_with_error, redis_params=redis_params)(a=123, b='abc')
Expand Down Expand Up @@ -166,7 +166,7 @@ def test_use_redis(self):
redis_port=12345,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
mock_func = MagicMock()
wrap_with_dump_lock(func=mock_func, redis_params=redis_params, exist_check=lambda: False)(123, b='abc')
Expand All @@ -184,7 +184,7 @@ def test_if_func_is_skipped_when_cache_already_exists(self):
redis_port=12345,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
mock_func = MagicMock()
wrap_with_dump_lock(func=mock_func, redis_params=redis_params, exist_check=lambda: True)(123, b='abc')
Expand All @@ -201,7 +201,7 @@ def test_check_lock_extended(self):
lock_extend_seconds=1,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
wrap_with_dump_lock(func=_sample_long_func, redis_params=redis_params, exist_check=lambda: False)(123, b='abc')

Expand All @@ -215,7 +215,7 @@ def test_lock_is_removed_after_func_is_finished(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
mock_func = MagicMock()
wrap_with_dump_lock(func=mock_func, redis_params=redis_params, exist_check=lambda: False)(123, b='abc')
Expand All @@ -239,7 +239,7 @@ def test_lock_is_removed_after_func_is_finished_with_error(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
try:
wrap_with_dump_lock(func=_sample_func_with_error, redis_params=redis_params, exist_check=lambda: False)(123, b='abc')
Expand Down Expand Up @@ -275,7 +275,7 @@ def test_use_redis(self):
redis_port=12345,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
mock_func = MagicMock()
resulted = wrap_with_load_lock(func=mock_func, redis_params=redis_params)(123, b='abc')
Expand All @@ -297,7 +297,7 @@ def test_check_lock_extended(self):
lock_extend_seconds=1,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
resulted = wrap_with_load_lock(func=_sample_long_func, redis_params=redis_params)(123, b='abc')
expected = dict(a=123, b='abc')
Expand All @@ -313,7 +313,7 @@ def test_lock_is_removed_after_func_is_finished(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
mock_func = MagicMock()
resulted = wrap_with_load_lock(func=mock_func, redis_params=redis_params)(123, b='abc')
Expand All @@ -338,7 +338,7 @@ def test_lock_is_removed_after_func_is_finished_with_error(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
try:
wrap_with_load_lock(func=_sample_func_with_error, redis_params=redis_params)(123, b='abc')
Expand Down Expand Up @@ -373,7 +373,7 @@ def test_use_redis(self):
redis_port=12345,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
mock_func = MagicMock()
resulted = wrap_with_remove_lock(func=mock_func, redis_params=redis_params)(123, b='abc')
Expand All @@ -394,7 +394,7 @@ def test_check_lock_extended(self):
lock_extend_seconds=1,
)

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.side_effect = fakeredis.FakeRedis
resulted = wrap_with_remove_lock(func=_sample_long_func, redis_params=redis_params)(123, b='abc')
expected = dict(a=123, b='abc')
Expand All @@ -410,7 +410,7 @@ def test_lock_is_removed_after_func_is_finished(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
mock_func = MagicMock()
resulted = wrap_with_remove_lock(func=mock_func, redis_params=redis_params)(123, b='abc')
Expand All @@ -434,7 +434,7 @@ def test_lock_is_removed_after_func_is_finished_with_error(self):

server = fakeredis.FakeServer()

with patch('gokart.collision_lock.redis_lock.redis.Redis') as redis_mock:
with patch('gokart.conflict_prevention_lock.task_conflict_prevention_lock.redis.Redis') as redis_mock:
redis_mock.return_value = fakeredis.FakeRedis(server=server, host=redis_params.redis_host, port=redis_params.redis_port)
try:
wrap_with_remove_lock(func=_sample_func_with_error, redis_params=redis_params)(123, b='abc')
Expand Down
2 changes: 1 addition & 1 deletion test/test_task_on_kart.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from luigi.util import inherits

import gokart
from gokart.collision_lock.run_with_lock import RunWithLock
from gokart.conflict_prevention_lock.run_with_lock import RunWithLock
from gokart.file_processor import XmlFileProcessor
from gokart.parameter import ListTaskInstanceParameter, TaskInstanceParameter
from gokart.target import ModelTarget, SingleFileTarget, TargetOnKart
Expand Down

0 comments on commit 66b0361

Please sign in to comment.