Skip to content

Commit

Permalink
doc: add ComputeTaskOutputSpec doc (#383)
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultFy <[email protected]>
  • Loading branch information
ThibaultFy authored Aug 30, 2023
1 parent 25aec10 commit 19e5476
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions bin/generate_sdk_schemas_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
schemas.FunctionInputSpec,
schemas.FunctionOutputSpec,
schemas.TaskSpec,
schemas.ComputeTaskOutputSpec,
schemas.UpdateFunctionSpec,
schemas.ComputePlanSpec,
schemas.UpdateComputePlanSpec,
Expand Down
30 changes: 23 additions & 7 deletions references/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ using 'login' function. It's always possible to generate a new token later by ma
Defaults to None.
- `username (str, optional)`: Username to authenticate to the Substra platform.
Used in conjunction with a password to generate a token if not given, using the `login` function.

If using username/password, you should use a context manager to ensure the session terminates as intended:
```
with Client(username, password) as client:
...
```
Not stored.
Defaults to None.
- `password (str, optional)`: Password to authenticate to the Substra platform.
Expand Down Expand Up @@ -254,7 +260,7 @@ tasks will result in a NotFound error.
- `str`: The logs as a str
## download_model
```text
download_model(self, key: str, destination_folder) -> None
download_model(self, key: str, destination_folder) -> pathlib.Path
```

Download model to destination file.
Expand Down Expand Up @@ -334,12 +340,13 @@ get_model(self, key: str) -> substra.sdk.models.OutModel
None
## get_performances
```text
get_performances(self, key: str) -> substra.sdk.models.Performances
get_performances(self, key: str, *, wait_completion: bool = False) -> substra.sdk.models.Performances
```

Get the compute plan performances by key, the returned object is described
in the [models.Performances](sdk_models.md#Performances) and easily convertible
to pandas dataframe.
to pandas dataframe. You can wait for compute task to finish by setting
`wait_completion = True`

**Examples:**
```python
Expand All @@ -356,11 +363,12 @@ Get task by key, the returned object is described
in the [models.Task](sdk_models.md#Task) model
## get_task_output_asset
```text
get_task_output_asset(self, key: str, identifier: str) -> substra.sdk.models.OutputAsset
get_task_output_asset(self, key: str, identifier: str, *, wait_completion: bool = False) -> substra.sdk.models.OutputAsset
```

Get an output asset for a specific task with a defined identifier, the returned object is described
in the [models.OutputAsset](sdk_models.md#OutputAsset) model
in the [models.OutputAsset](sdk_models.md#OutputAsset) model. You can wait
for compute task to finish by setting `wait_completion = True`
## link_dataset_with_data_samples
```text
link_dataset_with_data_samples(self, dataset_key: str, data_sample_keys: List[str]) -> List[str]
Expand Down Expand Up @@ -567,17 +575,25 @@ List input assets for a specific task, the returned object is described
in the [models.InputAsset](sdk_models.md#InputAsset) model
## list_task_output_assets
```text
list_task_output_assets(self, key: str) -> List[substra.sdk.models.OutputAsset]
list_task_output_assets(self, key: str, *, wait_completion: bool = False) -> List[substra.sdk.models.OutputAsset]
```

List output assets for a specific task, the returned object is described
in the [models.OutputAsset](sdk_models.md#OutputAsset) model
in the [models.OutputAsset](sdk_models.md#OutputAsset) model. You can wait
for compute task to finish by setting `wait_completion = True`
## login
```text
login(self, username, password)
```

Login to a remote server.
## logout
```text
logout(self) -> None
```

Log out from a remote server, if Client.login was used
(otherwise, nothing happens)
## organization_info
```text
organization_info(self) -> substra.sdk.models.OrganizationInfo
Expand Down
10 changes: 9 additions & 1 deletion references/sdk_schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [FunctionInputSpec](#FunctionInputSpec)
- [FunctionOutputSpec](#FunctionOutputSpec)
- [TaskSpec](#TaskSpec)
- [ComputeTaskOutputSpec](#ComputeTaskOutputSpec)
- [UpdateFunctionSpec](#UpdateFunctionSpec)
- [ComputePlanSpec](#ComputePlanSpec)
- [UpdateComputePlanSpec](#UpdateComputePlanSpec)
Expand Down Expand Up @@ -49,7 +50,7 @@ Specification for updating a dataset
```

## FunctionSpec
Specification for creating a function
Specification for creating an function

note : metadata field does not accept strings containing '__' as dict key
```text
Expand Down Expand Up @@ -93,6 +94,13 @@ Asset creation specification base class.
- outputs: Optional[Mapping[str, ComputeTaskOutputSpec]]
```

## ComputeTaskOutputSpec
Specification of a compute task output
```text
- permissions: Permissions
- is_transient: Optional[bool]
```

## UpdateFunctionSpec
Specification for updating an function
```text
Expand Down

0 comments on commit 19e5476

Please sign in to comment.