Skip to content

Commit

Permalink
fix: documentation
Browse files Browse the repository at this point in the history
Signed-off-by: SdgJlbl <[email protected]>
  • Loading branch information
SdgJlbl committed Feb 19, 2024
1 parent ce26250 commit e5f49cf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
21 changes: 21 additions & 0 deletions references/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,27 @@ It is considered finished when the status is done, failed or cancelled.

- `exceptions.FutureTimeoutError`: The compute plan took more than the duration set in the timeout to complete.
Not raised when `timeout == None`
## wait_function
```text
wait_function(self, key: str, *, timeout: Optional[float] = None, polling_period: float = 1.0, raise_on_failure: bool = True) -> substra.sdk.models.Function
```

Wait for the build of the given function to finish.
It is considered finished when the status is ready, failed or cancelled.

**Arguments:**
- `key (str, required)`: the key of the task to wait for.
- `timeout (float, optional)`: maximum time to wait, in seconds. If set to None, will hang until completion.
- `polling_period (float, required)`: time to wait between two checks, in seconds. Defaults to 2.0.
- `raise_on_failure (bool, required)`: whether to raise an exception if the execution fails. Defaults to True.

**Returns:**

- `models.Function`: the function once built
Raises:
exceptions.FutureFailureError: The function build failed or have been cancelled.
exceptions.FutureTimeoutError: The function took more than the duration set in the timeout to build.
Not raised when `timeout == None`
## wait_task
```text
wait_task(self, key: str, *, timeout: Optional[float] = None, polling_period: float = 2.0, raise_on_failure: bool = True) -> substra.sdk.models.Task
Expand Down
1 change: 1 addition & 0 deletions references/sdk_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Asset creation specification base class.
- creation_date: <class 'datetime.datetime'>
- inputs: typing.List[substra.sdk.models.FunctionInput]
- outputs: typing.List[substra.sdk.models.FunctionOutput]
- status: <enum 'FunctionStatus'>
- description: <class 'substra.sdk.models._File'>
- archive: <class 'substra.sdk.models._File'>
```
Expand Down
8 changes: 4 additions & 4 deletions substra/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ def wait_task(
@logit
def wait_function(
self, key: str, *, timeout: Optional[float] = None, polling_period: float = 1.0, raise_on_failure: bool = True
) -> models.Task:
) -> models.Function:
"""Wait for the build of the given function to finish.
It is considered finished when the status is ready, failed or cancelled.
Expand All @@ -1091,11 +1091,11 @@ def wait_function(
raise_on_failure (bool): whether to raise an exception if the execution fails. Defaults to True.
Returns:
models.Task: the task after completion
models.Function: the function once built
Raises:
exceptions.FutureFailureError: The task failed or have been cancelled.
exceptions.FutureTimeoutError: The task took more than the duration set in the timeout to complete.
exceptions.FutureFailureError: The function build failed or have been cancelled.
exceptions.FutureTimeoutError: The function took more than the duration set in the timeout to build.
Not raised when `timeout == None`
"""
asset_getter = self.get_function
Expand Down

0 comments on commit e5f49cf

Please sign in to comment.