Skip to content

Commit f8184bd

Browse files
refactor(core): remove LocalClient (#3139)
1 parent a46450d commit f8184bd

File tree

175 files changed

+2930
-3628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+2930
-3628
lines changed

docs/cheatsheet/conf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,13 @@
190190
("py:class", "DiGraph"),
191191
("py:class", "DynamicProxy"),
192192
("py:class", "IActivityGateway"),
193-
("py:class", "IClientDispatcher"),
194193
("py:class", "IDatasetGateway"),
195194
("py:class", "IPlanGateway"),
196-
("py:class", "LocalClient"),
197195
("py:class", "NoValueType"),
198196
("py:class", "OID_TYPE"),
199197
("py:class", "Path"),
200198
("py:class", "Persistent"),
201199
("py:class", "optional"),
202-
("py:class", '"LocalClient"'),
203200
("py:class", '"ValueResolver"'),
204201
("py:exc", "errors.ParameterError"),
205202
]

docs/conf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,14 @@
355355
("py:class", "DiGraph"),
356356
("py:class", "DynamicProxy"),
357357
("py:class", "IActivityGateway"),
358-
("py:class", "IClientDispatcher"),
359358
("py:class", "IDatasetGateway"),
360359
("py:class", "IPlanGateway"),
361360
("py:class", "IStorageFactory"),
362-
("py:class", "LocalClient"),
363361
("py:class", "NoValueType"),
364362
("py:class", "OID_TYPE"),
365363
("py:class", "Path"),
366364
("py:class", "Persistent"),
367365
("py:class", "optional"),
368-
("py:class", '"LocalClient"'),
369366
("py:class", '"ValueResolver"'),
370367
("py:exc", "errors.ParameterError"),
371368
]

docs/reference/gateways.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ Interfaces that the Gateways implement.
3131
:members:
3232
:show-inheritance:
3333

34-
.. automodule:: renku.core.interface.client_dispatcher
35-
:members:
36-
:show-inheritance:
37-
3834
.. automodule:: renku.core.interface.database_gateway
3935
:members:
4036
:show-inheritance:

renku/command/checks/activities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
import click
2323

2424
from renku.command.command_builder import inject
25-
from renku.command.echo import WARNING
25+
from renku.command.util import WARNING
2626
from renku.core.interface.activity_gateway import IActivityGateway
2727
from renku.core.util import communication
2828
from renku.domain_model.project_context import project_context
2929

3030

3131
@inject.autoparams("activity_gateway")
32-
def check_migrated_activity_ids(client, fix, activity_gateway: IActivityGateway, **kwargs):
32+
def check_migrated_activity_ids(fix, activity_gateway: IActivityGateway, **_):
3333
"""Check that activity ids were correctly migrated in the past."""
3434
activities = activity_gateway.get_all_activities(include_deleted=True)
3535

renku/command/checks/datasets.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import click
2424

2525
from renku.command.command_builder import inject
26-
from renku.command.echo import WARNING
26+
from renku.command.util import WARNING
2727
from renku.core import errors
2828
from renku.core.dataset.dataset_add import add_to_dataset
2929
from renku.core.interface.dataset_gateway import IDatasetGateway
@@ -33,12 +33,11 @@
3333
from renku.domain_model.project_context import project_context
3434

3535

36-
def check_dataset_old_metadata_location(client, **kwargs):
36+
def check_dataset_old_metadata_location(**_):
3737
"""Check location of dataset metadata.
3838
3939
Args:
40-
client: ``LocalClient``.
41-
kwargs: keyword arguments.
40+
_: keyword arguments.
4241
4342
Returns:
4443
Tuple of whether dataset metadata location is valid and string of found problems.
@@ -59,13 +58,12 @@ def check_dataset_old_metadata_location(client, **kwargs):
5958

6059

6160
@inject.autoparams("dataset_gateway")
62-
def check_missing_files(client, dataset_gateway: IDatasetGateway, **kwargs):
61+
def check_missing_files(dataset_gateway: IDatasetGateway, **_):
6362
"""Find missing files listed in datasets.
6463
6564
Args:
66-
client: ``LocalClient``.
6765
dataset_gateway(IDatasetGateway): the dataset gateway.
68-
kwargs: keyword arguments.
66+
_: keyword arguments.
6967
7068
Returns:
7169
Tuple of whether all dataset files are there and string of found problems.
@@ -96,14 +94,13 @@ def check_missing_files(client, dataset_gateway: IDatasetGateway, **kwargs):
9694

