Skip to content

Commit

Permalink
chore: changelog
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultFy <[email protected]>
  • Loading branch information
ThibaultFy committed Aug 31, 2023
1 parent cc31fd8 commit 520e720
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- warning and help message when logging in with username/password rather than token ([#378](https://github.com/Substra/substra/pull/378))
- new `Client.logout` function, mirroring `Client.login` ([#381](https://github.com/Substra/substra/pull/381))
- `Client` can now be used within a context manager ([#381](https://github.com/Substra/substra/pull/381))

```python
with Client(
client_name="org-1",
Expand All @@ -29,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- change how API responses are parsed to match server changes ([#379](https://github.com/Substra/substra/pull/379))
- `Client` will now terminate the sessions it starts when given username & password ([#381](https://github.com/Substra/substra/pull/381))
- Update to pydantic 2.3.0 ([#375](https://github.com/Substra/substra/pull/375))

### Fixed

Expand Down
42 changes: 6 additions & 36 deletions substra/sdk/backends/local/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import warnings
from datetime import datetime
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import NoReturn
Expand Down Expand Up @@ -298,8 +299,8 @@ def _add_function(self, key, spec, spec_options=None):
"storage_address": function_description_path,
},
metadata=spec.metadata if spec.metadata else dict(),
inputs=_function_input_model_from_schema(spec.inputs) or [],
outputs=_function_output_model_from_schema(spec.outputs) or [],
inputs=_schemas_list_to_models_list(spec.inputs, models.FunctionInput) or [],
outputs=_schemas_list_to_models_list(spec.outputs, models.FunctionOutput) or [],
)
return self._db.add(function)

Expand Down Expand Up @@ -422,7 +423,7 @@ def _add_task(self, key, spec, spec_options=None):
worker=spec.worker,
compute_plan_key=compute_plan_key,
rank=rank,
inputs=_input_ref_model_from_schema(spec.inputs),
inputs=_schemas_list_to_models_list(spec.inputs, models.InputRef),
outputs=_output_from_spec(spec.outputs),
tag=spec.tag or "",
status=models.Status.waiting,
Expand Down Expand Up @@ -598,39 +599,8 @@ def _output_from_spec(outputs: Dict[str, schemas.ComputeTaskOutputSpec]) -> Dict
}


def _input_ref_model_from_schema(inputs: List[schemas.InputRef]) -> List[models.InputRef]:
return [
models.InputRef(
identifier=input_ref_schemas.identifier,
asset_key=input_ref_schemas.asset_key,
parent_task_key=input_ref_schemas.parent_task_key,
parent_task_output_identifier=input_ref_schemas.parent_task_output_identifier,
)
for input_ref_schemas in inputs
]


def _function_input_model_from_schema(inputs: List[schemas.FunctionInputSpec]) -> List[models.FunctionInput]:
return [
models.FunctionInput(
identifier=function_input_schemas.identifier,
multiple=function_input_schemas.multiple,
optional=function_input_schemas.optional,
kind=function_input_schemas.kind,
)
for function_input_schemas in inputs
]


def _function_output_model_from_schema(inputs: List[schemas.FunctionOutputSpec]) -> List[models.FunctionOutput]:
return [
models.FunctionOutput(
identifier=function_output_schemas.identifier,
multiple=function_output_schemas.multiple,
kind=function_output_schemas.kind,
)
for function_output_schemas in inputs
]
def _schemas_list_to_models_list(inputs: Any, model: Any) -> Any:
return [model.model_validate(input_schema.model_dump()) for input_schema in inputs]


def _warn_on_transient_outputs(outputs: typing.Dict[str, schemas.ComputeTaskOutputSpec]):
Expand Down

0 comments on commit 520e720

Please sign in to comment.