Skip to content

Commit

Permalink
chore: erase traces of substratools
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultFy <[email protected]>
  • Loading branch information
ThibaultFy committed Oct 3, 2024
1 parent 4850947 commit ea0f33e
Show file tree
Hide file tree
Showing 20 changed files with 26 additions and 97 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/main-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ jobs:
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout pyconfig from a private repos
uses: actions/checkout@v4
with:
repository: substra/substra-tools
path: substratools

- name: Checkout pyconfig from a private repos
uses: actions/checkout@v4
with:
Expand All @@ -55,7 +49,6 @@ jobs:
pip install --upgrade pip
pip install --upgrade -e substrafl[dev]
pip install --upgrade -e substra
pip install --upgrade -e substratools
- name: Run the slow local tests
run: |
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ jobs:
cd substrafl
pre-commit run --all-files
- uses: actions/checkout@v4
with:
repository: substra/substra-tools
path: substratools

- uses: actions/checkout@v4
with:
repository: substra/substra
Expand All @@ -54,7 +49,6 @@ jobs:
run: |
pip install --upgrade -e substrafl[dev]
pip install --upgrade -e substra
pip install --upgrade -e substratools
- name: Run the fast local tests
run: |
Expand Down Expand Up @@ -87,15 +81,9 @@ jobs:
repository: substra/substra
path: substra

- uses: actions/checkout@v4
with:
repository: substra/substra-tools
path: substratools

- name: Install Dependencies
run: |
pip install --upgrade ./substra
pip install --upgrade -e ./substratools
pip install --upgrade .[dev]
pip install --upgrade -r docs/requirements.txt
Expand All @@ -120,11 +108,6 @@ jobs:
with:
path: substrafl

- uses: actions/checkout@v4
with:
repository: substra/substra-tools
path: substratools

- uses: actions/checkout@v4
with:
repository: substra/substra
Expand All @@ -147,7 +130,6 @@ jobs:
run: |
pip install --upgrade -e substrafl[dev]
pip install --upgrade -e substra
pip install --upgrade -e substratools
pip install --upgrade -r substrafl/benchmark/camelyon/requirements.txt
- name: Run the local benchmark
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/windows-subprocess-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Checkout pyconfig from a private repos
uses: actions/checkout@v4
with:
repository: substra/substra-tools
path: substratools