9795

9896
@inject.autoparams("dataset_gateway")
99-
def check_invalid_datasets_derivation(client, fix, dataset_gateway: IDatasetGateway, **kwargs):
97+
def check_invalid_datasets_derivation(fix, dataset_gateway: IDatasetGateway, **_):
10098
"""Remove ``derived_from`` from import datasets.
10199
102100
Args:
103-
client: ``LocalClient``.
104101
fix: Whether to fix found issues.
105102
dataset_gateway(IDatasetGateway): the dataset gateway.
106-
kwargs: keyword arguments.
103+
_: keyword arguments.
107104
108105
Returns:
109106
Tuple of whether dataset derivations are valid and string of found problems.
@@ -146,14 +143,13 @@ def fix_or_report(dataset):
146143

147144

148145
@inject.autoparams("dataset_gateway")
149-
def check_dataset_files_outside_datadir(client, fix, dataset_gateway: IDatasetGateway, **kwargs):
146+
def check_dataset_files_outside_datadir(fix, dataset_gateway: IDatasetGateway, **_):
150147
"""Check for dataset files that are not inside a dataset's datadir.
151148
152149
Args:
153-
client: ``LocalClient``.
154150
fix: Whether to fix found issues.
155151
dataset_gateway(IDatasetGateway): the dataset gateway.
156-
kwargs: keyword arguments.
152+
_: keyword arguments.
157153
158154
Returns:
159155
Tuple of whether there are no dataset files outside of its datadir and string of found problems.

renku/command/checks/external.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,20 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818
"""Checks for external files."""
19-
import click
2019

2120
from renku.command.command_builder import inject
22-
from renku.command.echo import WARNING
21+
from renku.command.util import WARNING, red_text, yellow_text
2322
from renku.core.interface.dataset_gateway import IDatasetGateway
2423
from renku.domain_model.project_context import project_context
2524

2625

2726
@inject.autoparams("dataset_gateway")
28-
def check_missing_external_files(client, dataset_gateway: IDatasetGateway, **kwargs):
27+
def check_missing_external_files(dataset_gateway: IDatasetGateway, **_):
2928
"""Find external files that are missing.
3029
3130
Args:
32-
client: ``LocalClient``.
3331
dataset_gateway(IDatasetGateway): The injected dataset gateway.
34-
kwargs: keyword arguments.
32+
_: keyword arguments.
3533
3634
Returns:
3735
Tuple of whether no external files are missing and string of found problems.
@@ -48,13 +46,9 @@ def check_missing_external_files(client, dataset_gateway: IDatasetGateway, **kwa
4846
if not missing:
4947
return True, None
5048

49+
missing_str = "\n\t".join(f"{yellow_text(path)} -> {red_text(target)}" for path, target in missing)
5150
problems = (
52-
"\n" + WARNING + "There are missing external files.\n"
53-
" (make sure that external paths are accessible)"
54-
+ "\n\n\t"
55-
+ "\n\t".join(
56-
click.style(path, fg="yellow") + " -> " + click.style(target, fg="red") for path, target in missing
57-
)
58-
+ "\n"
51+
f"\n{WARNING}There are missing external files.\n (make sure that external paths are accessible)"
52+
f"\n\n\t{missing_str}\n"
5953
)
6054
return False, problems

renku/command/checks/githooks.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from io import StringIO
2121

22-
from renku.command.echo import WARNING
22+
from renku.command.util import WARNING
2323
from renku.core.githooks import HOOKS
2424
from renku.core.util.git import get_hook_path
2525
from renku.domain_model.project_context import project_context
@@ -30,12 +30,11 @@
3030
import importlib.resources as importlib_resources # type: ignore
3131

3232

33-
def check_git_hooks_installed(client, **kwargs):
33+
def check_git_hooks_installed(**_):
3434
"""Checks if all necessary hooks are installed.
3535
3636
Args:
37-
client: ``LocalClient``.
38-
kwargs: keyword arguments.
37+
_: keyword arguments.
3938
4039
Returns:
4140
Tuple of whether git hooks are valid and string of found problems.
@@ -65,8 +64,8 @@ def check_git_hooks_installed(client, **kwargs):
6564
return True, None
6665