- name: Checkout pyconfig from a private repos
uses: actions/checkout@v4
with:
Expand All @@ -43,7 +37,6 @@ jobs:
run: |
pip install --upgrade -e "substrafl[dev]"
pip install --upgrade -e substra
pip install --upgrade -e substratools
- name: Run the subprocess tests
run: |
Expand Down
1 change: 0 additions & 1 deletion benchmark/camelyon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ After each run the [result file](./results/results.json) is populated with a new
"seed": 42,
"substra_version": "0.45.0",
"substrafl_version": "0.38.0",
"substratools_version": "0.20.0"
}
}
```
Expand Down
2 changes: 0 additions & 2 deletions benchmark/camelyon/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path

import substra
import substratools

import substrafl

Expand All @@ -22,7 +21,6 @@ def parse_params() -> dict:
"learning_rate": 0.01,
"substrafl_version": substrafl.__version__,
"substra_version": substra.__version__,
"substratools_version": substratools.__version__,
}

parser = argparse.ArgumentParser("Default parser.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/camelyon/pure_substrafl/assets/opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import List

import numpy as np
import substratools as tools
from substra import tools

logger = logging.getLogger(__name__)

Expand Down
10 changes: 2 additions & 8 deletions docs/technical/task_execution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ Base Dockerfile
^^^^^^^^^^^^^^^^

The Dockerfile describes the commands to run to create a container with all the needed dependencies.
Its base image is the substratools Docker image, accessible from the private Owkin docker registry (which is a google container registry).

The base image is chosen following two criteria:

- the version of Python is the same as the one the code is run with, to satisfy cloudpickle requirements
- the version of substratools is the version of the substratools installed in the Python environment (can be
overriden, see below). If the version is inferior to 0.10.0, we use 0.10.0 as the name of the substratools images
changed.
- the usage of GPU or not

This means that:

Expand All @@ -48,7 +45,6 @@ Substrafl dependencies

Substrafl needs the following libraries to be installed in the container:

- substratools
- substra
- substrafl

Expand All @@ -59,7 +55,7 @@ Substra.

There are two modes: the **release mode** and the **editable mode**, chosen with the ``editable_mode`` parameter in the ``dependency`` argument.

In **release mode**, Substrafl downloads the wheels of substra and substrafl (substratools is already installed) from
In **release mode**, Substrafl downloads the wheels of substra and substrafl from
the private Owkin PyPi and copies them to the Docker image. The download is made through a subprocess, and it needs pip
to be configured to access Owkin's PyPi.

Expand All @@ -73,8 +69,6 @@ Substrafl is executed with. The script goes through each library, and:
Then copy the wheel to the Docker image.
This is not the preferred method as it can lead to difficulties of knowing which version was used: there may be local changes to the code.

Please note that in editable mode substratools is re-installed in the image.


User dependencies
^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies = [
"numpy>=1.24",
"cloudpickle>=1.6.0",
"substra~=0.54.0",
"substratools~=0.22.0",
"pydantic>=2.3.0,<3.0",
"pip>=21.2",
"tqdm",
Expand Down
4 changes: 1 addition & 3 deletions substrafl/dependency/manage_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,14 @@ def local_lib_wheels(lib_modules: List[ModuleType], *, dest_dir: Path) -> List[s
lib_name = lib_module.__name__
wheel_name = f"{lib_name}-{lib_module.__version__}-py3-none-any.whl"

# if the right version of substra or substratools is not found, it will search if they are already
# if the right version of substra is not found, it will search if they are already
# installed in 'dist' and take them from there.
# sys.executable takes the current Python interpreter instead of the default one on the computer

extra_args = (
[
"--find-links",
dest_dir.parent / "substra",
"--find-links",
dest_dir.parent / "substratools",
]
if lib_name == "substrafl"
else []
Expand Down
9 changes: 3 additions & 6 deletions substrafl/dependency/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import Optional

import substra
import substratools
from pydantic import BaseModel
from pydantic import ConfigDict
from pydantic import Field
Expand All @@ -31,7 +30,7 @@ class Dependency(BaseModel):
**local-worker** or with **tmp_substrafl** as prefix are ignored during the installation.
Args:
editable_mode (bool): If set to False, substra, substrafl and substratools used in the
editable_mode (bool): If set to False, substra and substrafl used in the
Dockerfiles submitted to Substra platform will be taken from pypi.
If set to True, it will be the one installed in editable mode from your python environment.
Defaults to False.
Expand Down Expand Up @@ -177,8 +176,7 @@ def _compute(self, dest_dir: Path) -> None:
└── substrafl_internal
├── dist
│ ├── substra-0.44.0-py3-none-any.whl
│ ├── substrafl-0.36.0-py3-none-any.whl
│ └── substratools-0.20.0-py3-none-any.whl
│ └── substrafl-0.36.0-py3-none-any.whl
├── local_dependencies
│ └── local-module-1.6.1-py3-none-any.whl
├── requirements.in # only if compile set to True
Expand All @@ -195,8 +193,7 @@ def _compute(self, dest_dir: Path) -> None:
lib_modules=[
substrafl,
substra,
substratools,
], # We reinstall substratools in editable mode to overwrite the installed version
],
dest_dir=substra_wheel_dir,
)
self._wheels += [substra_wheel_dir.relative_to(dest_dir) / wheel_name for wheel_name in substra_wheels]
Expand Down
6 changes: 1 addition & 5 deletions substrafl/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ class BatchSizeNotFoundError(Exception):
"""No batch size found."""


class SubstraToolsDeprecationWarning(DeprecationWarning):
"""The substratools version used is deprecated."""


class UnsupportedPythonVersionError(Exception):
"""The Python version used is not supported by Substra."""

Expand Down Expand Up @@ -72,7 +68,7 @@ class InvalidMetricIdentifierError(Exception):


class KeyMetadataError(Exception):
"""``substrafl_version``, ``substra_version`` and ``substratools_version`` keys can't be added
"""``substrafl_version`` and ``substra_version`` keys can't be added
to the experiment metadata."""


Expand Down
10 changes: 4 additions & 6 deletions substrafl/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from typing import Union

import substra
import substratools

import substrafl
from substrafl.compute_plan_builder import ComputePlanBuilder
Expand Down Expand Up @@ -183,7 +182,7 @@ def _check_evaluation_strategy(


def _check_additional_metadata(additional_metadata: Dict):
unauthorized_keys = {"substrafl_version", "substra_version", "substratools_version", "python_version"}
unauthorized_keys = {"substrafl_version", "substra_version", "python_version"}
invalid_keys = set(additional_metadata.keys()).intersection(unauthorized_keys)

if len(invalid_keys) > 0:
Expand All @@ -200,16 +199,15 @@ def _check_additional_metadata(additional_metadata: Dict):


def _get_packages_versions() -> dict:
"""Returns a dict containing substrafl, substra and substratools versions
"""Returns a dict containing substrafl and substra versions
Returns:
dict: substrafl, substra and substratools versions
dict: substrafl and substra versions
"""

return {
"substrafl_version": substrafl.__version__,
"substra_version": substra.__version__,
"substratools_version": substratools.__version__,
"python_version": python_version(),
}

Expand Down Expand Up @@ -452,7 +450,7 @@ def execute_experiment(
_check_additional_metadata(additional_metadata)
cp_metadata.update(additional_metadata)

# Adding substrafl, substratools and substra versions to the cp metadata
# Adding substrafl and substra versions to the cp metadata
cp_metadata.update(_get_packages_versions())

logger.info("Building the compute plan.")
Expand Down
3 changes: 1 addition & 2 deletions substrafl/model_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Optional

import substra
import substratools
from substra.sdk.models import ComputeTaskStatus

import substrafl
Expand All @@ -21,7 +20,7 @@

logger = logging.getLogger(__name__)

REQUIRED_LIBS = [substrafl, substra, substratools]
REQUIRED_LIBS = [substrafl, substra]
REQUIRED_KEYS = set([lib.__name__ + "_version" for lib in REQUIRED_LIBS] + ["python_version"])
METADATA_FILE = "metadata.json"
FUNCTION_DICT_KEY = "function_file"
Expand Down
5 changes: 2 additions & 3 deletions substrafl/nodes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import List

import substra
import substratools


def preload_data(
Expand All @@ -24,9 +23,9 @@ def preload_data(
"""
dataset_info = client.get_dataset(data_manager_key)

opener_interface = substratools.utils.load_interface_from_module(
opener_interface = substra.tools.utils.load_interface_from_module(
"opener",
interface_class=substratools.Opener,
interface_class=substra.tools.Opener,
interface_signature=None,
path=dataset_info.opener.storage_address,
)
Expand Down
10 changes: 3 additions & 7 deletions substrafl/remote/register/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

logger = logging.getLogger(__name__)

# Substra tools version for which the image naming scheme changed
MINIMAL_DOCKER_SUBSTRATOOLS_VERSION = "0.16.0"

# minimal and maximal values of Python 3 minor versions supported
# we need to store this as integer, else "3.11" < "3.9" (string comparison)
MINIMAL_PYTHON_VERSION = 10 # 3.10
Expand Down Expand Up @@ -100,7 +97,7 @@
import json
import cloudpickle
import substratools as tools
from substra import tools
from substrafl.remote.remote_struct import RemoteStruct
Expand Down Expand Up @@ -182,7 +179,7 @@ def _create_dockerfile(install_libraries: bool, dependencies: Dependency, operat
use_gpu=dependencies.use_gpu,
custom_binary_dependencies=dependencies.binary_dependencies,
)
# Build Substrafl, Substra and Substratools, and local dependencies wheels if necessary
# Build Substrafl and Substra, and local dependencies wheels if necessary
if install_libraries:
# generate the copy wheel command
copy_wheels_cmd = _generate_copy_local_files(dependencies._wheels)
Expand Down Expand Up @@ -230,8 +227,7 @@ def _create_substra_function_files(
├── description.md
├── dist
│ ├── substra-0.44.0-py3-none-any.whl
│ ├── substrafl-0.36.0-py3-none-any.whl
│ └── substratools-0.20.0-py3-none-any.whl
│ └── substrafl-0.36.0-py3-none-any.whl
├── local_dependencies
│ └── local-module-1.6.1-py3-none-any.whl
├── requirements.in
Expand Down
4 changes: 2 additions & 2 deletions substrafl/remote/substratools_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import TypedDict
from typing import Union

import substratools as tools
from substra import tools

from substrafl.nodes.schemas import InputIdentifiers
from substrafl.nodes.schemas import OutputIdentifiers
Expand Down Expand Up @@ -158,7 +158,7 @@ def save_instance(self, path: Union[str, os.PathLike]) -> None:
self.instance.save_local_state(Path(path))

def register_substratools_function(self):
"""Register the function that can be accessed and executed by substratools."""
"""Register the function that can be accessed and executed by substra."""

tools.register(
function=self.generic_function,
Expand Down
Loading

0 comments on commit ea0f33e

Please sign in to comment.