6766

68-
def _extract_renku_hook(file_):
69-
lines = [line.strip() for line in file_ if line.strip()]
67+
def _extract_renku_hook(file):
68+
lines = [line.strip() for line in file if line.strip()]
7069
start = end = -1
7170
for index, line in enumerate(lines):
7271
if line.startswith("# RENKU HOOK."):

renku/command/checks/migration.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818
"""Warn if migration is required."""
19-
from renku.command.echo import ERROR, WARNING
20-
from renku.core.management.migrate import is_migration_required, is_project_unsupported
2119

20+
from renku.command.util import ERROR, WARNING
21+
from renku.core.migration.migrate import is_migration_required, is_project_unsupported
2222

23-
def check_migration(client, **kwargs):
23+
24+
def check_migration(**_):
2425
"""Check for project version.
2526
2627
Args:
27-
client: ``LocalClient``.
28-
kwargs: keyword arguments.
28+
_: keyword arguments.
2929
3030
Returns:
3131
Tuple of whether project metadata is up to date and string of found problems.

renku/command/checks/project.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,30 @@
1818
"""Checks needed to determine integrity of the project."""
1919

2020
from renku.command.command_builder import inject
21-
from renku.command.echo import WARNING
21+
from renku.command.util import WARNING
2222
from renku.core.interface.project_gateway import IProjectGateway
2323
from renku.core.util import communication
2424
from renku.domain_model.project import Project
25+
from renku.domain_model.project_context import project_context
2526

2627

2728
@inject.autoparams("project_gateway")
28-
def check_project_id_group(client, fix, project_gateway: IProjectGateway, **kwargs):
29+
def check_project_id_group(fix, project_gateway: IProjectGateway, **_):
2930
"""Check that projects in groups have the correct id set.
3031
3132
Args:
32-
client: ``LocalClient``.
3333
fix: Whether to fix found issues.
3434
project_gateway: Injected project gateway.
35-
kwargs: keyword arguments.
35+
_: keyword arguments.
3636
3737
Returns:
3838
Tuple of whether project id is valid.
3939
"""
4040
current_project = project_gateway.get_project()
4141

42-
namespace, name = Project.get_namespace_and_name(use_project_context=True)
42+
namespace, name = Project.get_namespace_and_name(
43+
remote=project_context.remote, repository=project_context.repository
44+
)
4345

4446
if namespace is None or name is None:
4547
return True, None

renku/command/checks/storage.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717
# limitations under the License.
1818
"""Check for large files in Git history."""
1919

20-
from renku.command.echo import WARNING
20+
from renku.command.util import WARNING
2121
from renku.core.storage import check_external_storage, check_lfs_migrate_info
2222

2323

24-
def check_lfs_info(client, **kwargs):
24+
def check_lfs_info(**_):
2525
"""Checks if files in history should be in LFS.
2626
2727
Args:
28-
client: ``LocalClient``
29-
kwargs: keyword arguments.
28+
_: keyword arguments.
3029
3130
Returns:
3231
Tuple of whether project structure is valid and string of found problems.

0 commit comments

Comments
 (0)